36 #include "gc/shenandoah/shenandoahInitLogger.hpp"
37 #include "gc/shenandoah/shenandoahMemoryPool.hpp"
38 #include "gc/shenandoah/shenandoahMonitoringSupport.hpp"
39 #include "gc/shenandoah/shenandoahOldGeneration.hpp"
40 #include "gc/shenandoah/shenandoahPhaseTimings.hpp"
41 #include "gc/shenandoah/shenandoahRegulatorThread.hpp"
42 #include "gc/shenandoah/shenandoahScanRemembered.inline.hpp"
43 #include "gc/shenandoah/shenandoahUtils.hpp"
44 #include "gc/shenandoah/shenandoahWorkerPolicy.hpp"
45 #include "gc/shenandoah/shenandoahYoungGeneration.hpp"
46 #include "logging/log.hpp"
47 #include "utilities/events.hpp"
48
49
50 class ShenandoahGenerationalInitLogger : public ShenandoahInitLogger {
51 public:
52 static void print() {
53 ShenandoahGenerationalInitLogger logger;
54 logger.print_all();
55 }
56
57 void print_heap() override {
58 ShenandoahInitLogger::print_heap();
59
60 ShenandoahGenerationalHeap* heap = ShenandoahGenerationalHeap::heap();
61
62 ShenandoahYoungGeneration* young = heap->young_generation();
63 log_info(gc, init)("Young Generation Soft Size: " EXACTFMT, EXACTFMTARGS(young->soft_max_capacity()));
64 log_info(gc, init)("Young Generation Max: " EXACTFMT, EXACTFMTARGS(young->max_capacity()));
65
66 ShenandoahOldGeneration* old = heap->old_generation();
67 log_info(gc, init)("Old Generation Soft Size: " EXACTFMT, EXACTFMTARGS(old->soft_max_capacity()));
68 log_info(gc, init)("Old Generation Max: " EXACTFMT, EXACTFMTARGS(old->max_capacity()));
69 }
70
71 protected:
72 void print_gc_specific() override {
73 ShenandoahInitLogger::print_gc_specific();
74
75 ShenandoahGenerationalHeap* heap = ShenandoahGenerationalHeap::heap();
76 log_info(gc, init)("Young Heuristics: %s", heap->young_generation()->heuristics()->name());
77 log_info(gc, init)("Old Heuristics: %s", heap->old_generation()->heuristics()->name());
78 }
79 };
80
81 size_t ShenandoahGenerationalHeap::calculate_min_plab() {
82 return align_up(PLAB::min_size(), CardTable::card_size_in_words());
83 }
84
85 size_t ShenandoahGenerationalHeap::calculate_max_plab() {
86 size_t MaxTLABSizeWords = ShenandoahHeapRegion::max_tlab_size_words();
87 return align_down(MaxTLABSizeWords, CardTable::card_size_in_words());
88 }
89
90 // Returns size in bytes
124 ls.cr();
125 ls.cr();
126 evac_tracker()->print_global_on(&ls);
127 }
128 }
129
130 void ShenandoahGenerationalHeap::initialize_heuristics() {
131 // Initialize global generation and heuristics even in generational mode.
132 ShenandoahHeap::initialize_heuristics();
133
134 // Max capacity is the maximum _allowed_ capacity. That is, the maximum allowed capacity
135 // for old would be total heap - minimum capacity of young. This means the sum of the maximum
136 // allowed for old and young could exceed the total heap size. It remains the case that the
137 // _actual_ capacity of young + old = total.
138 _generation_sizer.heap_size_changed(max_capacity());
139 size_t initial_capacity_young = _generation_sizer.max_young_size();
140 size_t max_capacity_young = _generation_sizer.max_young_size();
141 size_t initial_capacity_old = max_capacity() - max_capacity_young;
142 size_t max_capacity_old = max_capacity() - initial_capacity_young;
143
144 _young_generation = new ShenandoahYoungGeneration(max_workers(), max_capacity_young, initial_capacity_young);
145 _old_generation = new ShenandoahOldGeneration(max_workers(), max_capacity_old, initial_capacity_old);
146 _young_generation->initialize_heuristics(mode());
147 _old_generation->initialize_heuristics(mode());
148 }
149
150 void ShenandoahGenerationalHeap::initialize_serviceability() {
151 assert(mode()->is_generational(), "Only for the generational mode");
152 _young_gen_memory_pool = new ShenandoahYoungGenMemoryPool(this);
153 _old_gen_memory_pool = new ShenandoahOldGenMemoryPool(this);
154 cycle_memory_manager()->add_pool(_young_gen_memory_pool);
155 cycle_memory_manager()->add_pool(_old_gen_memory_pool);
156 stw_memory_manager()->add_pool(_young_gen_memory_pool);
157 stw_memory_manager()->add_pool(_old_gen_memory_pool);
158 }
159
160 GrowableArray<MemoryPool*> ShenandoahGenerationalHeap::memory_pools() {
161 assert(mode()->is_generational(), "Only for the generational mode");
162 GrowableArray<MemoryPool*> memory_pools(2);
163 memory_pools.append(_young_gen_memory_pool);
164 memory_pools.append(_old_gen_memory_pool);
165 return memory_pools;
|
36 #include "gc/shenandoah/shenandoahInitLogger.hpp"
37 #include "gc/shenandoah/shenandoahMemoryPool.hpp"
38 #include "gc/shenandoah/shenandoahMonitoringSupport.hpp"
39 #include "gc/shenandoah/shenandoahOldGeneration.hpp"
40 #include "gc/shenandoah/shenandoahPhaseTimings.hpp"
41 #include "gc/shenandoah/shenandoahRegulatorThread.hpp"
42 #include "gc/shenandoah/shenandoahScanRemembered.inline.hpp"
43 #include "gc/shenandoah/shenandoahUtils.hpp"
44 #include "gc/shenandoah/shenandoahWorkerPolicy.hpp"
45 #include "gc/shenandoah/shenandoahYoungGeneration.hpp"
46 #include "logging/log.hpp"
47 #include "utilities/events.hpp"
48
49
50 class ShenandoahGenerationalInitLogger : public ShenandoahInitLogger {
51 public:
52 static void print() {
53 ShenandoahGenerationalInitLogger logger;
54 logger.print_all();
55 }
56 protected:
57 void print_gc_specific() override {
58 ShenandoahInitLogger::print_gc_specific();
59
60 ShenandoahGenerationalHeap* heap = ShenandoahGenerationalHeap::heap();
61 log_info(gc, init)("Young Heuristics: %s", heap->young_generation()->heuristics()->name());
62 log_info(gc, init)("Old Heuristics: %s", heap->old_generation()->heuristics()->name());
63 }
64 };
65
66 size_t ShenandoahGenerationalHeap::calculate_min_plab() {
67 return align_up(PLAB::min_size(), CardTable::card_size_in_words());
68 }
69
70 size_t ShenandoahGenerationalHeap::calculate_max_plab() {
71 size_t MaxTLABSizeWords = ShenandoahHeapRegion::max_tlab_size_words();
72 return align_down(MaxTLABSizeWords, CardTable::card_size_in_words());
73 }
74
75 // Returns size in bytes
109 ls.cr();
110 ls.cr();
111 evac_tracker()->print_global_on(&ls);
112 }
113 }
114
115 void ShenandoahGenerationalHeap::initialize_heuristics() {
116 // Initialize global generation and heuristics even in generational mode.
117 ShenandoahHeap::initialize_heuristics();
118
119 // Max capacity is the maximum _allowed_ capacity. That is, the maximum allowed capacity
120 // for old would be total heap - minimum capacity of young. This means the sum of the maximum
121 // allowed for old and young could exceed the total heap size. It remains the case that the
122 // _actual_ capacity of young + old = total.
123 _generation_sizer.heap_size_changed(max_capacity());
124 size_t initial_capacity_young = _generation_sizer.max_young_size();
125 size_t max_capacity_young = _generation_sizer.max_young_size();
126 size_t initial_capacity_old = max_capacity() - max_capacity_young;
127 size_t max_capacity_old = max_capacity() - initial_capacity_young;
128
129 _young_generation = new ShenandoahYoungGeneration(max_workers(), max_capacity_young);
130 _old_generation = new ShenandoahOldGeneration(max_workers(), max_capacity_old);
131 _young_generation->initialize_heuristics(mode());
132 _old_generation->initialize_heuristics(mode());
133 }
134
135 void ShenandoahGenerationalHeap::initialize_serviceability() {
136 assert(mode()->is_generational(), "Only for the generational mode");
137 _young_gen_memory_pool = new ShenandoahYoungGenMemoryPool(this);
138 _old_gen_memory_pool = new ShenandoahOldGenMemoryPool(this);
139 cycle_memory_manager()->add_pool(_young_gen_memory_pool);
140 cycle_memory_manager()->add_pool(_old_gen_memory_pool);
141 stw_memory_manager()->add_pool(_young_gen_memory_pool);
142 stw_memory_manager()->add_pool(_old_gen_memory_pool);
143 }
144
145 GrowableArray<MemoryPool*> ShenandoahGenerationalHeap::memory_pools() {
146 assert(mode()->is_generational(), "Only for the generational mode");
147 GrowableArray<MemoryPool*> memory_pools(2);
148 memory_pools.append(_young_gen_memory_pool);
149 memory_pools.append(_old_gen_memory_pool);
150 return memory_pools;
|