93 Thread* myThread();
94
95 // statistics
96
97 int number_of_refills() const { return _number_of_refills; }
98 int fast_refill_waste() const { return _fast_refill_waste; }
99 int slow_refill_waste() const { return _slow_refill_waste; }
100 int gc_waste() const { return _gc_waste; }
101 int slow_allocations() const { return _slow_allocations; }
102
103 static GlobalTLABStats* _global_stats;
104 static GlobalTLABStats* global_stats() { return _global_stats; }
105
106 public:
107 ThreadLocalAllocBuffer() : _allocation_fraction(TLABAllocationWeight), _allocated_before_last_gc(0) {
108 // do nothing. tlabs must be inited by initialize() calls
109 }
110
111 static const size_t min_size() { return align_object_size(MinTLABSize / HeapWordSize) + alignment_reserve(); }
112 static const size_t max_size() { assert(_max_size != 0, "max_size not set up"); return _max_size; }
113 static void set_max_size(size_t max_size) { _max_size = max_size; }
114
115 HeapWord* start() const { return _start; }
116 HeapWord* end() const { return _end; }
117 HeapWord* hard_end() const { return _end + alignment_reserve(); }
118 HeapWord* top() const { return _top; }
119 HeapWord* pf_top() const { return _pf_top; }
120 size_t desired_size() const { return _desired_size; }
121 size_t used() const { return pointer_delta(top(), start()); }
122 size_t used_bytes() const { return pointer_delta(top(), start(), 1); }
123 size_t free() const { return pointer_delta(end(), top()); }
124 // Don't discard tlab if remaining space is larger than this.
125 size_t refill_waste_limit() const { return _refill_waste_limit; }
126
127 // Allocate size HeapWords. The memory is NOT initialized to zero.
128 inline HeapWord* allocate(size_t size);
129
130 // Reserve space at the end of TLAB
131 static size_t end_reserve() {
132 int reserve_size = typeArrayOopDesc::header_size(T_INT);
|
93 Thread* myThread();
94
95 // statistics
96
97 int number_of_refills() const { return _number_of_refills; }
98 int fast_refill_waste() const { return _fast_refill_waste; }
99 int slow_refill_waste() const { return _slow_refill_waste; }
100 int gc_waste() const { return _gc_waste; }
101 int slow_allocations() const { return _slow_allocations; }
102
103 static GlobalTLABStats* _global_stats;
104 static GlobalTLABStats* global_stats() { return _global_stats; }
105
106 public:
107 ThreadLocalAllocBuffer() : _allocation_fraction(TLABAllocationWeight), _allocated_before_last_gc(0) {
108 // do nothing. tlabs must be inited by initialize() calls
109 }
110
111 static const size_t min_size() { return align_object_size(MinTLABSize / HeapWordSize) + alignment_reserve(); }
112 static const size_t max_size() { assert(_max_size != 0, "max_size not set up"); return _max_size; }
113 static const size_t max_size_in_bytes() { return max_size() * BytesPerWord; }
114 static void set_max_size(size_t max_size) { _max_size = max_size; }
115
116 HeapWord* start() const { return _start; }
117 HeapWord* end() const { return _end; }
118 HeapWord* hard_end() const { return _end + alignment_reserve(); }
119 HeapWord* top() const { return _top; }
120 HeapWord* pf_top() const { return _pf_top; }
121 size_t desired_size() const { return _desired_size; }
122 size_t used() const { return pointer_delta(top(), start()); }
123 size_t used_bytes() const { return pointer_delta(top(), start(), 1); }
124 size_t free() const { return pointer_delta(end(), top()); }
125 // Don't discard tlab if remaining space is larger than this.
126 size_t refill_waste_limit() const { return _refill_waste_limit; }
127
128 // Allocate size HeapWords. The memory is NOT initialized to zero.
129 inline HeapWord* allocate(size_t size);
130
131 // Reserve space at the end of TLAB
132 static size_t end_reserve() {
133 int reserve_size = typeArrayOopDesc::header_size(T_INT);
|