--- old/src/hotspot/share/gc/shared/threadLocalAllocBuffer.hpp 2018-02-12 20:05:06.771759862 -0800 +++ new/src/hotspot/share/gc/shared/threadLocalAllocBuffer.hpp 2018-02-12 20:05:06.507760880 -0800 @@ -51,10 +51,9 @@ HeapWord* _start; // address of TLAB HeapWord* _top; // address after last allocation HeapWord* _pf_top; // allocation prefetch watermark - HeapWord* _end; // allocation end (can be the sampling end point or - // the actual TLAB end, excluding alignment_reserve) - HeapWord* _actual_end; // allocation actual_end (actual TLAB end, excluding alignment_reserve) - HeapWord* _slow_path_end; // remember the end in case a fast refill occurs. + HeapWord* _current_end; // allocation end (can be the sampling end point or _allocation_end) + HeapWord* _allocation_end; // end for allocations (actual TLAB end, excluding alignment_reserve) + HeapWord* _last_slow_path_end; // last address for slow_path_end (as opposed to _allocation_end) size_t _desired_size; // desired size (including alignment_reserve) size_t _refill_waste_limit; // hold onto tlab if free() is larger than this @@ -77,9 +76,9 @@ void initialize_statistics(); void set_start(HeapWord* start) { _start = start; } - void set_end(HeapWord* end) { _end = end; } - void set_actual_end(HeapWord* actual_end) { _actual_end = actual_end; } - void set_slow_path_end(HeapWord* slow_path_end) { _slow_path_end = slow_path_end; } + void set_current_end(HeapWord* current_end) { _current_end = current_end; } + void set_allocation_end(HeapWord* ptr) { _allocation_end = ptr; } + void set_last_slow_path_end(HeapWord* ptr) { _last_slow_path_end = ptr; } void set_top(HeapWord* top) { _top = top; } void set_pf_top(HeapWord* pf_top) { _pf_top = pf_top; } void set_desired_size(size_t desired_size) { _desired_size = desired_size; } @@ -91,9 +90,10 @@ static int target_refills() { return _target_refills; } size_t initial_desired_size(); - size_t remaining() { return end() == NULL ? 0 : pointer_delta(hard_end(), top()); } + size_t remaining(); void set_sample_end(); + void update_end_pointers(); // Make parsable and release it. void reset(); @@ -101,7 +101,7 @@ // Resize based on amount of allocation, etc. void resize(); - void invariants() const { assert(top() >= start() && top() <= end(), "invalid tlab"); } + void invariants() const { assert(top() >= start() && top() <= current_end(), "invalid tlab"); } void initialize(HeapWord* start, HeapWord* top, HeapWord* end); @@ -131,14 +131,14 @@ static void set_max_size(size_t max_size) { _max_size = max_size; } HeapWord* start() const { return _start; } - HeapWord* end() const { return _end; } + HeapWord* current_end() const { return _current_end; } HeapWord* top() const { return _top; } - HeapWord* hard_end(); + HeapWord* reserved_end(); HeapWord* pf_top() const { return _pf_top; } size_t desired_size() const { return _desired_size; } size_t used() const { return pointer_delta(top(), start()); } size_t used_bytes() const { return pointer_delta(top(), start(), 1); } - size_t free() const { return pointer_delta(end(), top()); } + size_t free() const { return pointer_delta(current_end(), top()); } // Don't discard tlab if remaining space is larger than this. size_t refill_waste_limit() const { return _refill_waste_limit; } @@ -180,15 +180,16 @@ void initialize(); void pick_next_sample(size_t diff = 0); - void set_back_actual_end(); - void handle_sample(Thread* thread, HeapWord* result, size_t size); + void set_back_allocation_end(); + void update_tlab_sample_point(size_t size_in_bytes); + void handle_sample(Thread* thread, HeapWord* result, size_t size_in_bytes); bool should_sample() { return _bytes_until_sample == 0; } static size_t refill_waste_limit_increment() { return TLABWasteIncrement; } // Code generation support static ByteSize start_offset() { return byte_offset_of(ThreadLocalAllocBuffer, _start); } - static ByteSize end_offset() { return byte_offset_of(ThreadLocalAllocBuffer, _end ); } + static ByteSize current_end_offset() { return byte_offset_of(ThreadLocalAllocBuffer, _current_end ); } static ByteSize top_offset() { return byte_offset_of(ThreadLocalAllocBuffer, _top ); } static ByteSize pf_top_offset() { return byte_offset_of(ThreadLocalAllocBuffer, _pf_top ); } static ByteSize size_offset() { return byte_offset_of(ThreadLocalAllocBuffer, _desired_size ); }