113 int fast_refill_waste() const { return _fast_refill_waste; } 114 int slow_refill_waste() const { return _slow_refill_waste; } 115 int gc_waste() const { return _gc_waste; } 116 int slow_allocations() const { return _slow_allocations; } 117 118 static GlobalTLABStats* _global_stats; 119 static GlobalTLABStats* global_stats() { return _global_stats; } 120 121 public: 122 ThreadLocalAllocBuffer() : _allocation_fraction(TLABAllocationWeight), _allocated_before_last_gc(0) { 123 // do nothing. tlabs must be inited by initialize() calls 124 } 125 126 static size_t min_size() { return align_object_size(MinTLABSize / HeapWordSize) + alignment_reserve(); } 127 static size_t max_size() { assert(_max_size != 0, "max_size not set up"); return _max_size; } 128 static size_t max_size_in_bytes() { return max_size() * BytesPerWord; } 129 static void set_max_size(size_t max_size) { _max_size = max_size; } 130 131 HeapWord* start() const { return _start; } 132 HeapWord* end() const { return _end; } 133 HeapWord* hard_end(); 134 HeapWord* top() const { return _top; } 135 HeapWord* pf_top() const { return _pf_top; } 136 size_t desired_size() const { return _desired_size; } 137 size_t used() const { return pointer_delta(top(), start()); } 138 size_t used_bytes() const { return pointer_delta(top(), start(), 1); } 139 size_t free() const { return pointer_delta(end(), top()); } 140 // Don't discard tlab if remaining space is larger than this. 141 size_t refill_waste_limit() const { return _refill_waste_limit; } 142 143 // Allocate size HeapWords. The memory is NOT initialized to zero. 144 inline HeapWord* allocate(size_t size); 145 146 // Reserve space at the end of TLAB 147 static size_t end_reserve() { 148 int reserve_size = typeArrayOopDesc::header_size(T_INT); 149 return MAX2(reserve_size, _reserve_for_allocation_prefetch); 150 } 151 static size_t alignment_reserve() { return align_object_size(end_reserve()); } 152 static size_t alignment_reserve_in_bytes() { return alignment_reserve() * HeapWordSize; } | 113 int fast_refill_waste() const { return _fast_refill_waste; } 114 int slow_refill_waste() const { return _slow_refill_waste; } 115 int gc_waste() const { return _gc_waste; } 116 int slow_allocations() const { return _slow_allocations; } 117 118 static GlobalTLABStats* _global_stats; 119 static GlobalTLABStats* global_stats() { return _global_stats; } 120 121 public: 122 ThreadLocalAllocBuffer() : _allocation_fraction(TLABAllocationWeight), _allocated_before_last_gc(0) { 123 // do nothing. tlabs must be inited by initialize() calls 124 } 125 126 static size_t min_size() { return align_object_size(MinTLABSize / HeapWordSize) + alignment_reserve(); } 127 static size_t max_size() { assert(_max_size != 0, "max_size not set up"); return _max_size; } 128 static size_t max_size_in_bytes() { return max_size() * BytesPerWord; } 129 static void set_max_size(size_t max_size) { _max_size = max_size; } 130 131 HeapWord* start() const { return _start; } 132 HeapWord* end() const { return _end; } 133 HeapWord* slow_path_end() const { return _slow_path_end; } 134 HeapWord* actual_end() const { return _actual_end; } 135 HeapWord* hard_end(); 136 HeapWord* top() const { return _top; } 137 HeapWord* pf_top() const { return _pf_top; } 138 size_t desired_size() const { return _desired_size; } 139 size_t used() const { return pointer_delta(top(), start()); } 140 size_t used_bytes() const { return pointer_delta(top(), start(), 1); } 141 size_t free() const { return pointer_delta(end(), top()); } 142 // Don't discard tlab if remaining space is larger than this. 143 size_t refill_waste_limit() const { return _refill_waste_limit; } 144 145 // Allocate size HeapWords. The memory is NOT initialized to zero. 146 inline HeapWord* allocate(size_t size); 147 148 // Reserve space at the end of TLAB 149 static size_t end_reserve() { 150 int reserve_size = typeArrayOopDesc::header_size(T_INT); 151 return MAX2(reserve_size, _reserve_for_allocation_prefetch); 152 } 153 static size_t alignment_reserve() { return align_object_size(end_reserve()); } 154 static size_t alignment_reserve_in_bytes() { return alignment_reserve() * HeapWordSize; } |