RFR: JDK-8204970: Remaing object comparisons need to use oopDesc::equals()
Roman Kennke
rkennke at redhat.com
Sat Jul 7 10:52:44 UTC 2018
Am 07.07.2018 um 05:18 schrieb Kim Barrett:
>> On Jul 6, 2018, at 11:28 AM, Roman Kennke <rkennke at redhat.com> wrote:
>>
>> We found 2 more places where oopDesc::equals() should be used instead of
>> raw obj==obj.
>>
>> Bug:
>> https://bugs.openjdk.java.net/browse/JDK-8204970
>> Webrev:
>> http://cr.openjdk.java.net/~rkennke/JDK-8204970/webrev.00/
>>
>> Passes tier1 tests
>>
>> Can I get a review?
>>
>> Thanks,
>> Roman
>
> This looks good.
>
> How close are we to being able to remove operator== and operator!= from the oop class that
> is defined when CHECK_UNHANDLED_OOPS is defined? I suspect the main problem is
> checks for NULL?
The main problems are all those places where we actually want to use
naked comparisons, especially inside GC code.
In Shenandoah, we actually put checks in the == and != operators to
catch unintended raw == and !=:
https://builds.shipilev.net/patch-openjdk-shenandoah-jdk/2018-07-06-v255-vs-dea7ce62c7b0/src/hotspot/share/oops/oopsHierarchy.hpp.udiff.html
But this requires all *intended* raw comparisons to be expressed
differently, in Shenandoah we have a special unsafe_equals() method that
casts to oop to HeapWord* and compare that, but we could use
RawAccessBarrier::equals() for this now.
These verification checks have proven to be very useful to catch bad
naked ==, I'd like to upstream this soon if you agree. WDYT?
Cheers,
Roman
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <https://mail.openjdk.org/pipermail/hotspot-gc-dev/attachments/20180707/b07965bc/signature.asc>
More information about the hotspot-gc-dev
mailing list