diff -r dc3aa11c6da7 -r acc2744fd84b hotspot/src/share/vm/gc/shared/referenceProcessor.cpp --- a/hotspot/src/share/vm/gc/shared/referenceProcessor.cpp Tue Sep 15 15:49:33 2015 +0200 +++ b/hotspot/src/share/vm/gc/shared/referenceProcessor.cpp Wed Sep 16 16:25:02 2015 +0200 @@ -243,13 +243,10 @@ process_discovered_reflist(_discoveredPhantomRefs, NULL, false, is_alive, keep_alive, complete_gc, task_executor); - } - - // Cleaners - size_t cleaner_count = 0; - { - GCTraceTime tt("Cleaners", trace_time, false, gc_timer, gc_id); - cleaner_count = + // Process cleaners, but include them in phantom statistics. We expect + // Cleaner references to be temporary, and don't want to deal with + // possible incompatibilities arising from making it more visible. + phantom_count += process_discovered_reflist(_discoveredCleanerRefs, NULL, true, is_alive, keep_alive, complete_gc, task_executor); } @@ -259,17 +256,15 @@ // that is not how the JDK1.2 specification is. See #4126360. Native code can // thus use JNI weak references to circumvent the phantom references and // resurrect a "post-mortem" object. - size_t jni_weak_ref_count = 0; { GCTraceTime tt("JNI Weak Reference", trace_time, false, gc_timer, gc_id); if (task_executor != NULL) { task_executor->set_single_threaded_mode(); } - jni_weak_ref_count = - process_phaseJNI(is_alive, keep_alive, complete_gc); + process_phaseJNI(is_alive, keep_alive, complete_gc); } - return ReferenceProcessorStats(soft_count, weak_count, final_count, phantom_count, cleaner_count, jni_weak_ref_count); + return ReferenceProcessorStats(soft_count, weak_count, final_count, phantom_count); } #ifndef PRODUCT @@ -296,17 +291,17 @@ } #endif -size_t ReferenceProcessor::process_phaseJNI(BoolObjectClosure* is_alive, - OopClosure* keep_alive, - VoidClosure* complete_gc) { - DEBUG_ONLY(size_t check_count = count_jni_refs();) - size_t count = JNIHandles::weak_oops_do(is_alive, keep_alive); - assert(count == check_count, "Counts didn't match"); +void ReferenceProcessor::process_phaseJNI(BoolObjectClosure* is_alive, + OopClosure* keep_alive, + VoidClosure* complete_gc) { +#ifndef PRODUCT + if (PrintGCDetails && PrintReferenceGC) { + unsigned int count = count_jni_refs(); + gclog_or_tty->print(", %u refs", count); + } +#endif + JNIHandles::weak_oops_do(is_alive, keep_alive); complete_gc->do_void(); - if (PrintGCDetails && PrintReferenceGC) { - gclog_or_tty->print(", " SIZE_FORMAT " refs", count); - } - return count; } @@ -946,10 +941,9 @@ list = &_discoveredCleanerRefs[id]; break; case REF_NONE: - case REF_JNI: // we should not reach here if we are an InstanceRefKlass default: - guarantee(false, err_msg("rt should not be %d", rt)); + ShouldNotReachHere(); } if (TraceReferenceGC && PrintGCDetails) { gclog_or_tty->print_cr("Thread %d gets list " INTPTR_FORMAT, id, p2i(list));