< prev index next >

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

Print this page
rev 8816 : imported patch 8073013-add-detailed-information-about-plab-memory-usage

*** 28,37 **** --- 28,44 ---- #include "gc/g1/g1CollectorPolicy.hpp" #include "gc/g1/g1MarkSweep.hpp" #include "gc/g1/heapRegion.inline.hpp" #include "gc/g1/heapRegionSet.inline.hpp" + G1DefaultAllocator::G1DefaultAllocator(G1CollectedHeap* heap) : + G1Allocator(heap), + _retained_old_gc_alloc_region(NULL), + _survivor_gc_alloc_region(heap->alloc_buffer_stats(InCSetState::Young)), + _old_gc_alloc_region(heap->alloc_buffer_stats(InCSetState::Old)) { + } + void G1DefaultAllocator::init_mutator_alloc_region() { assert(_mutator_alloc_region.get() == NULL, "pre-condition"); _mutator_alloc_region.init(); }
*** 101,114 **** _retained_old_gc_alloc_region = old_gc_alloc_region(context)->release(); if (_retained_old_gc_alloc_region != NULL) { _retained_old_gc_alloc_region->record_retained_region(); } - if (ResizePLAB) { _g1h->alloc_buffer_stats(InCSetState::Young)->adjust_desired_plab_sz(); _g1h->alloc_buffer_stats(InCSetState::Old)->adjust_desired_plab_sz(); - } } 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"); --- 108,119 ----
*** 211,220 **** --- 216,228 ---- G1PLABAllocator::G1PLABAllocator(G1Allocator* allocator) : _g1h(G1CollectedHeap::heap()), _allocator(allocator), _survivor_alignment_bytes(calc_survivor_alignment_bytes()) { + for (size_t i = 0; i < ARRAY_SIZE(_inline_allocated); i++) { + _inline_allocated[i] = 0; + } } HeapWord* G1PLABAllocator::allocate_direct_or_new_plab(InCSetState dest, size_t word_sz, AllocationContext_t context,
*** 236,246 **** } // Otherwise. *plab_refill_failed = true; } // Try inline allocation. ! return _allocator->par_allocate_during_gc(dest, word_sz, context); } void G1PLABAllocator::undo_allocation(InCSetState dest, HeapWord* obj, size_t word_sz, AllocationContext_t context) { alloc_buffer(dest, context)->undo_allocation(obj, word_sz); } --- 244,258 ---- } // Otherwise. *plab_refill_failed = true; } // Try inline allocation. ! HeapWord* result = _allocator->par_allocate_during_gc(dest, word_sz, context); ! if (result != NULL) { ! _inline_allocated[dest.value()] += word_sz; ! } ! return result; } void G1PLABAllocator::undo_allocation(InCSetState dest, HeapWord* obj, size_t word_sz, AllocationContext_t context) { alloc_buffer(dest, context)->undo_allocation(obj, word_sz); }
*** 254,268 **** } _alloc_buffers[InCSetState::Young] = &_surviving_alloc_buffer; _alloc_buffers[InCSetState::Old] = &_tenured_alloc_buffer; } ! void G1DefaultPLABAllocator::retire_alloc_buffers() { for (uint state = 0; state < InCSetState::Num; state++) { G1PLAB* const buf = _alloc_buffers[state]; if (buf != NULL) { ! buf->flush_and_retire_stats(_g1h->alloc_buffer_stats(state)); } } } void G1DefaultPLABAllocator::waste(size_t& wasted, size_t& undo_wasted) { --- 266,283 ---- } _alloc_buffers[InCSetState::Young] = &_surviving_alloc_buffer; _alloc_buffers[InCSetState::Old] = &_tenured_alloc_buffer; } ! void G1DefaultPLABAllocator::flush_and_retire_stats() { for (uint state = 0; state < InCSetState::Num; state++) { G1PLAB* const buf = _alloc_buffers[state]; if (buf != NULL) { ! G1EvacStats* stats = _g1h->alloc_buffer_stats(state); ! buf->flush_and_retire_stats(stats); ! stats->add_inline_allocated(_inline_allocated[state]); ! _inline_allocated[state] = 0; } } } void G1DefaultPLABAllocator::waste(size_t& wasted, size_t& undo_wasted) {
< prev index next >