RFR: 8257180: Prevent resurrection of final/phantom refs through JNI weak refs
Kim Barrett
kbarrett at openjdk.java.net
Thu Nov 26 19:22:57 UTC 2020
On Thu, 26 Nov 2020 19:11:08 GMT, Roman Kennke <rkennke at openjdk.org> wrote:
>> src/hotspot/share/runtime/jniHandles.inline.hpp line 58:
>>
>>> 56: oop result;
>>> 57: if (is_jweak(handle)) { // Unlikely
>>> 58: result = NativeAccess<ON_WEAK_OOP_REF|decorators>::oop_load(jweak_ptr(handle));
>>
>> This is incorrect. JNI weak references have phantom strength, not weak strength. This changes is incorrect.
>
> Can you explain why? I believe I have pointed out the relevant sections in the specification, their changes, and also in the previous implementation. The current behavious is not only unintuitive, it also may lead to unintentional resurrection of finalized final or phantom references.
I'm working on a longer reply. I wanted to get a stake in the ground to block this change while I work on that. It *is* a holiday here in the US.
-------------
PR: https://git.openjdk.java.net/jdk/pull/1464
More information about the hotspot-runtime-dev
mailing list