src/share/vm/gc_implementation/shared/parGCAllocBuffer.hpp
Print this page
rev 6326 : 8028710: G1 does not retire allocation buffers after reference processing work
Summary: G1 does not retire allocation buffers after reference processing work when -XX:+ParallelRefProcEnabled is enabled. This causes wrong calculation of PLAB sizes, as the amount of space wasted is not updated correctly.
Reviewed-by: brutisso
*** 58,67 ****
--- 58,68 ----
public:
// Initializes the buffer to be empty, but with the given "word_sz".
// Must get initialized with "set_buf" for an allocation to succeed.
ParGCAllocBuffer(size_t word_sz);
+ virtual ~ParGCAllocBuffer() {}
static const size_t min_size() {
return ThreadLocalAllocBuffer::min_size();
}
*** 111,121 ****
bool contains(void* addr) {
return (void*)_bottom <= addr && addr < (void*)_hard_end;
}
// Sets the space of the buffer to be [buf, space+word_sz()).
! void set_buf(HeapWord* buf) {
_bottom = buf;
_top = _bottom;
_hard_end = _bottom + word_sz();
_end = _hard_end - AlignmentReserve;
assert(_end >= _top, "Negative buffer");
--- 112,122 ----
bool contains(void* addr) {
return (void*)_bottom <= addr && addr < (void*)_hard_end;
}
// Sets the space of the buffer to be [buf, space+word_sz()).
! virtual void set_buf(HeapWord* buf) {
_bottom = buf;
_top = _bottom;
_hard_end = _bottom + word_sz();
_end = _hard_end - AlignmentReserve;
assert(_end >= _top, "Negative buffer");
*** 156,166 ****
}
// Fills in the unallocated portion of the buffer with a garbage object.
// If "end_of_gc" is TRUE, is after the last use in the GC. IF "retain"
// is true, attempt to re-use the unused portion in the next GC.
! void retire(bool end_of_gc, bool retain);
void print() PRODUCT_RETURN;
};
// PLAB stats book-keeping
--- 157,167 ----
}
// Fills in the unallocated portion of the buffer with a garbage object.
// If "end_of_gc" is TRUE, is after the last use in the GC. IF "retain"
// is true, attempt to re-use the unused portion in the next GC.
! virtual void retire(bool end_of_gc, bool retain);
void print() PRODUCT_RETURN;
};
// PLAB stats book-keeping
*** 236,253 ****
return res;
}
void undo_allocation(HeapWord* obj, size_t word_sz);
! void set_buf(HeapWord* buf_start) {
ParGCAllocBuffer::set_buf(buf_start);
_true_end = _hard_end;
_bt.set_region(MemRegion(buf_start, word_sz()));
_bt.initialize_threshold();
}
! void retire(bool end_of_gc, bool retain);
MemRegion range() {
return MemRegion(_top, _true_end);
}
};
--- 237,254 ----
return res;
}
void undo_allocation(HeapWord* obj, size_t word_sz);
! virtual void set_buf(HeapWord* buf_start) {
ParGCAllocBuffer::set_buf(buf_start);
_true_end = _hard_end;
_bt.set_region(MemRegion(buf_start, word_sz()));
_bt.initialize_threshold();
}
! virtual void retire(bool end_of_gc, bool retain);
MemRegion range() {
return MemRegion(_top, _true_end);
}
};