[jdk17] RFR: 8269897: Shenandoah: Treat UNKNOWN refs access as strong [v2]
Aleksey Shipilev
shade at openjdk.java.net
Wed Jul 7 18:32:54 UTC 2021
On Wed, 7 Jul 2021 17:48:50 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
>> Roman Kennke has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Treat UNKNOWN as STRONG more selectively only on CAE
>
> src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp line 270:
>
>> 268: // Note: We don't need a keep-alive-barrier here. We already enqueue any loaded reference for SATB anyway,
>> 269: // because it must be the previous value.
>> 270: res = ShenandoahBarrierSet::barrier_set()->load_reference_barrier<decorators & ~ON_UNKNOWN_OOP_REF, T>(res, NULL);
>
> Add a comment:
>
>
> // Note: We don't need a keep-alive-barrier here. We already enqueue any loaded reference for SATB anyway,
> // because it must be the previous value. Convert ON_UNKNOWN_OOP_REF to strong, so that we don't return
> // NULL for weak values, breaking CAS contract. The downside is this method effectively resurrecting
> // weak values without GC knowing about it. If Unsafe/JNI users are using this method on weak values
> // (i.e. doing unsafe accesses to Reference.referent), they are on their own.
I also believe "xchg" needs the same fix and a comment:
// Note: We don't need a keep-alive-barrier here. We already enqueue any loaded reference for SATB anyway,
// because it must be the previous value. Convert ON_UNKNOWN_OOP_REF to strong, so that we don't return
// NULL for weak values. ShenandoahBarrierSet::See oop_atomic_cmpxchg_not_in_heap for explanation.
-------------
PR: https://git.openjdk.java.net/jdk17/pull/219
More information about the shenandoah-dev
mailing list