Mercurial > hg > graal-compiler
comparison src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp @ 1753:bba76f745fe6
6910183: CMS: assert(_index < capacity(),"_index out of bounds")
Summary: Weakened a too-strong, off-by-one assert; added code to keep track of and report any overflows at appropriate level of verbosity.
Reviewed-by: jcoomes, tonyp
author | ysr |
---|---|
date | Mon, 23 Aug 2010 17:51:10 -0700 |
parents | be3f9c242c9d |
children | 8b10f48633dc |
comparison
equal
deleted
inserted
replaced
1736:b0b9d64ed9bc | 1753:bba76f745fe6 |
---|---|
250 // Survivor Chunk Array in support of parallelization of | 250 // Survivor Chunk Array in support of parallelization of |
251 // Survivor Space rescan. | 251 // Survivor Space rescan. |
252 class ChunkArray: public CHeapObj { | 252 class ChunkArray: public CHeapObj { |
253 size_t _index; | 253 size_t _index; |
254 size_t _capacity; | 254 size_t _capacity; |
255 size_t _overflows; | |
255 HeapWord** _array; // storage for array | 256 HeapWord** _array; // storage for array |
256 | 257 |
257 public: | 258 public: |
258 ChunkArray() : _index(0), _capacity(0), _array(NULL) {} | 259 ChunkArray() : _index(0), _capacity(0), _overflows(0), _array(NULL) {} |
259 ChunkArray(HeapWord** a, size_t c): | 260 ChunkArray(HeapWord** a, size_t c): |
260 _index(0), _capacity(c), _array(a) {} | 261 _index(0), _capacity(c), _overflows(0), _array(a) {} |
261 | 262 |
262 HeapWord** array() { return _array; } | 263 HeapWord** array() { return _array; } |
263 void set_array(HeapWord** a) { _array = a; } | 264 void set_array(HeapWord** a) { _array = a; } |
264 | 265 |
265 size_t capacity() { return _capacity; } | 266 size_t capacity() { return _capacity; } |
266 void set_capacity(size_t c) { _capacity = c; } | 267 void set_capacity(size_t c) { _capacity = c; } |
267 | 268 |
268 size_t end() { | 269 size_t end() { |
269 assert(_index < capacity(), "_index out of bounds"); | 270 assert(_index <= capacity(), |
271 err_msg("_index (" SIZE_FORMAT ") > _capacity (" SIZE_FORMAT "): out of bounds", | |
272 _index, _capacity)); | |
270 return _index; | 273 return _index; |
271 } // exclusive | 274 } // exclusive |
272 | 275 |
273 HeapWord* nth(size_t n) { | 276 HeapWord* nth(size_t n) { |
274 assert(n < end(), "Out of bounds access"); | 277 assert(n < end(), "Out of bounds access"); |
275 return _array[n]; | 278 return _array[n]; |
276 } | 279 } |
277 | 280 |
278 void reset() { | 281 void reset() { |
279 _index = 0; | 282 _index = 0; |
283 if (_overflows > 0 && PrintCMSStatistics > 1) { | |
284 warning("CMS: ChunkArray[" SIZE_FORMAT "] overflowed " SIZE_FORMAT " times", | |
285 _capacity, _overflows); | |
286 } | |
287 _overflows = 0; | |
280 } | 288 } |
281 | 289 |
282 void record_sample(HeapWord* p, size_t sz) { | 290 void record_sample(HeapWord* p, size_t sz) { |
283 // For now we do not do anything with the size | 291 // For now we do not do anything with the size |
284 if (_index < _capacity) { | 292 if (_index < _capacity) { |
285 _array[_index++] = p; | 293 _array[_index++] = p; |
294 } else { | |
295 ++_overflows; | |
296 assert(_index == _capacity, | |
297 err_msg("_index (" SIZE_FORMAT ") > _capacity (" SIZE_FORMAT | |
298 "): out of bounds at overflow#" SIZE_FORMAT, | |
299 _index, _capacity, _overflows)); | |
286 } | 300 } |
287 } | 301 } |
288 }; | 302 }; |
289 | 303 |
290 // | 304 // |