< prev index next >

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

Print this page
rev 8719 : 8131319: Move G1Allocator::_summary_bytes_used back to G1CollectedHeap
Reviewed-by:

*** 37,53 **** class G1Allocator : public CHeapObj<mtGC> { friend class VMStructs; protected: G1CollectedHeap* _g1h; - // Outside of GC pauses, the number of bytes used in all regions other - // than the current allocation region. - size_t _summary_bytes_used; - public: ! G1Allocator(G1CollectedHeap* heap) : ! _g1h(heap), _summary_bytes_used(0) { } static G1Allocator* create_allocator(G1CollectedHeap* g1h); virtual void init_mutator_alloc_region() = 0; virtual void release_mutator_alloc_region() = 0; --- 37,48 ---- class G1Allocator : public CHeapObj<mtGC> { friend class VMStructs; protected: G1CollectedHeap* _g1h; public: ! G1Allocator(G1CollectedHeap* heap) : _g1h(heap) { } static G1Allocator* create_allocator(G1CollectedHeap* g1h); virtual void init_mutator_alloc_region() = 0; virtual void release_mutator_alloc_region() = 0;
*** 57,92 **** virtual void abandon_gc_alloc_regions() = 0; virtual MutatorAllocRegion* mutator_alloc_region(AllocationContext_t context) = 0; virtual SurvivorGCAllocRegion* survivor_gc_alloc_region(AllocationContext_t context) = 0; virtual OldGCAllocRegion* old_gc_alloc_region(AllocationContext_t context) = 0; ! virtual size_t used() = 0; virtual bool is_retained_old_region(HeapRegion* hr) = 0; void reuse_retained_old_region(EvacuationInfo& evacuation_info, OldGCAllocRegion* old, HeapRegion** retained); - size_t used_unlocked() const { - return _summary_bytes_used; - } - - void increase_used(size_t bytes) { - _summary_bytes_used += bytes; - } - - void decrease_used(size_t bytes) { - assert(_summary_bytes_used >= bytes, - err_msg("invariant: _summary_bytes_used: " SIZE_FORMAT " should be >= bytes: " SIZE_FORMAT, - _summary_bytes_used, bytes)); - _summary_bytes_used -= bytes; - } - - void set_used(size_t bytes) { - _summary_bytes_used = bytes; - } - virtual HeapRegion* new_heap_region(uint hrs_index, G1BlockOffsetSharedArray* sharedOffsetArray, MemRegion mr) { return new HeapRegion(hrs_index, sharedOffsetArray, mr); } --- 52,68 ---- virtual void abandon_gc_alloc_regions() = 0; virtual MutatorAllocRegion* mutator_alloc_region(AllocationContext_t context) = 0; virtual SurvivorGCAllocRegion* survivor_gc_alloc_region(AllocationContext_t context) = 0; virtual OldGCAllocRegion* old_gc_alloc_region(AllocationContext_t context) = 0; ! virtual size_t used_in_alloc_regions() = 0; virtual bool is_retained_old_region(HeapRegion* hr) = 0; void reuse_retained_old_region(EvacuationInfo& evacuation_info, OldGCAllocRegion* old, HeapRegion** retained); virtual HeapRegion* new_heap_region(uint hrs_index, G1BlockOffsetSharedArray* sharedOffsetArray, MemRegion mr) { return new HeapRegion(hrs_index, sharedOffsetArray, mr); }
*** 131,144 **** virtual OldGCAllocRegion* old_gc_alloc_region(AllocationContext_t context) { return &_old_gc_alloc_region; } ! virtual size_t used() { assert(Heap_lock->owner() != NULL, "Should be owned on this thread's behalf."); ! size_t result = _summary_bytes_used; // Read only once in case it is set to NULL concurrently HeapRegion* hr = mutator_alloc_region(AllocationContext::current())->get(); if (hr != NULL) { result += hr->used(); --- 107,120 ---- virtual OldGCAllocRegion* old_gc_alloc_region(AllocationContext_t context) { return &_old_gc_alloc_region; } ! virtual size_t used_in_alloc_regions() { assert(Heap_lock->owner() != NULL, "Should be owned on this thread's behalf."); ! size_t result = 0; // Read only once in case it is set to NULL concurrently HeapRegion* hr = mutator_alloc_region(AllocationContext::current())->get(); if (hr != NULL) { result += hr->used();
< prev index next >