121 assert(new_word_sz > CollectedHeap::lab_alignment_reserve(), "Too small");
122 _word_sz = new_word_sz;
123
124 _bottom = buf;
125 _top = _bottom;
126 _hard_end = _bottom + word_sz();
127 _end = _hard_end - CollectedHeap::lab_alignment_reserve();
128 assert(_end >= _top, "Negative buffer");
129 // In support of ergonomic sizing
130 _allocated += word_sz();
131 }
132
133 // Flush allocation statistics into the given PLABStats supporting ergonomic
134 // sizing of PLAB's and retire the current buffer. To be called at the end of
135 // GC.
136 void flush_and_retire_stats(PLABStats* stats);
137
138 // Fills in the unallocated portion of the buffer with a garbage object and updates
139 // statistics. To be called during GC.
140 void retire();
141 };
142
143 // PLAB book-keeping.
144 class PLABStats : public CHeapObj<mtGC> {
145 protected:
146 const char* _description; // Identifying string.
147
148 size_t _allocated; // Total allocated
149 size_t _wasted; // of which wasted (internal fragmentation)
150 size_t _undo_wasted; // of which wasted on undo (is not used for calculation of PLAB size)
151 size_t _unused; // Unused in last buffer
152
153 virtual void reset() {
154 _allocated = 0;
155 _wasted = 0;
156 _undo_wasted = 0;
157 _unused = 0;
158 }
159
160 public:
|
121 assert(new_word_sz > CollectedHeap::lab_alignment_reserve(), "Too small");
122 _word_sz = new_word_sz;
123
124 _bottom = buf;
125 _top = _bottom;
126 _hard_end = _bottom + word_sz();
127 _end = _hard_end - CollectedHeap::lab_alignment_reserve();
128 assert(_end >= _top, "Negative buffer");
129 // In support of ergonomic sizing
130 _allocated += word_sz();
131 }
132
133 // Flush allocation statistics into the given PLABStats supporting ergonomic
134 // sizing of PLAB's and retire the current buffer. To be called at the end of
135 // GC.
136 void flush_and_retire_stats(PLABStats* stats);
137
138 // Fills in the unallocated portion of the buffer with a garbage object and updates
139 // statistics. To be called during GC.
140 void retire();
141
142 HeapWord* top() {
143 return _top;
144 }
145 };
146
147 // PLAB book-keeping.
148 class PLABStats : public CHeapObj<mtGC> {
149 protected:
150 const char* _description; // Identifying string.
151
152 size_t _allocated; // Total allocated
153 size_t _wasted; // of which wasted (internal fragmentation)
154 size_t _undo_wasted; // of which wasted on undo (is not used for calculation of PLAB size)
155 size_t _unused; // Unused in last buffer
156
157 virtual void reset() {
158 _allocated = 0;
159 _wasted = 0;
160 _undo_wasted = 0;
161 _unused = 0;
162 }
163
164 public:
|