comparison src/share/vm/gc_implementation/shared/parGCAllocBuffer.hpp @ 6756:b2ef234911c9

7190666: G1: assert(_unused == 0) failed: Inconsistency in PLAB stats Summary: Reset the fields in ParGCAllocBuffer, that are used for accumulating values for the ResizePLAB sensors in PLABStats, to zero after flushing the values to the PLABStats fields. Flush PLABStats values only when retiring the final allocation buffers prior to disposing of a G1ParScanThreadState object, rather than when retiring every allocation buffer. Reviewed-by: jwilhelm, jmasa, ysr
author johnc
date Thu, 20 Sep 2012 09:52:56 -0700
parents aaf61e68b255
children 2e6857353b2c
comparison
equal deleted inserted replaced
6755:bc675e55b48c 6756:b2ef234911c9
50 size_t _wasted; // in HeapWord units 50 size_t _wasted; // in HeapWord units
51 char tail[32]; 51 char tail[32];
52 static size_t FillerHeaderSize; 52 static size_t FillerHeaderSize;
53 static size_t AlignmentReserve; 53 static size_t AlignmentReserve;
54 54
55 // Flush the stats supporting ergonomic sizing of PLAB's
56 // Should not be called directly
57 void flush_stats(PLABStats* stats);
58
55 public: 59 public:
56 // 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".
57 // Must get initialized with "set_buf" for an allocation to succeed. 61 // Must get initialized with "set_buf" for an allocation to succeed.
58 ParGCAllocBuffer(size_t word_sz); 62 ParGCAllocBuffer(size_t word_sz);
59 63
118 // In support of ergonomic sizing 122 // In support of ergonomic sizing
119 _allocated += word_sz(); 123 _allocated += word_sz();
120 } 124 }
121 125
122 // Flush the stats supporting ergonomic sizing of PLAB's 126 // Flush the stats supporting ergonomic sizing of PLAB's
123 void flush_stats(PLABStats* stats); 127 // and retire the current buffer.
124 void flush_stats_and_retire(PLABStats* stats, bool end_of_gc, bool retain) { 128 void flush_stats_and_retire(PLABStats* stats, bool end_of_gc, bool retain) {
125 // We flush the stats first in order to get a reading of 129 // We flush the stats first in order to get a reading of
126 // unused space in the last buffer. 130 // unused space in the last buffer.
127 if (ResizePLAB) { 131 if (ResizePLAB) {
128 flush_stats(stats); 132 flush_stats(stats);
133
134 // Since we have flushed the stats we need to clear
135 // the _allocated and _wasted fields. Not doing so
136 // will artifically inflate the values in the stats
137 // to which we add them.
138 // The next time we flush these values, we will add
139 // what we have just flushed in addition to the size
140 // of the buffers allocated between now and then.
141 _allocated = 0;
142 _wasted = 0;
129 } 143 }
130 // Retire the last allocation buffer. 144 // Retire the last allocation buffer.
131 retire(end_of_gc, retain); 145 retire(end_of_gc, retain);
132 } 146 }
133 147