< prev index next >
src/share/vm/gc_implementation/shared/plab.hpp
Print this page
rev 8153 : plab moved to cpp
*** 61,82 ****
// Fill in remaining space with a dummy object and invalidate the PLAB. Returns
// the amount of remaining space.
size_t retire_internal();
! void add_undo_waste(HeapWord* obj, size_t word_sz) {
! CollectedHeap::fill_with_object(obj, word_sz);
! _undo_wasted += word_sz;
! }
// Undo the last allocation in the buffer, which is required to be of the
// "obj" of the given "word_sz".
! void undo_last_allocation(HeapWord* obj, size_t word_sz) {
! assert(pointer_delta(_top, _bottom) >= word_sz, "Bad undo");
! assert(pointer_delta(_top, obj) == word_sz, "Bad undo");
! _top = obj;
! }
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);
--- 61,75 ----
// Fill in remaining space with a dummy object and invalidate the PLAB. Returns
// the amount of remaining space.
size_t retire_internal();
! void add_undo_waste(HeapWord* obj, size_t word_sz);
// Undo the last allocation in the buffer, which is required to be of the
// "obj" of the given "word_sz".
! void undo_last_allocation(HeapWord* obj, size_t word_sz);
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);
*** 104,123 ****
// Allocate the object aligned to "alignment_in_bytes".
HeapWord* allocate_aligned(size_t word_sz, unsigned short alignment_in_bytes);
// Undo any allocation in the buffer, which is required to be of the
// "obj" of the given "word_sz".
! void undo_allocation(HeapWord* obj, size_t word_sz) {
! // Is the alloc in the current alloc buffer?
! if (contains(obj)) {
! assert(contains(obj + word_sz - 1),
! "should contain whole object");
! undo_last_allocation(obj, word_sz);
! } else {
! add_undo_waste(obj, word_sz);
! }
! }
// The total (word) size of the buffer, including both allocated and
// unallocated space.
size_t word_sz() { return _word_sz; }
--- 97,107 ----
// Allocate the object aligned to "alignment_in_bytes".
HeapWord* allocate_aligned(size_t word_sz, unsigned short alignment_in_bytes);
// Undo any allocation in the buffer, which is required to be of the
// "obj" of the given "word_sz".
! void undo_allocation(HeapWord* obj, size_t word_sz);
// The total (word) size of the buffer, including both allocated and
// unallocated space.
size_t word_sz() { return _word_sz; }
< prev index next >