--- old/src/hotspot/share/gc/shared/referenceProcessor.cpp 2018-05-14 18:03:03.576099339 -0400 +++ new/src/hotspot/share/gc/shared/referenceProcessor.cpp 2018-05-14 18:03:03.332086584 -0400 @@ -379,7 +379,8 @@ iter.load_ptrs(DEBUG_ONLY(!discovery_is_atomic() /* allow_null_referent */)); if (iter.referent() == NULL) { // Reference has been cleared since discovery; only possible if - // discovery is not atomic. Remove reference from list. + // discovery is not atomic (checked by load_ptrs). Remove + // reference from list. log_dropped_ref(iter, "cleared"); iter.remove(); iter.move_to_next(); --- old/src/java.base/share/classes/java/lang/ref/Reference.java 2018-05-14 18:03:04.372140957 -0400 +++ new/src/java.base/share/classes/java/lang/ref/Reference.java 2018-05-14 18:03:04.088126108 -0400 @@ -76,21 +76,23 @@ * queue = ReferenceQueue.NULL. * * The collector only needs to examine the referent field and the - * discovered field to determine whether a normal Reference object needs - * special treatment. If the referent is non-null and not known to be - * live, then it may need to be discovered for possible later - * notification. But if the discovered field is non-null, then either (1) - * it has already been discovered, or (2) it is in the pending list. + * discovered field to determine whether a normal (non-FinalReference) + * Reference object needs special treatment. If the referent is non-null + * and not known to be live, then it may need to be discovered for + * possible later notification. But if the discovered field is non-null, + * then either (1) it has already been discovered, or (2) it is in the + * pending list. * - * FinalReference differs from other references, because a FinalReference - * is not cleared when notified. The referent being null or not cannot be - * used to distinguish between the active state and pending or inactive - * states. However, FinalReferences do not support enqueue(). Instead, - * the next field of a FinalReference object is set to the object when it - * is added to the pending list, and the use of this as the value of next - * in the enqueued and dequeued states maintains the non-active state. An - * additional check that the next field is null is required to determine - * that a FinalReference object is active. + * FinalReference (which exists to support finalization, which was + * deprecated in JDK 9) differs from normal references, because a + * FinalReference is not cleared when notified. The referent being null + * or not cannot be used to distinguish between the active state and + * pending or inactive states. However, FinalReferences do not support + * enqueue(). Instead, the next field of a FinalReference object is set + * to "this" when it is added to the pending list. The use of "this" + * as the value of next in the enqueued and dequeued states maintains the + * non-active state. An additional check that the next field is null is + * required to determine that a FinalReference object is active. * * Initial states: * active/registered