< prev index next >

src/hotspot/share/gc/shared/threadLocalAllocBuffer.inline.hpp

Print this page

        

*** 51,60 **** --- 51,81 ---- return obj; } return NULL; } + inline bool ThreadLocalAllocBuffer::undo_allocate(HeapWord* obj, size_t size) { + invariants(); + + // The object might not be allocated in this TLAB + if (contains(obj, size)) { + return false; + } + + HeapWord* const prev_top = top() - size; + + // The object might not be the last allocated in this TLAB + if (prev_top != obj) { + return false; + } + + set_top(prev_top); + + invariants(); + return true; + } + inline size_t ThreadLocalAllocBuffer::compute_size(size_t obj_size) { // Compute the size for the new TLAB. // The "last" tlab may be smaller to reduce fragmentation. // unsafe_max_tlab_alloc is just a hint. const size_t available_size = Universe::heap()->unsafe_max_tlab_alloc(myThread()) /
< prev index next >