comparison src/share/vm/gc_implementation/shared/parGCAllocBuffer.hpp @ 20215:983092f35ff7

8028710: G1 does not retire allocation buffers after reference processing work Summary: G1 does not retire allocation buffers after reference processing work when -XX:+ParallelRefProcEnabled is enabled. This causes wrong calculation of PLAB sizes, as the amount of space wasted is not updated correctly. Reviewed-by: brutisso
author tschatzl
date Mon, 21 Jul 2014 09:40:19 +0200
parents cfd4aac53239
children ee019285a52c
comparison
equal deleted inserted replaced
20214:8cc89a893545 20215:983092f35ff7
58 58
59 public: 59 public:
60 // Initializes the buffer to be empty, but with the given "word_sz". 60 // Initializes the buffer to be empty, but with the given "word_sz".
61 // Must get initialized with "set_buf" for an allocation to succeed. 61 // Must get initialized with "set_buf" for an allocation to succeed.
62 ParGCAllocBuffer(size_t word_sz); 62 ParGCAllocBuffer(size_t word_sz);
63 virtual ~ParGCAllocBuffer() {}
63 64
64 static const size_t min_size() { 65 static const size_t min_size() {
65 return ThreadLocalAllocBuffer::min_size(); 66 return ThreadLocalAllocBuffer::min_size();
66 } 67 }
67 68
111 bool contains(void* addr) { 112 bool contains(void* addr) {
112 return (void*)_bottom <= addr && addr < (void*)_hard_end; 113 return (void*)_bottom <= addr && addr < (void*)_hard_end;
113 } 114 }
114 115
115 // Sets the space of the buffer to be [buf, space+word_sz()). 116 // Sets the space of the buffer to be [buf, space+word_sz()).
116 void set_buf(HeapWord* buf) { 117 virtual void set_buf(HeapWord* buf) {
117 _bottom = buf; 118 _bottom = buf;
118 _top = _bottom; 119 _top = _bottom;
119 _hard_end = _bottom + word_sz(); 120 _hard_end = _bottom + word_sz();
120 _end = _hard_end - AlignmentReserve; 121 _end = _hard_end - AlignmentReserve;
121 assert(_end >= _top, "Negative buffer"); 122 assert(_end >= _top, "Negative buffer");
156 } 157 }
157 158
158 // Fills in the unallocated portion of the buffer with a garbage object. 159 // Fills in the unallocated portion of the buffer with a garbage object.
159 // If "end_of_gc" is TRUE, is after the last use in the GC. IF "retain" 160 // If "end_of_gc" is TRUE, is after the last use in the GC. IF "retain"
160 // is true, attempt to re-use the unused portion in the next GC. 161 // is true, attempt to re-use the unused portion in the next GC.
161 void retire(bool end_of_gc, bool retain); 162 virtual void retire(bool end_of_gc, bool retain);
162 163
163 void print() PRODUCT_RETURN; 164 void print() PRODUCT_RETURN;
164 }; 165 };
165 166
166 // PLAB stats book-keeping 167 // PLAB stats book-keeping
236 return res; 237 return res;
237 } 238 }
238 239
239 void undo_allocation(HeapWord* obj, size_t word_sz); 240 void undo_allocation(HeapWord* obj, size_t word_sz);
240 241
241 void set_buf(HeapWord* buf_start) { 242 virtual void set_buf(HeapWord* buf_start) {
242 ParGCAllocBuffer::set_buf(buf_start); 243 ParGCAllocBuffer::set_buf(buf_start);
243 _true_end = _hard_end; 244 _true_end = _hard_end;
244 _bt.set_region(MemRegion(buf_start, word_sz())); 245 _bt.set_region(MemRegion(buf_start, word_sz()));
245 _bt.initialize_threshold(); 246 _bt.initialize_threshold();
246 } 247 }
247 248
248 void retire(bool end_of_gc, bool retain); 249 virtual void retire(bool end_of_gc, bool retain);
249 250
250 MemRegion range() { 251 MemRegion range() {
251 return MemRegion(_top, _true_end); 252 return MemRegion(_top, _true_end);
252 } 253 }
253 }; 254 };