116 }
117
118 bool contains(void* addr) {
119 return (void*)_bottom <= addr && addr < (void*)_hard_end;
120 }
121
122 // Sets the space of the buffer to be [buf, space+word_sz()).
123 virtual void set_buf(HeapWord* buf) {
124 _bottom = buf;
125 _top = _bottom;
126 _hard_end = _bottom + word_sz();
127 _end = _hard_end - AlignmentReserve;
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 virtual void retire();
141
142 void print() PRODUCT_RETURN;
143 };
144
145 // PLAB book-keeping.
146 class PLABStats VALUE_OBJ_CLASS_SPEC {
147 size_t _allocated; // Total allocated
148 size_t _wasted; // of which wasted (internal fragmentation)
149 size_t _unused; // Unused in last buffer
150 size_t _desired_plab_sz;// Output of filter (below), suitably trimmed and quantized
151 AdaptiveWeightedAverage
152 _filter; // Integrator with decay
153
154 void reset() {
155 _allocated = 0;
156 _wasted = 0;
|
116 }
117
118 bool contains(void* addr) {
119 return (void*)_bottom <= addr && addr < (void*)_hard_end;
120 }
121
122 // Sets the space of the buffer to be [buf, space+word_sz()).
123 virtual void set_buf(HeapWord* buf) {
124 _bottom = buf;
125 _top = _bottom;
126 _hard_end = _bottom + word_sz();
127 _end = _hard_end - AlignmentReserve;
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 virtual 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 virtual void retire();
141
142 void print() PRODUCT_RETURN;
143 };
144
145 // PLAB book-keeping.
146 class PLABStats VALUE_OBJ_CLASS_SPEC {
147 size_t _allocated; // Total allocated
148 size_t _wasted; // of which wasted (internal fragmentation)
149 size_t _unused; // Unused in last buffer
150 size_t _desired_plab_sz;// Output of filter (below), suitably trimmed and quantized
151 AdaptiveWeightedAverage
152 _filter; // Integrator with decay
153
154 void reset() {
155 _allocated = 0;
156 _wasted = 0;
|