< prev index next >

src/hotspot/share/gc/g1/g1CollectedHeap.cpp

Print this page
rev 47957 : 8191564: Refactor GC related servicability code into GC specific subclasses

@@ -43,10 +43,11 @@
 #include "gc/g1/g1GCPhaseTimes.hpp"
 #include "gc/g1/g1HeapSizingPolicy.hpp"
 #include "gc/g1/g1HeapTransition.hpp"
 #include "gc/g1/g1HeapVerifier.hpp"
 #include "gc/g1/g1HotCardCache.hpp"
+#include "gc/g1/g1MemoryPool.hpp"
 #include "gc/g1/g1OopClosures.inline.hpp"
 #include "gc/g1/g1ParScanThreadState.inline.hpp"
 #include "gc/g1/g1Policy.hpp"
 #include "gc/g1/g1RegionToSpaceMapper.hpp"
 #include "gc/g1/g1RemSet.hpp"

@@ -80,10 +81,11 @@
 #include "prims/resolvedMethodTable.hpp"
 #include "runtime/atomic.hpp"
 #include "runtime/init.hpp"
 #include "runtime/orderAccess.inline.hpp"
 #include "runtime/vmThread.hpp"
+#include "services/memoryManager.hpp"
 #include "utilities/align.hpp"
 #include "utilities/globalDefinitions.hpp"
 #include "utilities/stack.inline.hpp"
 
 size_t G1CollectedHeap::_humongous_object_threshold_in_words = 0;

@@ -2978,11 +2980,11 @@
                                                                   Threads::number_of_non_daemon_threads());
     workers()->update_active_workers(active_workers);
     log_info(gc,task)("Using %u workers of %u for evacuation", active_workers, workers()->total_workers());
 
     TraceCollectorStats tcs(g1mm()->incremental_collection_counters());
-    TraceMemoryManagerStats tms(false /* fullGC */, gc_cause());
+    TraceMemoryManagerStats tms(_minor_mgr, gc_cause());
 
     // If the secondary_free_list is not empty, append it to the
     // free_list. No need to wait for the cleanup operation to finish;
     // the region allocation code will check the secondary_free_list
     // and wait if necessary. If the G1StressConcRegionFreeing flag is

@@ -5392,5 +5394,58 @@
 
 void G1CollectedHeap::rebuild_strong_code_roots() {
   RebuildStrongCodeRootClosure blob_cl(this);
   CodeCache::blobs_do(&blob_cl);
 }
+
+class G1YoungGenMemoryManager : public GCMemoryManager {
+private:
+public:
+  G1YoungGenMemoryManager() : GCMemoryManager() {}
+
+  const char* name() { return "G1 Young Generation"; }
+  virtual const char* gc_end_message() { return "end of minor GC"; }
+};
+
+class G1OldGenMemoryManager : public GCMemoryManager {
+private:
+public:
+  G1OldGenMemoryManager() : GCMemoryManager() {}
+
+  const char* name() { return "G1 Old Generation"; }
+  virtual const char* gc_end_message() { return "end of major GC"; }
+};
+
+GrowableArray<MemoryManager*> G1CollectedHeap::memory_managers() {
+  _minor_mgr = new G1YoungGenMemoryManager();
+  _major_mgr = new G1OldGenMemoryManager();
+  GrowableArray<MemoryManager*> mem_mgrs;
+  mem_mgrs.append(_minor_mgr);
+  mem_mgrs.append(_major_mgr);
+  return mem_mgrs;
+}
+
+GCMemoryManager* G1CollectedHeap::minor_mgr() {
+  return _minor_mgr;
+}
+
+GCMemoryManager* G1CollectedHeap::major_mgr() {
+  return _major_mgr;
+}
+
+GrowableArray<MemoryPool*> G1CollectedHeap::memory_pools() {
+  G1EdenPool* eden = new G1EdenPool(this);
+  G1SurvivorPool* survivor = new G1SurvivorPool(this);
+  G1OldGenPool* old_gen = new G1OldGenPool(this);
+
+  _major_mgr->add_pool(eden);
+  _major_mgr->add_pool(survivor);
+  _major_mgr->add_pool(old_gen);
+  _minor_mgr->add_pool(eden);
+  _minor_mgr->add_pool(survivor);
+
+  GrowableArray<MemoryPool*> mem_pools;
+  mem_pools.append(eden);
+  mem_pools.append(survivor);
+  mem_pools.append(old_gen);
+  return mem_pools;
+}
< prev index next >