Fri, 13 Jun 2014 13:46:06 +0200
8044796: G1: Enable G1CollectedHeap::stop()
Reviewed-by: brutisso, sjohanss
1.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Fri Jun 13 17:07:39 2014 -0400 1.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Fri Jun 13 13:46:06 2014 +0200 1.3 @@ -432,14 +432,6 @@ 1.4 return hr; 1.5 } 1.6 1.7 -void G1CollectedHeap::stop_conc_gc_threads() { 1.8 - _cg1r->stop(); 1.9 - _cmThread->stop(); 1.10 - if (G1StringDedup::is_enabled()) { 1.11 - G1StringDedup::stop(); 1.12 - } 1.13 -} 1.14 - 1.15 #ifdef ASSERT 1.16 // A region is added to the collection set as it is retired 1.17 // so an address p can point to a region which will be in the 1.18 @@ -2186,20 +2178,14 @@ 1.19 } 1.20 1.21 void G1CollectedHeap::stop() { 1.22 -#if 0 1.23 - // Stopping concurrent worker threads is currently disabled until 1.24 - // some bugs in concurrent mark has been resolve. Without fixing 1.25 - // those bugs first we risk haning during VM exit when trying to 1.26 - // stop these threads. 1.27 - 1.28 - // Abort any ongoing concurrent root region scanning and stop all 1.29 - // concurrent threads. We do this to make sure these threads do 1.30 - // not continue to execute and access resources (e.g. gclog_or_tty) 1.31 + // Stop all concurrent threads. We do this to make sure these threads 1.32 + // do not continue to execute and access resources (e.g. gclog_or_tty) 1.33 // that are destroyed during shutdown. 1.34 - _cm->root_regions()->abort(); 1.35 - _cm->root_regions()->wait_until_scan_finished(); 1.36 - stop_conc_gc_threads(); 1.37 -#endif 1.38 + _cg1r->stop(); 1.39 + _cmThread->stop(); 1.40 + if (G1StringDedup::is_enabled()) { 1.41 + G1StringDedup::stop(); 1.42 + } 1.43 } 1.44 1.45 size_t G1CollectedHeap::conservative_max_heap_alignment() {
2.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Fri Jun 13 17:07:39 2014 -0400 2.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Fri Jun 13 13:46:06 2014 +0200 2.3 @@ -1699,8 +1699,6 @@ 2.4 void print_all_rsets() PRODUCT_RETURN; 2.5 2.6 public: 2.7 - void stop_conc_gc_threads(); 2.8 - 2.9 size_t pending_card_num(); 2.10 size_t cards_scanned(); 2.11
3.1 --- a/src/share/vm/runtime/java.cpp Fri Jun 13 17:07:39 2014 -0400 3.2 +++ b/src/share/vm/runtime/java.cpp Fri Jun 13 13:46:06 2014 +0200 3.3 @@ -497,9 +497,6 @@ 3.4 os::infinite_sleep(); 3.5 } 3.6 3.7 - // Stop any ongoing concurrent GC work 3.8 - Universe::heap()->stop(); 3.9 - 3.10 // Terminate watcher thread - must before disenrolling any periodic task 3.11 if (PeriodicTask::num_tasks() > 0) 3.12 WatcherThread::stop(); 3.13 @@ -514,10 +511,8 @@ 3.14 StatSampler::disengage(); 3.15 StatSampler::destroy(); 3.16 3.17 - // We do not need to explicitly stop concurrent GC threads because the 3.18 - // JVM will be taken down at a safepoint when such threads are inactive -- 3.19 - // except for some concurrent G1 threads, see (comment in) 3.20 - // Threads::destroy_vm(). 3.21 + // Stop concurrent GC threads 3.22 + Universe::heap()->stop(); 3.23 3.24 // Print GC/heap related information. 3.25 if (PrintGCDetails) {
4.1 --- a/src/share/vm/runtime/thread.cpp Fri Jun 13 17:07:39 2014 -0400 4.2 +++ b/src/share/vm/runtime/thread.cpp Fri Jun 13 13:46:06 2014 +0200 4.3 @@ -4013,14 +4013,8 @@ 4.4 // GC vm_operations can get caught at the safepoint, and the 4.5 // heap is unparseable if they are caught. Grab the Heap_lock 4.6 // to prevent this. The GC vm_operations will not be able to 4.7 - // queue until after the vm thread is dead. 4.8 - // After this point, we'll never emerge out of the safepoint before 4.9 - // the VM exits, so concurrent GC threads do not need to be explicitly 4.10 - // stopped; they remain inactive until the process exits. 4.11 - // Note: some concurrent G1 threads may be running during a safepoint, 4.12 - // but these will not be accessing the heap, just some G1-specific side 4.13 - // data structures that are not accessed by any other threads but them 4.14 - // after this point in a terminal safepoint. 4.15 + // queue until after the vm thread is dead. After this point, 4.16 + // we'll never emerge out of the safepoint before the VM exits. 4.17 4.18 MutexLocker ml(Heap_lock); 4.19