< prev index next >

src/share/vm/services/memoryService.cpp

Print this page

        

@@ -44,18 +44,20 @@
 #include "services/memoryPool.hpp"
 #include "services/memoryService.hpp"
 #include "utilities/growableArray.hpp"
 #include "utilities/macros.hpp"
 #if INCLUDE_ALL_GCS
+#include "gc_implementation/shenandoah/shenandoahHeap.inline.hpp"
 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp"
 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
 #include "gc_implementation/parNew/parNewGeneration.hpp"
 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
 #include "gc_implementation/parallelScavenge/psOldGen.hpp"
 #include "gc_implementation/parallelScavenge/psYoungGen.hpp"
 #include "services/g1MemoryPool.hpp"
 #include "services/psMemoryPool.hpp"
+#include "services/shenandoahMemoryPool.hpp"
 #endif // INCLUDE_ALL_GCS
 
 GrowableArray<MemoryPool*>* MemoryService::_pools_list =
   new (ResourceObj::C_HEAP, mtInternal) GrowableArray<MemoryPool*>(init_pools_list_size, true);
 GrowableArray<MemoryManager*>* MemoryService::_managers_list =

@@ -94,10 +96,14 @@
     }
     case CollectedHeap::G1CollectedHeap : {
       add_g1_heap_info(G1CollectedHeap::heap());
       break;
     }
+  case CollectedHeap::ShenandoahHeap : {
+    add_shenandoah_heap_info(ShenandoahHeap::heap());
+    break;
+  }
 #endif // INCLUDE_ALL_GCS
     default: {
       guarantee(false, "Unrecognized kind of heap");
     }
   }

@@ -187,10 +193,28 @@
   _managers_list->append(_major_gc_manager);
 
   add_g1YoungGen_memory_pool(g1h, _major_gc_manager, _minor_gc_manager);
   add_g1OldGen_memory_pool(g1h, _major_gc_manager, _minor_gc_manager);
 }
+
+void MemoryService::add_shenandoah_heap_info(ShenandoahHeap* heap) {
+  assert(UseShenandoahGC, "sanity");
+
+  // We reuse the "minor/major" names, even though they make little sense
+  // in Shenandoah. JDK 10+ makes this right, but not JDK 9-.
+  _major_gc_manager = MemoryManager::get_shenandoah_pauses_memory_manager();
+  _minor_gc_manager = MemoryManager::get_shenandoah_cycles_memory_manager();
+  _managers_list->append(_major_gc_manager);
+  _managers_list->append(_minor_gc_manager);
+
+  ShenandoahMemoryPool* pool = new ShenandoahMemoryPool(heap);
+  _pools_list->append(pool);
+
+  _major_gc_manager->add_pool(pool);
+  _minor_gc_manager->add_pool(pool);
+}
+
 #endif // INCLUDE_ALL_GCS
 
 MemoryPool* MemoryService::add_gen(Generation* gen,
                                    const char* name,
                                    bool is_heap,
< prev index next >