RFR: 8271862: C2 intrinsic for Reference.refersTo() is often not used

Vladimir Ivanov vlivanov at openjdk.java.net
Mon Aug 9 21:16:31 UTC 2021


On Mon, 9 Aug 2021 20:15:59 GMT, Mandy Chung <mchung at openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/ref/Reference.java line 374:
>> 
>>> 372:      * to call the native implementation over the intrinsic.
>>> 373:      */
>>> 374:     boolean refersToImpl(T obj) {
>> 
>> I'm curious why can't you get rid of `refersToImpl` (virtual method) and just override `refersTo` on `PhantomReference`. Am I missing something important about keeping `refersTo` final?
>
> We don't want user-defined subclass of `Reference` overriding the `refersTo` implementation accidentally.

Got it. Thanks for the clarification!

-------------

PR: https://git.openjdk.java.net/jdk/pull/5052


More information about the hotspot-compiler-dev mailing list