changeset 6605:2e73c43c2d70

8044796: G1: Enable G1CollectedHeap::stop() Reviewed-by: brutisso, sjohanss
author pliden
date Fri, 13 Jun 2014 13:46:06 +0200
parents 1abbc1e91ac5
children cc616eae2670
files src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp src/share/vm/runtime/java.cpp src/share/vm/runtime/thread.cpp
diffstat 4 files changed, 11 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Wed Jun 11 18:56:01 2014 +0400
+++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Fri Jun 13 13:46:06 2014 +0200
@@ -433,14 +433,6 @@
   return hr;
 }
 
-void G1CollectedHeap::stop_conc_gc_threads() {
-  _cg1r->stop();
-  _cmThread->stop();
-  if (G1StringDedup::is_enabled()) {
-    G1StringDedup::stop();
-  }
-}
-
 #ifdef ASSERT
 // A region is added to the collection set as it is retired
 // so an address p can point to a region which will be in the
@@ -2174,20 +2166,14 @@
 }
 
 void G1CollectedHeap::stop() {
-#if 0
-  // Stopping concurrent worker threads is currently disabled until
-  // some bugs in concurrent mark has been resolve. Without fixing
-  // those bugs first we risk haning during VM exit when trying to
-  // stop these threads.
-
-  // Abort any ongoing concurrent root region scanning and stop all
-  // concurrent threads. We do this to make sure these threads do
-  // not continue to execute and access resources (e.g. gclog_or_tty)
+  // Stop all concurrent threads. We do this to make sure these threads
+  // do not continue to execute and access resources (e.g. gclog_or_tty)
   // that are destroyed during shutdown.
-  _cm->root_regions()->abort();
-  _cm->root_regions()->wait_until_scan_finished();
-  stop_conc_gc_threads();
-#endif
+  _cg1r->stop();
+  _cmThread->stop();
+  if (G1StringDedup::is_enabled()) {
+    G1StringDedup::stop();
+  }
 }
 
 size_t G1CollectedHeap::conservative_max_heap_alignment() {
--- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Wed Jun 11 18:56:01 2014 +0400
+++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Fri Jun 13 13:46:06 2014 +0200
@@ -1684,8 +1684,6 @@
   void print_all_rsets() PRODUCT_RETURN;
 
 public:
-  void stop_conc_gc_threads();
-
   size_t pending_card_num();
   size_t cards_scanned();
 
--- a/src/share/vm/runtime/java.cpp	Wed Jun 11 18:56:01 2014 +0400
+++ b/src/share/vm/runtime/java.cpp	Fri Jun 13 13:46:06 2014 +0200
@@ -501,9 +501,6 @@
     os::infinite_sleep();
   }
 
-  // Stop any ongoing concurrent GC work
-  Universe::heap()->stop();
-
   // Terminate watcher thread - must before disenrolling any periodic task
   if (PeriodicTask::num_tasks() > 0)
     WatcherThread::stop();
@@ -518,10 +515,8 @@
   StatSampler::disengage();
   StatSampler::destroy();
 
-  // We do not need to explicitly stop concurrent GC threads because the
-  // JVM will be taken down at a safepoint when such threads are inactive --
-  // except for some concurrent G1 threads, see (comment in)
-  // Threads::destroy_vm().
+  // Stop concurrent GC threads
+  Universe::heap()->stop();
 
   // Print GC/heap related information.
   if (PrintGCDetails) {
--- a/src/share/vm/runtime/thread.cpp	Wed Jun 11 18:56:01 2014 +0400
+++ b/src/share/vm/runtime/thread.cpp	Fri Jun 13 13:46:06 2014 +0200
@@ -3968,14 +3968,8 @@
     // GC vm_operations can get caught at the safepoint, and the
     // heap is unparseable if they are caught. Grab the Heap_lock
     // to prevent this. The GC vm_operations will not be able to
-    // queue until after the vm thread is dead.
-    // After this point, we'll never emerge out of the safepoint before
-    // the VM exits, so concurrent GC threads do not need to be explicitly
-    // stopped; they remain inactive until the process exits.
-    // Note: some concurrent G1 threads may be running during a safepoint,
-    // but these will not be accessing the heap, just some G1-specific side
-    // data structures that are not accessed by any other threads but them
-    // after this point in a terminal safepoint.
+    // queue until after the vm thread is dead. After this point,
+    // we'll never emerge out of the safepoint before the VM exits.
 
     MutexLocker ml(Heap_lock);