7127700: G1: Replace G1PLAB with PLAB
Reviewed-by: sjohanss, kbarrett
This commit is contained in:
parent
6ef9800875
commit
347c253452
@ -134,9 +134,6 @@ 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
|
||||
// the min TLAB size.
|
||||
@ -253,7 +250,7 @@ HeapWord* G1PLABAllocator::allocate_direct_or_new_plab(InCSetState dest,
|
||||
if ((required_in_plab <= plab_word_size) &&
|
||||
may_throw_away_buffer(required_in_plab, plab_word_size)) {
|
||||
|
||||
G1PLAB* alloc_buf = alloc_buffer(dest, context);
|
||||
PLAB* alloc_buf = alloc_buffer(dest, context);
|
||||
alloc_buf->retire();
|
||||
|
||||
size_t actual_plab_size = 0;
|
||||
@ -304,7 +301,7 @@ G1DefaultPLABAllocator::G1DefaultPLABAllocator(G1Allocator* allocator) :
|
||||
|
||||
void G1DefaultPLABAllocator::flush_and_retire_stats() {
|
||||
for (uint state = 0; state < InCSetState::Num; state++) {
|
||||
G1PLAB* const buf = _alloc_buffers[state];
|
||||
PLAB* const buf = _alloc_buffers[state];
|
||||
if (buf != NULL) {
|
||||
G1EvacStats* stats = _g1h->alloc_buffer_stats(state);
|
||||
buf->flush_and_retire_stats(stats);
|
||||
@ -318,7 +315,7 @@ void G1DefaultPLABAllocator::waste(size_t& wasted, size_t& undo_wasted) {
|
||||
wasted = 0;
|
||||
undo_wasted = 0;
|
||||
for (uint state = 0; state < InCSetState::Num; state++) {
|
||||
G1PLAB * const buf = _alloc_buffers[state];
|
||||
PLAB * const buf = _alloc_buffers[state];
|
||||
if (buf != NULL) {
|
||||
wasted += buf->waste();
|
||||
undo_wasted += buf->undo_waste();
|
||||
|
@ -178,39 +178,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class G1PLAB: public PLAB {
|
||||
private:
|
||||
bool _retired;
|
||||
|
||||
public:
|
||||
G1PLAB(size_t gclab_word_size);
|
||||
virtual ~G1PLAB() {
|
||||
guarantee(_retired, "Allocation buffer has not been retired");
|
||||
}
|
||||
|
||||
// The amount of space in words wasted within the PLAB including
|
||||
// waste due to refills and alignment.
|
||||
size_t wasted() const { return _wasted; }
|
||||
|
||||
virtual void set_buf(HeapWord* buf, size_t word_size) {
|
||||
PLAB::set_buf(buf, word_size);
|
||||
_retired = false;
|
||||
}
|
||||
|
||||
virtual void retire() {
|
||||
if (_retired) {
|
||||
return;
|
||||
}
|
||||
PLAB::retire();
|
||||
_retired = true;
|
||||
}
|
||||
|
||||
virtual void flush_and_retire_stats(PLABStats* stats) {
|
||||
PLAB::flush_and_retire_stats(stats);
|
||||
_retired = true;
|
||||
}
|
||||
};
|
||||
|
||||
// Manages the PLABs used during garbage collection. Interface for allocation from PLABs.
|
||||
// Needs to handle multiple contexts, extra alignment in any "survivor" area and some
|
||||
// statistics.
|
||||
@ -231,7 +198,7 @@ protected:
|
||||
size_t _direct_allocated[InCSetState::Num];
|
||||
|
||||
virtual void flush_and_retire_stats() = 0;
|
||||
virtual G1PLAB* alloc_buffer(InCSetState dest, AllocationContext_t context) = 0;
|
||||
virtual PLAB* alloc_buffer(InCSetState dest, AllocationContext_t context) = 0;
|
||||
|
||||
// Calculate the survivor space object alignment in bytes. Returns that or 0 if
|
||||
// there are no restrictions on survivor alignment.
|
||||
@ -292,14 +259,14 @@ public:
|
||||
// The default PLAB allocator for G1. Keeps the current (single) PLAB for survivor
|
||||
// and old generation allocation.
|
||||
class G1DefaultPLABAllocator : public G1PLABAllocator {
|
||||
G1PLAB _surviving_alloc_buffer;
|
||||
G1PLAB _tenured_alloc_buffer;
|
||||
G1PLAB* _alloc_buffers[InCSetState::Num];
|
||||
PLAB _surviving_alloc_buffer;
|
||||
PLAB _tenured_alloc_buffer;
|
||||
PLAB* _alloc_buffers[InCSetState::Num];
|
||||
|
||||
public:
|
||||
G1DefaultPLABAllocator(G1Allocator* _allocator);
|
||||
|
||||
virtual G1PLAB* alloc_buffer(InCSetState dest, AllocationContext_t context) {
|
||||
virtual PLAB* alloc_buffer(InCSetState dest, AllocationContext_t context) {
|
||||
assert(dest.is_valid(),
|
||||
"Allocation buffer index out-of-bounds: " CSETSTATE_FORMAT, dest.value());
|
||||
assert(_alloc_buffers[dest.value()] != NULL,
|
||||
|
@ -47,7 +47,7 @@ HeapWord* G1Allocator::attempt_allocation_force(size_t word_size, AllocationCont
|
||||
inline HeapWord* G1PLABAllocator::plab_allocate(InCSetState dest,
|
||||
size_t word_sz,
|
||||
AllocationContext_t context) {
|
||||
G1PLAB* buffer = alloc_buffer(dest, context);
|
||||
PLAB* buffer = alloc_buffer(dest, context);
|
||||
if (_survivor_alignment_bytes == 0 || !dest.is_young()) {
|
||||
return buffer->allocate(word_sz);
|
||||
} else {
|
||||
|
@ -206,7 +206,7 @@ void G1ParScanThreadState::report_promotion_event(InCSetState const dest_state,
|
||||
oop const old, size_t word_sz, uint age,
|
||||
HeapWord * const obj_ptr,
|
||||
const AllocationContext_t context) const {
|
||||
G1PLAB* alloc_buf = _plab_allocator->alloc_buffer(dest_state, context);
|
||||
PLAB* alloc_buf = _plab_allocator->alloc_buffer(dest_state, context);
|
||||
if (alloc_buf->contains(obj_ptr)) {
|
||||
_g1h->_gc_tracer_stw->report_promotion_in_new_plab_event(old->klass(), word_sz, age,
|
||||
dest_state.value() == InCSetState::Old,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -72,7 +72,6 @@ public:
|
||||
// Initializes the buffer to be empty, but with the given "word_sz".
|
||||
// Must get initialized with "set_buf" for an allocation to succeed.
|
||||
PLAB(size_t word_sz);
|
||||
virtual ~PLAB() {}
|
||||
|
||||
static size_t size_required_for_allocation(size_t word_size) { return word_size + AlignmentReserve; }
|
||||
|
||||
@ -120,7 +119,7 @@ public:
|
||||
}
|
||||
|
||||
// Sets the space of the buffer to be [buf, space+word_sz()).
|
||||
virtual void set_buf(HeapWord* buf, size_t new_word_sz) {
|
||||
void set_buf(HeapWord* buf, size_t new_word_sz) {
|
||||
assert(new_word_sz > AlignmentReserve, "Too small");
|
||||
_word_sz = new_word_sz;
|
||||
|
||||
@ -136,11 +135,11 @@ public:
|
||||
// Flush allocation statistics into the given PLABStats supporting ergonomic
|
||||
// sizing of PLAB's and retire the current buffer. To be called at the end of
|
||||
// GC.
|
||||
virtual void flush_and_retire_stats(PLABStats* stats);
|
||||
void flush_and_retire_stats(PLABStats* stats);
|
||||
|
||||
// Fills in the unallocated portion of the buffer with a garbage object and updates
|
||||
// statistics. To be called during GC.
|
||||
virtual void retire();
|
||||
void retire();
|
||||
};
|
||||
|
||||
// PLAB book-keeping.
|
||||
|
Loading…
Reference in New Issue
Block a user