comparison src/share/vm/memory/tenuredGeneration.cpp @ 8001:db9981fd3124

8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS Summary: Rename INCLUDE_ALTERNATE_GCS to INCLUDE_ALL_GCS and replace SERIALGC with INCLUDE_ALL_GCS. Reviewed-by: coleenp, stefank
author jprovino
date Wed, 23 Jan 2013 13:02:39 -0500
parents ca0a78017dc7
children 8617e38bb4cb
comparison
equal deleted inserted replaced
7619:46e60405583b 8001:db9981fd3124
31 #include "memory/generationSpec.hpp" 31 #include "memory/generationSpec.hpp"
32 #include "memory/space.hpp" 32 #include "memory/space.hpp"
33 #include "memory/tenuredGeneration.hpp" 33 #include "memory/tenuredGeneration.hpp"
34 #include "oops/oop.inline.hpp" 34 #include "oops/oop.inline.hpp"
35 #include "runtime/java.hpp" 35 #include "runtime/java.hpp"
36 #include "utilities/macros.hpp"
36 37
37 TenuredGeneration::TenuredGeneration(ReservedSpace rs, 38 TenuredGeneration::TenuredGeneration(ReservedSpace rs,
38 size_t initial_byte_size, int level, 39 size_t initial_byte_size, int level,
39 GenRemSet* remset) : 40 GenRemSet* remset) :
40 OneContigSpaceCardGeneration(rs, initial_byte_size, 41 OneContigSpaceCardGeneration(rs, initial_byte_size,
59 _gc_counters = new CollectorCounters("MSC", 1); 60 _gc_counters = new CollectorCounters("MSC", 1);
60 61
61 _space_counters = new CSpaceCounters(gen_name, 0, 62 _space_counters = new CSpaceCounters(gen_name, 0,
62 _virtual_space.reserved_size(), 63 _virtual_space.reserved_size(),
63 _the_space, _gen_counters); 64 _the_space, _gen_counters);
64 #ifndef SERIALGC 65 #if INCLUDE_ALL_GCS
65 if (UseParNewGC) { 66 if (UseParNewGC) {
66 typedef ParGCAllocBufferWithBOT* ParGCAllocBufferWithBOTPtr; 67 typedef ParGCAllocBufferWithBOT* ParGCAllocBufferWithBOTPtr;
67 _alloc_buffers = NEW_C_HEAP_ARRAY(ParGCAllocBufferWithBOTPtr, 68 _alloc_buffers = NEW_C_HEAP_ARRAY(ParGCAllocBufferWithBOTPtr,
68 ParallelGCThreads, mtGC); 69 ParallelGCThreads, mtGC);
69 if (_alloc_buffers == NULL) 70 if (_alloc_buffers == NULL)
75 vm_exit_during_initialization("Could not allocate alloc_buffers"); 76 vm_exit_during_initialization("Could not allocate alloc_buffers");
76 } 77 }
77 } else { 78 } else {
78 _alloc_buffers = NULL; 79 _alloc_buffers = NULL;
79 } 80 }
80 #endif // SERIALGC 81 #endif // INCLUDE_ALL_GCS
81 } 82 }
82 83
83 84
84 const char* TenuredGeneration::name() const { 85 const char* TenuredGeneration::name() const {
85 return "tenured generation"; 86 return "tenured generation";
337 _gen_counters->update_all(); 338 _gen_counters->update_all();
338 } 339 }
339 } 340 }
340 341
341 342
342 #ifndef SERIALGC 343 #if INCLUDE_ALL_GCS
343 oop TenuredGeneration::par_promote(int thread_num, 344 oop TenuredGeneration::par_promote(int thread_num,
344 oop old, markOop m, size_t word_sz) { 345 oop old, markOop m, size_t word_sz) {
345 346
346 ParGCAllocBufferWithBOT* buf = _alloc_buffers[thread_num]; 347 ParGCAllocBufferWithBOT* buf = _alloc_buffers[thread_num];
347 HeapWord* obj_ptr = buf->allocate(word_sz); 348 HeapWord* obj_ptr = buf->allocate(word_sz);
421 _rs->verify_aligned_region_empty(_alloc_buffers[i]->range()); 422 _rs->verify_aligned_region_empty(_alloc_buffers[i]->range());
422 } 423 }
423 } 424 }
424 } 425 }
425 426
426 #else // SERIALGC 427 #else // INCLUDE_ALL_GCS
427 void TenuredGeneration::retire_alloc_buffers_before_full_gc() {} 428 void TenuredGeneration::retire_alloc_buffers_before_full_gc() {}
428 void TenuredGeneration::verify_alloc_buffers_clean() {} 429 void TenuredGeneration::verify_alloc_buffers_clean() {}
429 #endif // SERIALGC 430 #endif // INCLUDE_ALL_GCS
430 431
431 bool TenuredGeneration::promotion_attempt_is_safe(size_t max_promotion_in_bytes) const { 432 bool TenuredGeneration::promotion_attempt_is_safe(size_t max_promotion_in_bytes) const {
432 size_t available = max_contiguous_available(); 433 size_t available = max_contiguous_available();
433 size_t av_promo = (size_t)gc_stats()->avg_promoted()->padded_average(); 434 size_t av_promo = (size_t)gc_stats()->avg_promoted()->padded_average();
434 bool res = (available >= av_promo) || (available >= max_promotion_in_bytes); 435 bool res = (available >= av_promo) || (available >= max_promotion_in_bytes);