RFR: 8256011: Shenandoah: Don't resurrect finalizably reachable objects [v3]

Aleksey Shipilev shade at openjdk.java.net
Tue Nov 10 11:11:59 UTC 2020


On Tue, 10 Nov 2020 10:18:57 GMT, Roman Kennke <rkennke at openjdk.org> wrote:

>> src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.hpp line 62:
>> 
>>> 60: 
>>> 61:   static bool is_weak_access(DecoratorSet decorators) {
>>> 62:     return (decorators & (ON_WEAK_OOP_REF | ON_UNKNOWN_OOP_REF)) != 0;
>> 
>> Um. Shouldn't `ON_UNKNOWN_OOP_REF` default to strong? I.e. the access via Unsafe should probably resurrect the object, otherwise it corrupts the heap?
>
> No. ON_UNKNOWN_OOP_REF *might* access the referent field by reflection. We must do the correct thing in this situation. Normally, ON_UNKNOWN_OOP_REF is indeed called on normal/strong references, though, however we do the correct thing in this case too, because the referent would be marked and thus go through regular LRB. It doesn't hurt to call into weak for unknown oop refs.

> No. ON_UNKNOWN_OOP_REF _might_ access the referent field by reflection. 

Ew. This just goes against my intuition about the default strongness. For example, `Unsafe_GetReference` calls with `ON_UNKNOWN_OOP_REF` -- does that mean we would treat that access as weak? I don't think we should.

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

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


More information about the shenandoah-dev mailing list