RFR: 8188066: (ref) Examine the reachability of JNI WeakGlobalRef and interaction with phantom refs

Hans Boehm hboehm at google.com
Wed Mar 13 22:19:42 UTC 2019

Looks great to me!

Just to be clear, this is intended to guarantee that it's not possible to
promote a weak global reference that indirectly points to A after a
PhantomReference or a WeakGlobalReference to A has been cleared? Thus this
reference clearing must happen more or less atomically.

I think this property has always been needed for the intended use of
PhantomReferences, since otherwise the referent of a cleared
PhantomReference could be resurrected. It's great to get it in the spec.

On Wed, Mar 13, 2019 at 1:08 PM Kim Barrett <kim.barrett at oracle.com> wrote:

> Please review this change to the JNI specification.  The specified
> behavior of Weak Global References, and in particular their
> relationship to Java PhantomReference, is being updated to account
> for a change to PhantomReference by JDK-8071507.
> CR:
> https://bugs.openjdk.java.net/browse/JDK-8188066
> CSR:
> https://bugs.openjdk.java.net/browse/JDK-8220617
> Changes:
> http://cr.openjdk.java.net/~kbarrett/8188066/jni_specdiff_rev1.html
>   specdiff for the changes.  In addition to updating the section
>   describing Weak Global References, the description of NewGlobalRef
>   is updated, as well as the copyright footer.
> http://cr.openjdk.java.net/~kbarrett/8188066/weak_global_refs_rev1.md
>   Copies of the before and after text for the JNI Weak Global
>   References section; easier to read than diffs or specdiff.

More information about the core-libs-dev mailing list