src/hotspot/share/runtime/safepoint.cpp
changeset 47636 52d46d7e3454
parent 47629 494e1490b341
child 47637 87141990dde5
--- a/src/hotspot/share/runtime/safepoint.cpp	Mon Oct 16 23:23:27 2017 -0700
+++ b/src/hotspot/share/runtime/safepoint.cpp	Tue Oct 17 08:51:55 2017 +0200
@@ -63,10 +63,6 @@
 #include "trace/traceMacros.hpp"
 #include "utilities/events.hpp"
 #include "utilities/macros.hpp"
-#if INCLUDE_ALL_GCS
-#include "gc/cms/concurrentMarkSweepThread.hpp"
-#include "gc/g1/suspendibleThreadSet.hpp"
-#endif // INCLUDE_ALL_GCS
 #ifdef COMPILER1
 #include "c1/c1_globals.hpp"
 #endif
@@ -94,15 +90,7 @@
     _ts_of_current_safepoint = tty->time_stamp().seconds();
   }
 
-#if INCLUDE_ALL_GCS
-  if (UseConcMarkSweepGC) {
-    // In the future we should investigate whether CMS can use the
-    // more-general mechanism below.  DLD (01/05).
-    ConcurrentMarkSweepThread::synchronize(false);
-  } else if (UseG1GC) {
-    SuspendibleThreadSet::synchronize();
-  }
-#endif // INCLUDE_ALL_GCS
+  Universe::heap()->safepoint_synchronize_begin();
 
   // By getting the Threads_lock, we assure that no threads are about to start or
   // exit. It is released again in SafepointSynchronize::end().
@@ -512,14 +500,7 @@
     Threads_lock->unlock();
 
   }
-#if INCLUDE_ALL_GCS
-  // If there are any concurrent GC threads resume them.
-  if (UseConcMarkSweepGC) {
-    ConcurrentMarkSweepThread::desynchronize(false);
-  } else if (UseG1GC) {
-    SuspendibleThreadSet::desynchronize();
-  }
-#endif // INCLUDE_ALL_GCS
+  Universe::heap()->safepoint_synchronize_end();
   // record this time so VMThread can keep track how much time has elapsed
   // since last safepoint.
   _end_of_last_safepoint = os::javaTimeMillis();