< prev index next >
src/share/vm/gc_implementation/g1/g1Allocator.hpp
Print this page
rev 8203 : [mq]: backout
*** 26,36 ****
#define SHARE_VM_GC_IMPLEMENTATION_G1_G1ALLOCATOR_HPP
#include "gc_implementation/g1/g1AllocationContext.hpp"
#include "gc_implementation/g1/g1AllocRegion.hpp"
#include "gc_implementation/g1/g1InCSetState.hpp"
! #include "gc_implementation/shared/plab.hpp"
#include "gc_interface/collectedHeap.hpp"
class EvacuationInfo;
// Base class for G1 allocators.
--- 26,36 ----
#define SHARE_VM_GC_IMPLEMENTATION_G1_G1ALLOCATOR_HPP
#include "gc_implementation/g1/g1AllocationContext.hpp"
#include "gc_implementation/g1/g1AllocRegion.hpp"
#include "gc_implementation/g1/g1InCSetState.hpp"
! #include "gc_implementation/shared/parGCAllocBuffer.hpp"
#include "gc_interface/collectedHeap.hpp"
class EvacuationInfo;
// Base class for G1 allocators.
*** 145,174 ****
}
return result;
}
};
! class G1PLAB: public PLAB {
private:
bool _retired;
public:
! G1PLAB(size_t gclab_word_size);
! virtual ~G1PLAB() {
guarantee(_retired, "Allocation buffer has not been retired");
}
virtual void set_buf(HeapWord* buf) {
! PLAB::set_buf(buf);
_retired = false;
}
virtual void retire() {
if (_retired) {
return;
}
! PLAB::retire();
_retired = true;
}
};
class G1ParGCAllocator : public CHeapObj<mtGC> {
--- 145,174 ----
}
return result;
}
};
! class G1ParGCAllocBuffer: public ParGCAllocBuffer {
private:
bool _retired;
public:
! G1ParGCAllocBuffer(size_t gclab_word_size);
! virtual ~G1ParGCAllocBuffer() {
guarantee(_retired, "Allocation buffer has not been retired");
}
virtual void set_buf(HeapWord* buf) {
! ParGCAllocBuffer::set_buf(buf);
_retired = false;
}
virtual void retire() {
if (_retired) {
return;
}
! ParGCAllocBuffer::retire();
_retired = true;
}
};
class G1ParGCAllocator : public CHeapObj<mtGC> {
*** 188,198 ****
void add_to_alloc_buffer_waste(size_t waste) { _alloc_buffer_waste += waste; }
void add_to_undo_waste(size_t waste) { _undo_waste += waste; }
virtual void retire_alloc_buffers() = 0;
! virtual G1PLAB* 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.
static uint calc_survivor_alignment_bytes() {
assert(SurvivorAlignmentInBytes >= ObjectAlignmentInBytes, "sanity");
--- 188,198 ----
void add_to_alloc_buffer_waste(size_t waste) { _alloc_buffer_waste += waste; }
void add_to_undo_waste(size_t waste) { _undo_waste += waste; }
virtual void retire_alloc_buffers() = 0;
! virtual G1ParGCAllocBuffer* 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.
static uint calc_survivor_alignment_bytes() {
assert(SurvivorAlignmentInBytes >= ObjectAlignmentInBytes, "sanity");
*** 227,237 ****
// Allocate word_sz words in the PLAB of dest. Returns the address of the
// allocated memory, NULL if not successful.
HeapWord* plab_allocate(InCSetState dest,
size_t word_sz,
AllocationContext_t context) {
! G1PLAB* buffer = alloc_buffer(dest, context);
if (_survivor_alignment_bytes == 0) {
return buffer->allocate(word_sz);
} else {
return buffer->allocate_aligned(word_sz, _survivor_alignment_bytes);
}
--- 227,237 ----
// Allocate word_sz words in the PLAB of dest. Returns the address of the
// allocated memory, NULL if not successful.
HeapWord* plab_allocate(InCSetState dest,
size_t word_sz,
AllocationContext_t context) {
! G1ParGCAllocBuffer* buffer = alloc_buffer(dest, context);
if (_survivor_alignment_bytes == 0) {
return buffer->allocate(word_sz);
} else {
return buffer->allocate_aligned(word_sz, _survivor_alignment_bytes);
}
*** 257,274 ****
}
}
};
class G1DefaultParGCAllocator : public G1ParGCAllocator {
! G1PLAB _surviving_alloc_buffer;
! G1PLAB _tenured_alloc_buffer;
! G1PLAB* _alloc_buffers[InCSetState::Num];
public:
G1DefaultParGCAllocator(G1CollectedHeap* g1h);
! virtual G1PLAB* alloc_buffer(InCSetState dest, AllocationContext_t context) {
assert(dest.is_valid(),
err_msg("Allocation buffer index out-of-bounds: " CSETSTATE_FORMAT, dest.value()));
assert(_alloc_buffers[dest.value()] != NULL,
err_msg("Allocation buffer is NULL: " CSETSTATE_FORMAT, dest.value()));
return _alloc_buffers[dest.value()];
--- 257,274 ----
}
}
};
class G1DefaultParGCAllocator : public G1ParGCAllocator {
! G1ParGCAllocBuffer _surviving_alloc_buffer;
! G1ParGCAllocBuffer _tenured_alloc_buffer;
! G1ParGCAllocBuffer* _alloc_buffers[InCSetState::Num];
public:
G1DefaultParGCAllocator(G1CollectedHeap* g1h);
! virtual G1ParGCAllocBuffer* alloc_buffer(InCSetState dest, AllocationContext_t context) {
assert(dest.is_valid(),
err_msg("Allocation buffer index out-of-bounds: " CSETSTATE_FORMAT, dest.value()));
assert(_alloc_buffers[dest.value()] != NULL,
err_msg("Allocation buffer is NULL: " CSETSTATE_FORMAT, dest.value()));
return _alloc_buffers[dest.value()];
< prev index next >