RFR: 8256516: Simplify clearing References
Aleksey Shipilev
shade at openjdk.java.net
Wed Nov 18 10:13:06 UTC 2020
On Wed, 18 Nov 2020 09:53:11 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:
> Please review this simplification of jlr.Reference clearing by VM code.
>
> The function java_lang_ref_Reference::set_referent_raw was being used to
> clear the referent of Reference objects, and only for that purpose. This
> change replaces that function with java_lang_ref_Reference::clear_referent,
> which is much more obvious in intent. That change is then percolated up
> through callers in the obvious way.
>
> Testing:
> mach5 tier1
Looks good, with minor nit.
src/hotspot/share/gc/shared/referenceProcessor.hpp line 123:
> 121:
> 122: // Apply the keep_alive function to the referent address.
> 123: void make_referent_alive();
I wonder if moving this from the `.hpp` to `.cpp` has performance implications for callers. Maybe move to `.inline.hpp`?
src/hotspot/share/gc/shenandoah/shenandoahReferenceProcessor.cpp line 319:
> 317: } else {
> 318: // Clear referent
> 319: reference_clear_referent(reference);
Now I am looking at this code and wonder if we could just inline `reference_clear_referent` and `reference_set_next` both in Shenandoah and ZGC code. Probably something for a followup.
-------------
Marked as reviewed by shade (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/1286
More information about the hotspot-dev
mailing list