21 * questions. |
21 * questions. |
22 * |
22 * |
23 */ |
23 */ |
24 |
24 |
25 #include "precompiled.hpp" |
25 #include "precompiled.hpp" |
|
26 #include "gc/serial/defNewGeneration.hpp" |
26 #include "gc/serial/serialHeap.hpp" |
27 #include "gc/serial/serialHeap.hpp" |
|
28 #include "gc/shared/genMemoryPools.hpp" |
|
29 #include "services/memoryManager.hpp" |
27 |
30 |
28 SerialHeap::SerialHeap(GenCollectorPolicy* policy) : GenCollectedHeap(policy) {} |
31 SerialHeap::SerialHeap(GenCollectorPolicy* policy) : |
|
32 GenCollectedHeap(policy), _eden_pool(NULL), _survivor_pool(NULL), _old_pool(NULL) { |
|
33 _young_manager = new GCMemoryManager("Copy", "end of minor GC"); |
|
34 _old_manager = new GCMemoryManager("MarkSweepCompact", "end of major GC"); |
|
35 } |
|
36 |
|
37 void SerialHeap::initialize_serviceability() { |
|
38 |
|
39 DefNewGeneration* young = (DefNewGeneration*) young_gen(); |
|
40 |
|
41 // Add a memory pool for each space and young gen doesn't |
|
42 // support low memory detection as it is expected to get filled up. |
|
43 _eden_pool = new ContiguousSpacePool(young->eden(), |
|
44 "Eden Space", |
|
45 young->max_eden_size(), |
|
46 false /* support_usage_threshold */); |
|
47 _survivor_pool = new SurvivorContiguousSpacePool(young, |
|
48 "Survivor Space", |
|
49 young->max_survivor_size(), |
|
50 false /* support_usage_threshold */); |
|
51 Generation* old = old_gen(); |
|
52 _old_pool = new GenerationPool(old, "Tenured Gen", true); |
|
53 |
|
54 _young_manager->add_pool(_eden_pool); |
|
55 _young_manager->add_pool(_survivor_pool); |
|
56 young->set_gc_manager(_young_manager); |
|
57 |
|
58 _old_manager->add_pool(_eden_pool); |
|
59 _old_manager->add_pool(_survivor_pool); |
|
60 _old_manager->add_pool(_old_pool); |
|
61 old->set_gc_manager(_old_manager); |
|
62 |
|
63 } |
29 |
64 |
30 void SerialHeap::check_gen_kinds() { |
65 void SerialHeap::check_gen_kinds() { |
31 assert(young_gen()->kind() == Generation::DefNew, |
66 assert(young_gen()->kind() == Generation::DefNew, |
32 "Wrong youngest generation type"); |
67 "Wrong youngest generation type"); |
33 assert(old_gen()->kind() == Generation::MarkSweepCompact, |
68 assert(old_gen()->kind() == Generation::MarkSweepCompact, |
34 "Wrong generation kind"); |
69 "Wrong generation kind"); |
35 } |
70 } |
|
71 |
|
72 GrowableArray<GCMemoryManager*> SerialHeap::memory_managers() { |
|
73 GrowableArray<GCMemoryManager*> memory_managers(2); |
|
74 memory_managers.append(_young_manager); |
|
75 memory_managers.append(_old_manager); |
|
76 return memory_managers; |
|
77 } |
|
78 |
|
79 GrowableArray<MemoryPool*> SerialHeap::memory_pools() { |
|
80 GrowableArray<MemoryPool*> memory_pools(3); |
|
81 memory_pools.append(_eden_pool); |
|
82 memory_pools.append(_survivor_pool); |
|
83 memory_pools.append(_old_pool); |
|
84 return memory_pools; |
|
85 } |