RFR: 8203028: Simplify reference processing in light of JDK-8175797

Kim Barrett kim.barrett at oracle.com
Sun May 20 15:12:55 UTC 2018


> On May 15, 2018, at 12:09 AM, Kim Barrett <kim.barrett at oracle.com> wrote:
> New webrev, rebased to include JDK-8201491:
> http://cr.openjdk.java.net/~kbarrett/8203028/open.01/
> 
> New webrevs with above changes:
> full: http://cr.openjdk.java.net/~kbarrett/8203028/open.02/
> incr: http://cr.openjdk.java.net/~kbarrett/8203028/open.02.inc/

Following up on a suggestion from Mark Reinhold in the discussion of JDK-8203327
on the core-libs list, I’ve added the following comment to the Reference.queue field.

diff -r 98982cddbac0 -r 2429129c4d48 src/java.base/share/classes/java/lang/ref/Reference.java
--- a/src/java.base/share/classes/java/lang/ref/Reference.java	Mon May 14 18:01:36 2018 -0400
+++ b/src/java.base/share/classes/java/lang/ref/Reference.java	Sun May 20 11:06:48 2018 -0400
@@ -131,6 +131,14 @@
 
     private T referent;         /* Treated specially by GC */
 
+    /* The queue this reference gets enqueued to by GC notification or by
+     * calling enqueue().
+     *
+     * When registered: the queue with which this reference is registered.
+     *        enqueued: ReferenceQueue.ENQUEUE
+     *        dequeued: ReferenceQueue.NULL
+     *    unregistered: ReferenceQueue.NULL
+     */
     volatile ReferenceQueue<? super T> queue;
 
     /* The link in a ReferenceQueue's list of Reference objects.



More information about the hotspot-gc-dev mailing list