< prev index next >

src/share/vm/gc_implementation/g1/g1Allocator.cpp

Print this page
rev 7902 : [mq]: 8073052-Rename-and-clean-up-the-allocation-manager-hierarchy-in-g1Allocator

*** 27,47 **** #include "gc_implementation/g1/g1CollectedHeap.hpp" #include "gc_implementation/g1/g1CollectorPolicy.hpp" #include "gc_implementation/g1/heapRegion.inline.hpp" #include "gc_implementation/g1/heapRegionSet.inline.hpp" ! void G1DefaultAllocator::init_mutator_alloc_region() { assert(_mutator_alloc_region.get() == NULL, "pre-condition"); _mutator_alloc_region.init(); } ! void G1DefaultAllocator::release_mutator_alloc_region() { _mutator_alloc_region.release(); assert(_mutator_alloc_region.get() == NULL, "post-condition"); } ! void G1Allocator::reuse_retained_old_region(EvacuationInfo& evacuation_info, OldGCAllocRegion* old, HeapRegion** retained_old) { HeapRegion* retained_region = *retained_old; *retained_old = NULL; --- 27,47 ---- #include "gc_implementation/g1/g1CollectedHeap.hpp" #include "gc_implementation/g1/g1CollectorPolicy.hpp" #include "gc_implementation/g1/heapRegion.inline.hpp" #include "gc_implementation/g1/heapRegionSet.inline.hpp" ! void DefaultAllocRegionManager::init_mutator_alloc_region() { assert(_mutator_alloc_region.get() == NULL, "pre-condition"); _mutator_alloc_region.init(); } ! void DefaultAllocRegionManager::release_mutator_alloc_region() { _mutator_alloc_region.release(); assert(_mutator_alloc_region.get() == NULL, "post-condition"); } ! void AllocRegionManager::reuse_retained_old_region(EvacuationInfo& evacuation_info, OldGCAllocRegion* old, HeapRegion** retained_old) { HeapRegion* retained_region = *retained_old; *retained_old = NULL;
*** 71,91 **** _g1h->_hr_printer.reuse(retained_region); evacuation_info.set_alloc_regions_used_before(retained_region->used()); } } ! void G1DefaultAllocator::init_gc_alloc_regions(EvacuationInfo& evacuation_info) { assert_at_safepoint(true /* should_be_vm_thread */); _survivor_gc_alloc_region.init(); _old_gc_alloc_region.init(); reuse_retained_old_region(evacuation_info, &_old_gc_alloc_region, &_retained_old_gc_alloc_region); } ! void G1DefaultAllocator::release_gc_alloc_regions(uint no_of_gc_workers, EvacuationInfo& evacuation_info) { AllocationContext_t context = AllocationContext::current(); evacuation_info.set_allocation_regions(survivor_gc_alloc_region(context)->count() + old_gc_alloc_region(context)->count()); survivor_gc_alloc_region(context)->release(); // If we have an old GC alloc region to release, we'll save it in --- 71,91 ---- _g1h->_hr_printer.reuse(retained_region); evacuation_info.set_alloc_regions_used_before(retained_region->used()); } } ! void DefaultAllocRegionManager::init_gc_alloc_regions(EvacuationInfo& evacuation_info) { assert_at_safepoint(true /* should_be_vm_thread */); _survivor_gc_alloc_region.init(); _old_gc_alloc_region.init(); reuse_retained_old_region(evacuation_info, &_old_gc_alloc_region, &_retained_old_gc_alloc_region); } ! void DefaultAllocRegionManager::release_gc_alloc_regions(uint no_of_gc_workers, EvacuationInfo& evacuation_info) { AllocationContext_t context = AllocationContext::current(); evacuation_info.set_allocation_regions(survivor_gc_alloc_region(context)->count() + old_gc_alloc_region(context)->count()); survivor_gc_alloc_region(context)->release(); // If we have an old GC alloc region to release, we'll save it in
*** 102,126 **** _g1h->alloc_buffer_stats(InCSetState::Young)->adjust_desired_plab_sz(no_of_gc_workers); _g1h->alloc_buffer_stats(InCSetState::Old)->adjust_desired_plab_sz(no_of_gc_workers); } } ! void G1DefaultAllocator::abandon_gc_alloc_regions() { assert(survivor_gc_alloc_region(AllocationContext::current())->get() == NULL, "pre-condition"); assert(old_gc_alloc_region(AllocationContext::current())->get() == NULL, "pre-condition"); _retained_old_gc_alloc_region = NULL; } ! G1ParGCAllocBuffer::G1ParGCAllocBuffer(size_t gclab_word_size) : ParGCAllocBuffer(gclab_word_size), _retired(true) { } ! HeapWord* G1ParGCAllocator::allocate_direct_or_new_plab(InCSetState dest, size_t word_sz, AllocationContext_t context) { size_t gclab_word_size = _g1h->desired_plab_sz(dest); if (word_sz * 100 < gclab_word_size * ParallelGCBufferWastePct) { ! G1ParGCAllocBuffer* alloc_buf = alloc_buffer(dest, context); add_to_alloc_buffer_waste(alloc_buf->words_remaining()); alloc_buf->retire(); HeapWord* buf = _g1h->par_allocate_during_gc(dest, gclab_word_size, context); if (buf == NULL) { --- 102,126 ---- _g1h->alloc_buffer_stats(InCSetState::Young)->adjust_desired_plab_sz(no_of_gc_workers); _g1h->alloc_buffer_stats(InCSetState::Old)->adjust_desired_plab_sz(no_of_gc_workers); } } ! void DefaultAllocRegionManager::abandon_gc_alloc_regions() { assert(survivor_gc_alloc_region(AllocationContext::current())->get() == NULL, "pre-condition"); assert(old_gc_alloc_region(AllocationContext::current())->get() == NULL, "pre-condition"); _retained_old_gc_alloc_region = NULL; } ! G1PLAB::G1PLAB(size_t gclab_word_size) : ParGCAllocBuffer(gclab_word_size), _retired(true) { } ! HeapWord* PLABAllocator::allocate_direct_or_new_plab(InCSetState dest, size_t word_sz, AllocationContext_t context) { size_t gclab_word_size = _g1h->desired_plab_sz(dest); if (word_sz * 100 < gclab_word_size * ParallelGCBufferWastePct) { ! G1PLAB* alloc_buf = alloc_buffer(dest, context); add_to_alloc_buffer_waste(alloc_buf->words_remaining()); alloc_buf->retire(); HeapWord* buf = _g1h->par_allocate_during_gc(dest, gclab_word_size, context); if (buf == NULL) {
*** 136,159 **** } else { return _g1h->par_allocate_during_gc(dest, word_sz, context); } } ! G1DefaultParGCAllocator::G1DefaultParGCAllocator(G1CollectedHeap* g1h) : ! G1ParGCAllocator(g1h), _surviving_alloc_buffer(g1h->desired_plab_sz(InCSetState::Young)), _tenured_alloc_buffer(g1h->desired_plab_sz(InCSetState::Old)) { for (uint state = 0; state < InCSetState::Num; state++) { _alloc_buffers[state] = NULL; } _alloc_buffers[InCSetState::Young] = &_surviving_alloc_buffer; _alloc_buffers[InCSetState::Old] = &_tenured_alloc_buffer; } ! void G1DefaultParGCAllocator::retire_alloc_buffers() { for (uint state = 0; state < InCSetState::Num; state++) { ! G1ParGCAllocBuffer* const buf = _alloc_buffers[state]; if (buf != NULL) { add_to_alloc_buffer_waste(buf->words_remaining()); buf->flush_and_retire_stats(_g1h->alloc_buffer_stats(state)); } } --- 136,159 ---- } else { return _g1h->par_allocate_during_gc(dest, word_sz, context); } } ! DefaultPLABAllocator::DefaultPLABAllocator(G1CollectedHeap* g1h) : ! PLABAllocator(g1h), _surviving_alloc_buffer(g1h->desired_plab_sz(InCSetState::Young)), _tenured_alloc_buffer(g1h->desired_plab_sz(InCSetState::Old)) { for (uint state = 0; state < InCSetState::Num; state++) { _alloc_buffers[state] = NULL; } _alloc_buffers[InCSetState::Young] = &_surviving_alloc_buffer; _alloc_buffers[InCSetState::Old] = &_tenured_alloc_buffer; } ! void DefaultPLABAllocator::retire_alloc_buffers() { for (uint state = 0; state < InCSetState::Num; state++) { ! G1PLAB* const buf = _alloc_buffers[state]; if (buf != NULL) { add_to_alloc_buffer_waste(buf->words_remaining()); buf->flush_and_retire_stats(_g1h->alloc_buffer_stats(state)); } }
< prev index next >