< prev index next >

src/share/vm/gc/shared/collectedHeap.cpp

Print this page
rev 13298 : 8184751: Provide thread pool for parallel safepoint cleanup

@@ -31,10 +31,11 @@
 #include "gc/shared/gcHeapSummary.hpp"
 #include "gc/shared/gcTrace.hpp"
 #include "gc/shared/gcTraceTime.inline.hpp"
 #include "gc/shared/gcWhen.hpp"
 #include "gc/shared/vmGCOperations.hpp"
+#include "gc/shared/workgroup.hpp"
 #include "logging/log.hpp"
 #include "memory/metaspace.hpp"
 #include "memory/resourceArea.hpp"
 #include "oops/instanceMirrorKlass.hpp"
 #include "oops/oop.inline.hpp"

@@ -178,10 +179,11 @@
 // Memory state functions.
 
 
 CollectedHeap::CollectedHeap() :
   _barrier_set(NULL),
+  _safepoint_workers(NULL),
   _is_gc_active(false),
   _total_collections(0),
   _total_full_collections(0),
   _gc_cause(GCCause::_no_gc),
   _gc_lastcause(GCCause::_no_gc),

@@ -211,10 +213,17 @@
   if (LogEvents) {
     _gc_heap_log = new GCHeapLog();
   } else {
     _gc_heap_log = NULL;
   }
+
+  if (ParallelSafepointCleanupThreads > 1) {
+    _safepoint_workers = new WorkGang("Safepoint Cleanup Thread", ParallelSafepointCleanupThreads,
+                                      /* are_GC_task_threads */ false,
+                                      /* are_ConcurrentGC_threads */ false);
+    _safepoint_workers->initialize_workers();
+  }
 }
 
 // This interface assumes that it's being called by the
 // vm thread. It collects the heap assuming that the
 // heap lock is already held and that we are executing in
< prev index next >