RFR: JDK-8211279: Verify missing object equals barriers

Roman Kennke rkennke at redhat.com
Mon Oct 8 16:32:25 UTC 2018


Hi Aleksey,

Thanks for reviewing!

> On 10/03/2018 03:25 PM, Roman Kennke wrote:
>> This addresses all the issues mentioned above:
>> http://cr.openjdk.java.net/~rkennke/JDK-8211279/webrev.02/
> 
> I think this is a cute way to get things going.
> 
> *) I always get a bit uneasy seeing the casts to (void*) like here:
> 
>  413   static bool equals(oop o1, oop o2) { return (void*)o1 == (void*)o2; }
> 
>  ...but I think this comparison is well-defined in C++ with the semantics we want.

What would you suggest? reinterpret_cast<void*>(..) better?

> *) So, if CHECK_UNHANDLED_OOPS is not defined, this declaration is inaccessible, and asserts that
> use it would fail to compile? I think this ifdef is not needed here, but rather it should be around
> the asserts in oop::operator== and !=?
> 
>  133 #ifdef CHECK_UNHANDLED_OOPS
>  134   virtual bool oop_equals_operator_allowed() { return true; }
>  135 #endif
>  136
> 
> ...
> 
>   58 bool oop::operator==(const oop o) const {
>   59   assert(BarrierSet::barrier_set()->oop_equals_operator_allowed(), "Not allowed");
>   60   return obj() == o.obj();
>   61 }

It already *is* around the whole (oop class) declaration in
oopsHierarchy.hpp, that's the only user of the check so I put this under
#ifdef CHECK_UNHANDLED_OOPS too, but I can remove this #ifdef if you
prefer. Let me know?

Roman


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://mail.openjdk.java.net/pipermail/hotspot-gc-dev/attachments/20181008/f7d53746/signature-0001.asc>


More information about the hotspot-gc-dev mailing list