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