src/hotspot/share/gc/serial/serialHeap.cpp
changeset 50033 000c697c81db
parent 49050 170c7b36aea6
child 50034 01a88f825a84
equal deleted inserted replaced
50032:6be313c6c250 50033:000c697c81db
    23  */
    23  */
    24 
    24 
    25 #include "precompiled.hpp"
    25 #include "precompiled.hpp"
    26 #include "gc/serial/defNewGeneration.hpp"
    26 #include "gc/serial/defNewGeneration.hpp"
    27 #include "gc/serial/serialHeap.hpp"
    27 #include "gc/serial/serialHeap.hpp"
       
    28 #include "gc/serial/tenuredGeneration.hpp"
    28 #include "gc/shared/genMemoryPools.hpp"
    29 #include "gc/shared/genMemoryPools.hpp"
    29 #include "services/memoryManager.hpp"
    30 #include "services/memoryManager.hpp"
       
    31 
       
    32 SerialHeap* SerialHeap::heap() {
       
    33   CollectedHeap* heap = Universe::heap();
       
    34   assert(heap != NULL, "Uninitialized access to SerialHeap::heap()");
       
    35   assert(heap->kind() == CollectedHeap::Serial, "Invalid name");
       
    36   return static_cast<SerialHeap*>(heap);
       
    37 }
    30 
    38 
    31 SerialHeap::SerialHeap(GenCollectorPolicy* policy) :
    39 SerialHeap::SerialHeap(GenCollectorPolicy* policy) :
    32     GenCollectedHeap(policy,
    40     GenCollectedHeap(policy,
    33                      Generation::DefNew,
    41                      Generation::DefNew,
    34                      Generation::MarkSweepCompact,
    42                      Generation::MarkSweepCompact,
    40   _old_manager = new GCMemoryManager("MarkSweepCompact", "end of major GC");
    48   _old_manager = new GCMemoryManager("MarkSweepCompact", "end of major GC");
    41 }
    49 }
    42 
    50 
    43 void SerialHeap::initialize_serviceability() {
    51 void SerialHeap::initialize_serviceability() {
    44 
    52 
    45   DefNewGeneration* young = (DefNewGeneration*) young_gen();
    53   DefNewGeneration* young = young_gen();
    46 
    54 
    47   // Add a memory pool for each space and young gen doesn't
    55   // Add a memory pool for each space and young gen doesn't
    48   // support low memory detection as it is expected to get filled up.
    56   // support low memory detection as it is expected to get filled up.
    49   _eden_pool = new ContiguousSpacePool(young->eden(),
    57   _eden_pool = new ContiguousSpacePool(young->eden(),
    50                                        "Eden Space",
    58                                        "Eden Space",
    52                                        false /* support_usage_threshold */);
    60                                        false /* support_usage_threshold */);
    53   _survivor_pool = new SurvivorContiguousSpacePool(young,
    61   _survivor_pool = new SurvivorContiguousSpacePool(young,
    54                                                    "Survivor Space",
    62                                                    "Survivor Space",
    55                                                    young->max_survivor_size(),
    63                                                    young->max_survivor_size(),
    56                                                    false /* support_usage_threshold */);
    64                                                    false /* support_usage_threshold */);
    57   Generation* old = old_gen();
    65   TenuredGeneration* old = old_gen();
    58   _old_pool = new GenerationPool(old, "Tenured Gen", true);
    66   _old_pool = new GenerationPool(old, "Tenured Gen", true);
    59 
    67 
    60   _young_manager->add_pool(_eden_pool);
    68   _young_manager->add_pool(_eden_pool);
    61   _young_manager->add_pool(_survivor_pool);
    69   _young_manager->add_pool(_survivor_pool);
    62   young->set_gc_manager(_young_manager);
    70   young->set_gc_manager(_young_manager);
    64   _old_manager->add_pool(_eden_pool);
    72   _old_manager->add_pool(_eden_pool);
    65   _old_manager->add_pool(_survivor_pool);
    73   _old_manager->add_pool(_survivor_pool);
    66   _old_manager->add_pool(_old_pool);
    74   _old_manager->add_pool(_old_pool);
    67   old->set_gc_manager(_old_manager);
    75   old->set_gc_manager(_old_manager);
    68 
    76 
    69 }
       
    70 
       
    71 void SerialHeap::check_gen_kinds() {
       
    72   assert(young_gen()->kind() == Generation::DefNew,
       
    73          "Wrong youngest generation type");
       
    74   assert(old_gen()->kind() == Generation::MarkSweepCompact,
       
    75          "Wrong generation kind");
       
    76 }
    77 }
    77 
    78 
    78 GrowableArray<GCMemoryManager*> SerialHeap::memory_managers() {
    79 GrowableArray<GCMemoryManager*> SerialHeap::memory_managers() {
    79   GrowableArray<GCMemoryManager*> memory_managers(2);
    80   GrowableArray<GCMemoryManager*> memory_managers(2);
    80   memory_managers.append(_young_manager);
    81   memory_managers.append(_young_manager);