Mercurial > hg > graal-compiler
comparison src/share/vm/services/memoryService.cpp @ 8002:8391fdd36e1f
Merge
author | dlong |
---|---|
date | Sun, 27 Jan 2013 01:07:09 -0800 |
parents | db9981fd3124 |
children | 8b4ce9870fd6 dbd5837b342f |
comparison
equal
deleted
inserted
replaced
7946:6fbe8a57549d | 8002:8391fdd36e1f |
---|---|
41 #include "services/management.hpp" | 41 #include "services/management.hpp" |
42 #include "services/memoryManager.hpp" | 42 #include "services/memoryManager.hpp" |
43 #include "services/memoryPool.hpp" | 43 #include "services/memoryPool.hpp" |
44 #include "services/memoryService.hpp" | 44 #include "services/memoryService.hpp" |
45 #include "utilities/growableArray.hpp" | 45 #include "utilities/growableArray.hpp" |
46 #ifndef SERIALGC | 46 #include "utilities/macros.hpp" |
47 #if INCLUDE_ALL_GCS | |
47 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp" | 48 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp" |
48 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" | 49 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" |
49 #include "gc_implementation/parNew/parNewGeneration.hpp" | 50 #include "gc_implementation/parNew/parNewGeneration.hpp" |
50 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp" | 51 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp" |
51 #include "gc_implementation/parallelScavenge/psOldGen.hpp" | 52 #include "gc_implementation/parallelScavenge/psOldGen.hpp" |
52 #include "gc_implementation/parallelScavenge/psYoungGen.hpp" | 53 #include "gc_implementation/parallelScavenge/psYoungGen.hpp" |
53 #include "services/g1MemoryPool.hpp" | 54 #include "services/g1MemoryPool.hpp" |
54 #include "services/psMemoryPool.hpp" | 55 #include "services/psMemoryPool.hpp" |
55 #endif | 56 #endif // INCLUDE_ALL_GCS |
56 | 57 |
57 GrowableArray<MemoryPool*>* MemoryService::_pools_list = | 58 GrowableArray<MemoryPool*>* MemoryService::_pools_list = |
58 new (ResourceObj::C_HEAP, mtInternal) GrowableArray<MemoryPool*>(init_pools_list_size, true); | 59 new (ResourceObj::C_HEAP, mtInternal) GrowableArray<MemoryPool*>(init_pools_list_size, true); |
59 GrowableArray<MemoryManager*>* MemoryService::_managers_list = | 60 GrowableArray<MemoryManager*>* MemoryService::_managers_list = |
60 new (ResourceObj::C_HEAP, mtInternal) GrowableArray<MemoryManager*>(init_managers_list_size, true); | 61 new (ResourceObj::C_HEAP, mtInternal) GrowableArray<MemoryManager*>(init_managers_list_size, true); |
81 switch (kind) { | 82 switch (kind) { |
82 case CollectedHeap::GenCollectedHeap : { | 83 case CollectedHeap::GenCollectedHeap : { |
83 add_gen_collected_heap_info(GenCollectedHeap::heap()); | 84 add_gen_collected_heap_info(GenCollectedHeap::heap()); |
84 break; | 85 break; |
85 } | 86 } |
86 #ifndef SERIALGC | 87 #if INCLUDE_ALL_GCS |
87 case CollectedHeap::ParallelScavengeHeap : { | 88 case CollectedHeap::ParallelScavengeHeap : { |
88 add_parallel_scavenge_heap_info(ParallelScavengeHeap::heap()); | 89 add_parallel_scavenge_heap_info(ParallelScavengeHeap::heap()); |
89 break; | 90 break; |
90 } | 91 } |
91 case CollectedHeap::G1CollectedHeap : { | 92 case CollectedHeap::G1CollectedHeap : { |
92 add_g1_heap_info(G1CollectedHeap::heap()); | 93 add_g1_heap_info(G1CollectedHeap::heap()); |
93 break; | 94 break; |
94 } | 95 } |
95 #endif // SERIALGC | 96 #endif // INCLUDE_ALL_GCS |
96 default: { | 97 default: { |
97 guarantee(false, "Unrecognized kind of heap"); | 98 guarantee(false, "Unrecognized kind of heap"); |
98 } | 99 } |
99 } | 100 } |
100 | 101 |
128 Generation::Name kind = specs[0]->name(); | 129 Generation::Name kind = specs[0]->name(); |
129 switch (kind) { | 130 switch (kind) { |
130 case Generation::DefNew: | 131 case Generation::DefNew: |
131 _minor_gc_manager = MemoryManager::get_copy_memory_manager(); | 132 _minor_gc_manager = MemoryManager::get_copy_memory_manager(); |
132 break; | 133 break; |
133 #ifndef SERIALGC | 134 #if INCLUDE_ALL_GCS |
134 case Generation::ParNew: | 135 case Generation::ParNew: |
135 case Generation::ASParNew: | 136 case Generation::ASParNew: |
136 _minor_gc_manager = MemoryManager::get_parnew_memory_manager(); | 137 _minor_gc_manager = MemoryManager::get_parnew_memory_manager(); |
137 break; | 138 break; |
138 #endif // SERIALGC | 139 #endif // INCLUDE_ALL_GCS |
139 default: | 140 default: |
140 guarantee(false, "Unrecognized generation spec"); | 141 guarantee(false, "Unrecognized generation spec"); |
141 break; | 142 break; |
142 } | 143 } |
143 if (policy->is_mark_sweep_policy()) { | 144 if (policy->is_mark_sweep_policy()) { |
144 _major_gc_manager = MemoryManager::get_msc_memory_manager(); | 145 _major_gc_manager = MemoryManager::get_msc_memory_manager(); |
145 #ifndef SERIALGC | 146 #if INCLUDE_ALL_GCS |
146 } else if (policy->is_concurrent_mark_sweep_policy()) { | 147 } else if (policy->is_concurrent_mark_sweep_policy()) { |
147 _major_gc_manager = MemoryManager::get_cms_memory_manager(); | 148 _major_gc_manager = MemoryManager::get_cms_memory_manager(); |
148 #endif // SERIALGC | 149 #endif // INCLUDE_ALL_GCS |
149 } else { | 150 } else { |
150 guarantee(false, "Unknown two-gen policy"); | 151 guarantee(false, "Unknown two-gen policy"); |
151 } | 152 } |
152 } else { | 153 } else { |
153 guarantee(false, "Non two-gen policy"); | 154 guarantee(false, "Non two-gen policy"); |
157 | 158 |
158 add_generation_memory_pool(heap->get_gen(minor), _major_gc_manager, _minor_gc_manager); | 159 add_generation_memory_pool(heap->get_gen(minor), _major_gc_manager, _minor_gc_manager); |
159 add_generation_memory_pool(heap->get_gen(major), _major_gc_manager); | 160 add_generation_memory_pool(heap->get_gen(major), _major_gc_manager); |
160 } | 161 } |
161 | 162 |
162 #ifndef SERIALGC | 163 #if INCLUDE_ALL_GCS |
163 // Add memory pools for ParallelScavengeHeap | 164 // Add memory pools for ParallelScavengeHeap |
164 // This function currently only supports two generations collected heap. | 165 // This function currently only supports two generations collected heap. |
165 // The collector for ParallelScavengeHeap will have two memory managers. | 166 // The collector for ParallelScavengeHeap will have two memory managers. |
166 void MemoryService::add_parallel_scavenge_heap_info(ParallelScavengeHeap* heap) { | 167 void MemoryService::add_parallel_scavenge_heap_info(ParallelScavengeHeap* heap) { |
167 // Two managers to keep statistics about _minor_gc_manager and _major_gc_manager GC. | 168 // Two managers to keep statistics about _minor_gc_manager and _major_gc_manager GC. |
183 _managers_list->append(_major_gc_manager); | 184 _managers_list->append(_major_gc_manager); |
184 | 185 |
185 add_g1YoungGen_memory_pool(g1h, _major_gc_manager, _minor_gc_manager); | 186 add_g1YoungGen_memory_pool(g1h, _major_gc_manager, _minor_gc_manager); |
186 add_g1OldGen_memory_pool(g1h, _major_gc_manager); | 187 add_g1OldGen_memory_pool(g1h, _major_gc_manager); |
187 } | 188 } |
188 #endif // SERIALGC | 189 #endif // INCLUDE_ALL_GCS |
189 | 190 |
190 MemoryPool* MemoryService::add_gen(Generation* gen, | 191 MemoryPool* MemoryService::add_gen(Generation* gen, |
191 const char* name, | 192 const char* name, |
192 bool is_heap, | 193 bool is_heap, |
193 bool support_usage_threshold) { | 194 bool support_usage_threshold) { |
220 | 221 |
221 _pools_list->append(pool); | 222 _pools_list->append(pool); |
222 return (MemoryPool*) pool; | 223 return (MemoryPool*) pool; |
223 } | 224 } |
224 | 225 |
225 #ifndef SERIALGC | 226 #if INCLUDE_ALL_GCS |
226 MemoryPool* MemoryService::add_cms_space(CompactibleFreeListSpace* space, | 227 MemoryPool* MemoryService::add_cms_space(CompactibleFreeListSpace* space, |
227 const char* name, | 228 const char* name, |
228 bool is_heap, | 229 bool is_heap, |
229 size_t max_size, | 230 size_t max_size, |
230 bool support_usage_threshold) { | 231 bool support_usage_threshold) { |
231 MemoryPool::PoolType type = (is_heap ? MemoryPool::Heap : MemoryPool::NonHeap); | 232 MemoryPool::PoolType type = (is_heap ? MemoryPool::Heap : MemoryPool::NonHeap); |
232 CompactibleFreeListSpacePool* pool = new CompactibleFreeListSpacePool(space, name, type, max_size, support_usage_threshold); | 233 CompactibleFreeListSpacePool* pool = new CompactibleFreeListSpacePool(space, name, type, max_size, support_usage_threshold); |
233 _pools_list->append(pool); | 234 _pools_list->append(pool); |
234 return (MemoryPool*) pool; | 235 return (MemoryPool*) pool; |
235 } | 236 } |
236 #endif // SERIALGC | 237 #endif // INCLUDE_ALL_GCS |
237 | 238 |
238 // Add memory pool(s) for one generation | 239 // Add memory pool(s) for one generation |
239 void MemoryService::add_generation_memory_pool(Generation* gen, | 240 void MemoryService::add_generation_memory_pool(Generation* gen, |
240 MemoryManager* major_mgr, | 241 MemoryManager* major_mgr, |
241 MemoryManager* minor_mgr) { | 242 MemoryManager* minor_mgr) { |
259 young_gen->max_survivor_size(), | 260 young_gen->max_survivor_size(), |
260 false /* support_usage_threshold */); | 261 false /* support_usage_threshold */); |
261 break; | 262 break; |
262 } | 263 } |
263 | 264 |
264 #ifndef SERIALGC | 265 #if INCLUDE_ALL_GCS |
265 case Generation::ParNew: | 266 case Generation::ParNew: |
266 case Generation::ASParNew: | 267 case Generation::ASParNew: |
267 { | 268 { |
268 assert(major_mgr != NULL && minor_mgr != NULL, "Should have two managers"); | 269 assert(major_mgr != NULL && minor_mgr != NULL, "Should have two managers"); |
269 // Add a memory pool for each space and young gen doesn't | 270 // Add a memory pool for each space and young gen doesn't |
280 parnew_gen->max_survivor_size(), | 281 parnew_gen->max_survivor_size(), |
281 false /* support_usage_threshold */); | 282 false /* support_usage_threshold */); |
282 | 283 |
283 break; | 284 break; |
284 } | 285 } |
285 #endif // SERIALGC | 286 #endif // INCLUDE_ALL_GCS |
286 | 287 |
287 case Generation::MarkSweepCompact: { | 288 case Generation::MarkSweepCompact: { |
288 assert(major_mgr != NULL && minor_mgr == NULL, "Should have only one manager"); | 289 assert(major_mgr != NULL && minor_mgr == NULL, "Should have only one manager"); |
289 add_gen(gen, | 290 add_gen(gen, |
290 "Tenured Gen", | 291 "Tenured Gen", |
291 true, /* is_heap */ | 292 true, /* is_heap */ |
292 true /* support_usage_threshold */); | 293 true /* support_usage_threshold */); |
293 break; | 294 break; |
294 } | 295 } |
295 | 296 |
296 #ifndef SERIALGC | 297 #if INCLUDE_ALL_GCS |
297 case Generation::ConcurrentMarkSweep: | 298 case Generation::ConcurrentMarkSweep: |
298 case Generation::ASConcurrentMarkSweep: | 299 case Generation::ASConcurrentMarkSweep: |
299 { | 300 { |
300 assert(major_mgr != NULL && minor_mgr == NULL, "Should have only one manager"); | 301 assert(major_mgr != NULL && minor_mgr == NULL, "Should have only one manager"); |
301 ConcurrentMarkSweepGeneration* cms = (ConcurrentMarkSweepGeneration*) gen; | 302 ConcurrentMarkSweepGeneration* cms = (ConcurrentMarkSweepGeneration*) gen; |
304 true, /* is_heap */ | 305 true, /* is_heap */ |
305 cms->reserved().byte_size(), | 306 cms->reserved().byte_size(), |
306 true /* support_usage_threshold */); | 307 true /* support_usage_threshold */); |
307 break; | 308 break; |
308 } | 309 } |
309 #endif // SERIALGC | 310 #endif // INCLUDE_ALL_GCS |
310 | 311 |
311 default: | 312 default: |
312 assert(false, "should not reach here"); | 313 assert(false, "should not reach here"); |
313 // no memory pool added for others | 314 // no memory pool added for others |
314 break; | 315 break; |
324 } | 325 } |
325 } | 326 } |
326 } | 327 } |
327 | 328 |
328 | 329 |
329 #ifndef SERIALGC | 330 #if INCLUDE_ALL_GCS |
330 void MemoryService::add_psYoung_memory_pool(PSYoungGen* gen, MemoryManager* major_mgr, MemoryManager* minor_mgr) { | 331 void MemoryService::add_psYoung_memory_pool(PSYoungGen* gen, MemoryManager* major_mgr, MemoryManager* minor_mgr) { |
331 assert(major_mgr != NULL && minor_mgr != NULL, "Should have two managers"); | 332 assert(major_mgr != NULL && minor_mgr != NULL, "Should have two managers"); |
332 | 333 |
333 // Add a memory pool for each space and young gen doesn't | 334 // Add a memory pool for each space and young gen doesn't |
334 // support low memory detection as it is expected to get filled up. | 335 // support low memory detection as it is expected to get filled up. |
382 | 383 |
383 G1OldGenPool* old_gen = new G1OldGenPool(g1h); | 384 G1OldGenPool* old_gen = new G1OldGenPool(g1h); |
384 mgr->add_pool(old_gen); | 385 mgr->add_pool(old_gen); |
385 _pools_list->append(old_gen); | 386 _pools_list->append(old_gen); |
386 } | 387 } |
387 #endif // SERIALGC | 388 #endif // INCLUDE_ALL_GCS |
388 | 389 |
389 void MemoryService::add_code_heap_memory_pool(CodeHeap* heap) { | 390 void MemoryService::add_code_heap_memory_pool(CodeHeap* heap) { |
390 _code_heap_pool = new CodeHeapPool(heap, | 391 _code_heap_pool = new CodeHeapPool(heap, |
391 "Code Cache", | 392 "Code Cache", |
392 true /* support_usage_threshold */); | 393 true /* support_usage_threshold */); |
532 // doing mark-sweep-compact uses major gc manager (so _fullGC is set | 533 // doing mark-sweep-compact uses major gc manager (so _fullGC is set |
533 // to true). | 534 // to true). |
534 TraceMemoryManagerStats::TraceMemoryManagerStats(Generation::Name kind, GCCause::Cause cause) { | 535 TraceMemoryManagerStats::TraceMemoryManagerStats(Generation::Name kind, GCCause::Cause cause) { |
535 switch (kind) { | 536 switch (kind) { |
536 case Generation::DefNew: | 537 case Generation::DefNew: |
537 #ifndef SERIALGC | 538 #if INCLUDE_ALL_GCS |
538 case Generation::ParNew: | 539 case Generation::ParNew: |
539 case Generation::ASParNew: | 540 case Generation::ASParNew: |
540 #endif // SERIALGC | 541 #endif // INCLUDE_ALL_GCS |
541 _fullGC=false; | 542 _fullGC=false; |
542 break; | 543 break; |
543 case Generation::MarkSweepCompact: | 544 case Generation::MarkSweepCompact: |
544 #ifndef SERIALGC | 545 #if INCLUDE_ALL_GCS |
545 case Generation::ConcurrentMarkSweep: | 546 case Generation::ConcurrentMarkSweep: |
546 case Generation::ASConcurrentMarkSweep: | 547 case Generation::ASConcurrentMarkSweep: |
547 #endif // SERIALGC | 548 #endif // INCLUDE_ALL_GCS |
548 _fullGC=true; | 549 _fullGC=true; |
549 break; | 550 break; |
550 default: | 551 default: |
551 assert(false, "Unrecognized gc generation kind."); | 552 assert(false, "Unrecognized gc generation kind."); |
552 } | 553 } |