RFR: JDK-8211279: Verify missing object equals barriers
rkennke at redhat.com
Fri Sep 28 14:59:54 UTC 2018
GCs like Shenandoah require an extra barrier for comparing objects
(oop==oop). It is easy to forget or overlook this. It would be very
useful to have a flag to turn on extra verification that catches missing
object equality barriers.
This change inserts an assert into == and != operators for the oop class
in oopsHierarchy.hpp. This only gets compiled in fastdebug builds (when
CHECK_UNHANDLED_OOPS is on).
It also adds a develop flag VerifyObjectEquals that is used to turn on
It also adds a method oopDesc::unsafe_equals(..) to be used in cases
where you know what what you are doing, and really want to use direct ==
comparison without using barriers. This is used in e.g.
ReferenceProcessor or all over the place in ShenandoahGC.
The change also fixes a couple of places where oops are compared to
non-oops like Universe::non_oop_word() to use the oop==void* operator
instead, so those don't falsely trip the verification.
It doesn't make sense to turn this check on if you're not running a GC
that needs it, unless you want to go fix all the oop==oop in the GC itself.
What do you think?
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 833 bytes
Desc: OpenPGP digital signature
More information about the hotspot-gc-dev