< prev index next >
src/share/vm/gc/g1/g1Allocator.cpp
Print this page
@@ -31,10 +31,12 @@
#include "gc/g1/heapRegion.inline.hpp"
#include "gc/g1/heapRegionSet.inline.hpp"
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)) {
}
@@ -85,11 +87,12 @@
}
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();
reuse_retained_old_region(evacuation_info,
&_old_gc_alloc_region,
@@ -116,10 +119,26 @@
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;
}
+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) { }
size_t G1Allocator::unsafe_max_tlab_alloc(AllocationContext_t context) {
// Return the remaining space in the cur alloc region, but not less than
@@ -163,26 +182,10 @@
ShouldNotReachHere();
return NULL; // Keep some compilers happy
}
}
-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,
AllocationContext_t context) {
assert(!_g1h->is_humongous(desired_word_size),
@@ -230,15 +233,10 @@
}
}
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),
_survivor_alignment_bytes(calc_survivor_alignment_bytes()) {
for (size_t i = 0; i < ARRAY_SIZE(_direct_allocated); i++) {
< prev index next >