This commit is contained in:
Stefan Johansson
2015-11-17 12:37:55 +00:00
2 changed files with 35 additions and 31 deletions

View File

@@ -33,6 +33,8 @@
G1DefaultAllocator::G1DefaultAllocator(G1CollectedHeap* heap) :
G1Allocator(heap),
_survivor_is_full(false),
_old_is_full(false),
_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)) {
@@ -87,7 +89,8 @@ void G1Allocator::reuse_retained_old_region(EvacuationInfo& evacuation_info,
void G1DefaultAllocator::init_gc_alloc_regions(EvacuationInfo& evacuation_info) {
assert_at_safepoint(true /* should_be_vm_thread */);
G1Allocator::init_gc_alloc_regions(evacuation_info);
_survivor_is_full = false;
_old_is_full = false;
_survivor_gc_alloc_region.init();
_old_gc_alloc_region.init();
@@ -118,6 +121,22 @@ void G1DefaultAllocator::abandon_gc_alloc_regions() {
_retained_old_gc_alloc_region = NULL;
}
bool G1DefaultAllocator::survivor_is_full(AllocationContext_t context) const {
return _survivor_is_full;
}
bool G1DefaultAllocator::old_is_full(AllocationContext_t context) const {
return _old_is_full;
}
void G1DefaultAllocator::set_survivor_full(AllocationContext_t context) {
_survivor_is_full = true;
}
void G1DefaultAllocator::set_old_full(AllocationContext_t context) {
_old_is_full = true;
}
G1PLAB::G1PLAB(size_t gclab_word_size) :
PLAB(gclab_word_size), _retired(true) { }
@@ -165,22 +184,6 @@ HeapWord* G1Allocator::par_allocate_during_gc(InCSetState dest,
}
}
bool G1Allocator::survivor_is_full(AllocationContext_t context) const {
return _survivor_is_full;
}
bool G1Allocator::old_is_full(AllocationContext_t context) const {
return _old_is_full;
}
void G1Allocator::set_survivor_full(AllocationContext_t context) {
_survivor_is_full = true;
}
void G1Allocator::set_old_full(AllocationContext_t context) {
_old_is_full = true;
}
HeapWord* G1Allocator::survivor_attempt_allocation(size_t min_word_size,
size_t desired_word_size,
size_t* actual_word_size,
@@ -232,11 +235,6 @@ HeapWord* G1Allocator::old_attempt_allocation(size_t min_word_size,
return result;
}
void G1Allocator::init_gc_alloc_regions(EvacuationInfo& evacuation_info) {
_survivor_is_full = false;
_old_is_full = false;
}
G1PLABAllocator::G1PLABAllocator(G1Allocator* allocator) :
_g1h(G1CollectedHeap::heap()),
_allocator(allocator),

View File

@@ -38,19 +38,16 @@ class EvacuationInfo;
// Also keeps track of retained regions across GCs.
class G1Allocator : public CHeapObj<mtGC> {
friend class VMStructs;
private:
bool _survivor_is_full;
bool _old_is_full;
protected:
G1CollectedHeap* _g1h;
virtual MutatorAllocRegion* mutator_alloc_region(AllocationContext_t context) = 0;
virtual bool survivor_is_full(AllocationContext_t context) const;
virtual bool old_is_full(AllocationContext_t context) const;
virtual bool survivor_is_full(AllocationContext_t context) const = 0;
virtual bool old_is_full(AllocationContext_t context) const = 0;
virtual void set_survivor_full(AllocationContext_t context);
virtual void set_old_full(AllocationContext_t context);
virtual void set_survivor_full(AllocationContext_t context) = 0;
virtual void set_old_full(AllocationContext_t context) = 0;
// Accessors to the allocation regions.
virtual SurvivorGCAllocRegion* survivor_gc_alloc_region(AllocationContext_t context) = 0;
@@ -67,7 +64,7 @@ protected:
size_t* actual_word_size,
AllocationContext_t context);
public:
G1Allocator(G1CollectedHeap* heap) : _g1h(heap), _survivor_is_full(false), _old_is_full(false) { }
G1Allocator(G1CollectedHeap* heap) : _g1h(heap) { }
virtual ~G1Allocator() { }
static G1Allocator* create_allocator(G1CollectedHeap* g1h);
@@ -79,7 +76,7 @@ public:
virtual void init_mutator_alloc_region() = 0;
virtual void release_mutator_alloc_region() = 0;
virtual void init_gc_alloc_regions(EvacuationInfo& evacuation_info);
virtual void init_gc_alloc_regions(EvacuationInfo& evacuation_info) = 0;
virtual void release_gc_alloc_regions(EvacuationInfo& evacuation_info) = 0;
virtual void abandon_gc_alloc_regions() = 0;
@@ -119,6 +116,9 @@ public:
// and old generation allocation region.
// Can retain the (single) old generation allocation region across GCs.
class G1DefaultAllocator : public G1Allocator {
private:
bool _survivor_is_full;
bool _old_is_full;
protected:
// Alloc region used to satisfy mutator allocation requests.
MutatorAllocRegion _mutator_alloc_region;
@@ -135,6 +135,12 @@ protected:
public:
G1DefaultAllocator(G1CollectedHeap* heap);
virtual bool survivor_is_full(AllocationContext_t context) const;
virtual bool old_is_full(AllocationContext_t context) const ;
virtual void set_survivor_full(AllocationContext_t context);
virtual void set_old_full(AllocationContext_t context);
virtual void init_mutator_alloc_region();
virtual void release_mutator_alloc_region();