1.1 --- a/src/share/vm/memory/sharedHeap.cpp Mon Aug 04 15:04:45 2014 +0200 1.2 +++ b/src/share/vm/memory/sharedHeap.cpp Wed Aug 06 09:55:16 2014 +0200 1.3 @@ -159,9 +159,9 @@ 1.4 Monitor* SharedHeap::StrongRootsScope::_lock = new Monitor(Mutex::leaf, "StrongRootsScope lock", false); 1.5 1.6 void SharedHeap::StrongRootsScope::mark_worker_done_with_threads(uint n_workers) { 1.7 - // The Thread work barrier is only needed by G1. 1.8 + // The Thread work barrier is only needed by G1 Class Unloading. 1.9 // No need to use the barrier if this is single-threaded code. 1.10 - if (UseG1GC && n_workers > 0) { 1.11 + if (UseG1GC && ClassUnloadingWithConcurrentMark && n_workers > 0) { 1.12 uint new_value = (uint)Atomic::add(1, &_n_workers_done_with_threads); 1.13 if (new_value == n_workers) { 1.14 // This thread is last. Notify the others. 1.15 @@ -172,6 +172,9 @@ 1.16 } 1.17 1.18 void SharedHeap::StrongRootsScope::wait_until_all_workers_done_with_threads(uint n_workers) { 1.19 + assert(UseG1GC, "Currently only used by G1"); 1.20 + assert(ClassUnloadingWithConcurrentMark, "Currently only needed when doing G1 Class Unloading"); 1.21 + 1.22 // No need to use the barrier if this is single-threaded code. 1.23 if (n_workers > 0 && (uint)_n_workers_done_with_threads != n_workers) { 1.24 MonitorLockerEx ml(_lock, Mutex::_no_safepoint_check_flag);