75 void initialize_statistics(); 76 77 void set_start(HeapWord* start) { _start = start; } 78 void set_end(HeapWord* end) { _end = end; } 79 void set_allocation_end(HeapWord* ptr) { _allocation_end = ptr; } 80 void set_top(HeapWord* top) { _top = top; } 81 void set_pf_top(HeapWord* pf_top) { _pf_top = pf_top; } 82 void set_desired_size(size_t desired_size) { _desired_size = desired_size; } 83 void set_refill_waste_limit(size_t waste) { _refill_waste_limit = waste; } 84 85 size_t initial_refill_waste_limit() { return desired_size() / TLABRefillWasteFraction; } 86 87 static int target_refills() { return _target_refills; } 88 size_t initial_desired_size(); 89 90 size_t remaining(); 91 92 // Make parsable and release it. 93 void reset(); 94 95 // Resize based on amount of allocation, etc. 96 void resize(); 97 98 void invariants() const { assert(top() >= start() && top() <= end(), "invalid tlab"); } 99 100 void initialize(HeapWord* start, HeapWord* top, HeapWord* end); 101 102 void print_stats(const char* tag); 103 104 Thread* thread(); 105 106 // statistics 107 108 int number_of_refills() const { return _number_of_refills; } 109 int fast_refill_waste() const { return _fast_refill_waste; } 110 int slow_refill_waste() const { return _slow_refill_waste; } 111 int gc_waste() const { return _gc_waste; } 112 int slow_allocations() const { return _slow_allocations; } 113 114 static GlobalTLABStats* _global_stats; 115 static GlobalTLABStats* global_stats() { return _global_stats; } 116 117 public: 151 // Return tlab size or remaining space in eden such that the 152 // space is large enough to hold obj_size and necessary fill space. 153 // Otherwise return 0; 154 inline size_t compute_size(size_t obj_size); 155 156 // Compute the minimal needed tlab size for the given object size. 157 static inline size_t compute_min_size(size_t obj_size); 158 159 // Record slow allocation 160 inline void record_slow_allocation(size_t obj_size); 161 162 // Initialization at startup 163 static void startup_initialization(); 164 165 // Make an in-use tlab parsable, optionally retiring and/or zapping it. 166 void make_parsable(bool retire, bool zap = true); 167 168 // Retire in-use tlab before allocation of a new tlab 169 void clear_before_allocation(); 170 171 // Accumulate statistics across all tlabs before gc 172 static void accumulate_statistics_before_gc(); 173 174 // Resize tlabs for all threads 175 static void resize_all_tlabs(); 176 177 void fill(HeapWord* start, HeapWord* top, size_t new_size); 178 void initialize(); 179 180 void set_back_allocation_end(); 181 void set_sample_end(); 182 183 static size_t refill_waste_limit_increment() { return TLABWasteIncrement; } 184 185 template <typename T> void addresses_do(T f) { 186 f(&_start); 187 f(&_top); 188 f(&_pf_top); 189 f(&_end); 190 f(&_allocation_end); 191 } 192 193 // Code generation support 194 static ByteSize start_offset() { return byte_offset_of(ThreadLocalAllocBuffer, _start); } 195 static ByteSize end_offset() { return byte_offset_of(ThreadLocalAllocBuffer, _end); } | 75 void initialize_statistics(); 76 77 void set_start(HeapWord* start) { _start = start; } 78 void set_end(HeapWord* end) { _end = end; } 79 void set_allocation_end(HeapWord* ptr) { _allocation_end = ptr; } 80 void set_top(HeapWord* top) { _top = top; } 81 void set_pf_top(HeapWord* pf_top) { _pf_top = pf_top; } 82 void set_desired_size(size_t desired_size) { _desired_size = desired_size; } 83 void set_refill_waste_limit(size_t waste) { _refill_waste_limit = waste; } 84 85 size_t initial_refill_waste_limit() { return desired_size() / TLABRefillWasteFraction; } 86 87 static int target_refills() { return _target_refills; } 88 size_t initial_desired_size(); 89 90 size_t remaining(); 91 92 // Make parsable and release it. 93 void reset(); 94 95 void invariants() const { assert(top() >= start() && top() <= end(), "invalid tlab"); } 96 97 void initialize(HeapWord* start, HeapWord* top, HeapWord* end); 98 99 void print_stats(const char* tag); 100 101 Thread* thread(); 102 103 // statistics 104 105 int number_of_refills() const { return _number_of_refills; } 106 int fast_refill_waste() const { return _fast_refill_waste; } 107 int slow_refill_waste() const { return _slow_refill_waste; } 108 int gc_waste() const { return _gc_waste; } 109 int slow_allocations() const { return _slow_allocations; } 110 111 static GlobalTLABStats* _global_stats; 112 static GlobalTLABStats* global_stats() { return _global_stats; } 113 114 public: 148 // Return tlab size or remaining space in eden such that the 149 // space is large enough to hold obj_size and necessary fill space. 150 // Otherwise return 0; 151 inline size_t compute_size(size_t obj_size); 152 153 // Compute the minimal needed tlab size for the given object size. 154 static inline size_t compute_min_size(size_t obj_size); 155 156 // Record slow allocation 157 inline void record_slow_allocation(size_t obj_size); 158 159 // Initialization at startup 160 static void startup_initialization(); 161 162 // Make an in-use tlab parsable, optionally retiring and/or zapping it. 163 void make_parsable(bool retire, bool zap = true); 164 165 // Retire in-use tlab before allocation of a new tlab 166 void clear_before_allocation(); 167 168 // Resize based on amount of allocation, etc. 169 void resize(); 170 171 // Accumulate statistics across all tlabs before gc 172 static void accumulate_statistics_before_gc(); 173 174 void fill(HeapWord* start, HeapWord* top, size_t new_size); 175 void initialize(); 176 177 void set_back_allocation_end(); 178 void set_sample_end(); 179 180 static size_t refill_waste_limit_increment() { return TLABWasteIncrement; } 181 182 template <typename T> void addresses_do(T f) { 183 f(&_start); 184 f(&_top); 185 f(&_pf_top); 186 f(&_end); 187 f(&_allocation_end); 188 } 189 190 // Code generation support 191 static ByteSize start_offset() { return byte_offset_of(ThreadLocalAllocBuffer, _start); } 192 static ByteSize end_offset() { return byte_offset_of(ThreadLocalAllocBuffer, _end); } |