RFR: 8352565: Add native method implementation of Reference.get() [v10]
Kim Barrett
kbarrett at openjdk.org
Fri Jun 6 06:00:49 UTC 2025
On Fri, 6 Jun 2025 05:57:16 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:
>> Please review this change which adds a native method providing the
>> implementation of Reference::get. Referece::get is an intrinsic candidate, so
>> this native method implementation is only used when the intrinsic is not.
>>
>> Currently there is intrinsic support by the interpreter, C1, C2, and graal,
>> which are always used. With this change we can later remove all the
>> per-platform interpreter intrinsic implementations, and might also remove the
>> C1 intrinsic implementation.
>>
>> Testing:
>> (1) mach5 tier1-6 normal (so using all the existing intrinsics).
>> (2) mach5 tier1-6 with interpreter and C1 Reference::get intrinsics disabled.
>
> Kim Barrett has updated the pull request incrementally with two additional commits since the last revision:
>
> - add pseudo-native entry for Reference.get0
> - tidy CallGenerator lookup in Compile ctor
src/hotspot/share/interpreter/templateInterpreterGenerator.cpp line 231:
> 229: // intrinsic is disabled.
> 230: native_method_entry(java_lang_Thread_currentThread)
> 231: native_method_entry(java_lang_ref_reference_get0)
It turned out there was a bug lurking in the change to move the intrinsic to
Reference::get0. I had tested it with the interpreter intrinsic made
inoperative, but nearly forgot to test the normal case. It turned out that if
the interpreter intrinsic was operational but disabled then the interpreter
would hit an assert "tried to execute native method as non-native". This line
is the fix for that.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24315#discussion_r2131558170
More information about the hotspot-dev
mailing list