82 &_old_gc_alloc_region,
83 &_retained_old_gc_alloc_region);
84 }
85
86 void G1DefaultAllocator::release_gc_alloc_regions(uint no_of_gc_workers, EvacuationInfo& evacuation_info) {
87 AllocationContext_t context = AllocationContext::current();
88 evacuation_info.set_allocation_regions(survivor_gc_alloc_region(context)->count() +
89 old_gc_alloc_region(context)->count());
90 survivor_gc_alloc_region(context)->release();
91 // If we have an old GC alloc region to release, we'll save it in
92 // _retained_old_gc_alloc_region. If we don't
93 // _retained_old_gc_alloc_region will become NULL. This is what we
94 // want either way so no reason to check explicitly for either
95 // condition.
96 _retained_old_gc_alloc_region = old_gc_alloc_region(context)->release();
97 if (_retained_old_gc_alloc_region != NULL) {
98 _retained_old_gc_alloc_region->record_retained_region();
99 }
100
101 if (ResizePLAB) {
102 _g1h->_survivor_plab_stats.adjust_desired_plab_sz(no_of_gc_workers);
103 _g1h->_old_plab_stats.adjust_desired_plab_sz(no_of_gc_workers);
104 }
105 }
106
107 void G1DefaultAllocator::abandon_gc_alloc_regions() {
108 assert(survivor_gc_alloc_region(AllocationContext::current())->get() == NULL, "pre-condition");
109 assert(old_gc_alloc_region(AllocationContext::current())->get() == NULL, "pre-condition");
110 _retained_old_gc_alloc_region = NULL;
111 }
112
113 G1ParGCAllocBuffer::G1ParGCAllocBuffer(size_t gclab_word_size) :
114 ParGCAllocBuffer(gclab_word_size), _retired(true) { }
115
116 HeapWord* G1ParGCAllocator::allocate_direct_or_new_plab(InCSetState dest,
117 size_t word_sz,
118 AllocationContext_t context) {
119 size_t gclab_word_size = _g1h->desired_plab_sz(dest);
120 if (word_sz * 100 < gclab_word_size * ParallelGCBufferWastePct) {
121 G1ParGCAllocBuffer* alloc_buf = alloc_buffer(dest, context);
122 add_to_alloc_buffer_waste(alloc_buf->words_remaining());
123 alloc_buf->retire(false /* end_of_gc */, false /* retain */);
|
82 &_old_gc_alloc_region,
83 &_retained_old_gc_alloc_region);
84 }
85
86 void G1DefaultAllocator::release_gc_alloc_regions(uint no_of_gc_workers, EvacuationInfo& evacuation_info) {
87 AllocationContext_t context = AllocationContext::current();
88 evacuation_info.set_allocation_regions(survivor_gc_alloc_region(context)->count() +
89 old_gc_alloc_region(context)->count());
90 survivor_gc_alloc_region(context)->release();
91 // If we have an old GC alloc region to release, we'll save it in
92 // _retained_old_gc_alloc_region. If we don't
93 // _retained_old_gc_alloc_region will become NULL. This is what we
94 // want either way so no reason to check explicitly for either
95 // condition.
96 _retained_old_gc_alloc_region = old_gc_alloc_region(context)->release();
97 if (_retained_old_gc_alloc_region != NULL) {
98 _retained_old_gc_alloc_region->record_retained_region();
99 }
100
101 if (ResizePLAB) {
102 _g1h->alloc_buffer_stats(InCSetState::Young)->adjust_desired_plab_sz(no_of_gc_workers);
103 _g1h->alloc_buffer_stats(InCSetState::Old)->adjust_desired_plab_sz(no_of_gc_workers);
104 }
105 }
106
107 void G1DefaultAllocator::abandon_gc_alloc_regions() {
108 assert(survivor_gc_alloc_region(AllocationContext::current())->get() == NULL, "pre-condition");
109 assert(old_gc_alloc_region(AllocationContext::current())->get() == NULL, "pre-condition");
110 _retained_old_gc_alloc_region = NULL;
111 }
112
113 G1ParGCAllocBuffer::G1ParGCAllocBuffer(size_t gclab_word_size) :
114 ParGCAllocBuffer(gclab_word_size), _retired(true) { }
115
116 HeapWord* G1ParGCAllocator::allocate_direct_or_new_plab(InCSetState dest,
117 size_t word_sz,
118 AllocationContext_t context) {
119 size_t gclab_word_size = _g1h->desired_plab_sz(dest);
120 if (word_sz * 100 < gclab_word_size * ParallelGCBufferWastePct) {
121 G1ParGCAllocBuffer* alloc_buf = alloc_buffer(dest, context);
122 add_to_alloc_buffer_waste(alloc_buf->words_remaining());
123 alloc_buf->retire(false /* end_of_gc */, false /* retain */);
|