src/hotspot/share/gc/serial/serialHeap.cpp
changeset 50033 000c697c81db
parent 49050 170c7b36aea6
child 50034 01a88f825a84
--- a/src/hotspot/share/gc/serial/serialHeap.cpp	Mon May 07 14:42:04 2018 +0200
+++ b/src/hotspot/share/gc/serial/serialHeap.cpp	Mon May 07 14:42:05 2018 +0200
@@ -25,9 +25,17 @@
 #include "precompiled.hpp"
 #include "gc/serial/defNewGeneration.hpp"
 #include "gc/serial/serialHeap.hpp"
+#include "gc/serial/tenuredGeneration.hpp"
 #include "gc/shared/genMemoryPools.hpp"
 #include "services/memoryManager.hpp"
 
+SerialHeap* SerialHeap::heap() {
+  CollectedHeap* heap = Universe::heap();
+  assert(heap != NULL, "Uninitialized access to SerialHeap::heap()");
+  assert(heap->kind() == CollectedHeap::Serial, "Invalid name");
+  return static_cast<SerialHeap*>(heap);
+}
+
 SerialHeap::SerialHeap(GenCollectorPolicy* policy) :
     GenCollectedHeap(policy,
                      Generation::DefNew,
@@ -42,7 +50,7 @@
 
 void SerialHeap::initialize_serviceability() {
 
-  DefNewGeneration* young = (DefNewGeneration*) young_gen();
+  DefNewGeneration* young = young_gen();
 
   // Add a memory pool for each space and young gen doesn't
   // support low memory detection as it is expected to get filled up.
@@ -54,7 +62,7 @@
                                                    "Survivor Space",
                                                    young->max_survivor_size(),
                                                    false /* support_usage_threshold */);
-  Generation* old = old_gen();
+  TenuredGeneration* old = old_gen();
   _old_pool = new GenerationPool(old, "Tenured Gen", true);
 
   _young_manager->add_pool(_eden_pool);
@@ -68,13 +76,6 @@
 
 }
 
-void SerialHeap::check_gen_kinds() {
-  assert(young_gen()->kind() == Generation::DefNew,
-         "Wrong youngest generation type");
-  assert(old_gen()->kind() == Generation::MarkSweepCompact,
-         "Wrong generation kind");
-}
-
 GrowableArray<GCMemoryManager*> SerialHeap::memory_managers() {
   GrowableArray<GCMemoryManager*> memory_managers(2);
   memory_managers.append(_young_manager);