RFR: 8352565: Add native method implementation of Reference.get() [v8]

Chen Liang liach at openjdk.org
Wed Jun 4 17:43:03 UTC 2025


On Wed, 4 Jun 2025 07:12:42 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 with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 13 additional commits since the last revision:
> 
>  - Merge branch 'master' into native-reference-get
>  - make private native Reference.get0 the intrinsic
>  - Merge branch 'master' into native-reference-get
>  - Merge branch 'master' into native-reference-get
>  - use new waitForRefProc, some tidying
>  - Merge branch 'master' into native-reference-get
>  - remove timeout by using waitForReferenceProcessing
>  - make ill-timed gc in non-concurrent case less likely
>  - fix test package use
>  - add package decl to test
>  - ... and 3 more: https://git.openjdk.org/jdk/compare/8d780d2e...98056a8b

src/hotspot/share/classfile/vmSymbols.hpp line 425:

> 423:   template(pc_name,                                   "pc")                                       \
> 424:   template(cs_name,                                   "cs")                                       \
> 425:   template(get_name,                                  "get")                                      \

A bit surprised that this is not used elsewhere - but as long as this passes compilation I guess this is fine.

src/hotspot/share/interpreter/abstractInterpreter.hpp line 86:

> 84:     java_lang_math_fmaF,                                        // implementation of java.lang.Math.fma   (x, y, z)
> 85:     java_lang_math_fmaD,                                        // implementation of java.lang.Math.fma   (x, y, z)
> 86:     java_lang_ref_reference_get0,                                // implementation of java.lang.ref.Reference.get()

Suggestion:

    java_lang_ref_reference_get0,                               // implementation of java.lang.ref.Reference.get()

src/hotspot/share/opto/compile.cpp line 786:

> 784:       initial_gvn()->set_type_bottom(s);
> 785:       verify_start(s);
> 786:       if (method()->intrinsic_id() == vmIntrinsics::_Reference_get) {

Should we remove this now or as part of the redundant intrinsic cleanup for interpreter and c1? I see the interpreter is now kept intact.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24315#discussion_r2127108041
PR Review Comment: https://git.openjdk.org/jdk/pull/24315#discussion_r2127114784
PR Review Comment: https://git.openjdk.org/jdk/pull/24315#discussion_r2127117794


More information about the hotspot-dev mailing list