Mercurial > hg > graal-jvmci-8
comparison src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp @ 4068:5a5ed80bea5b
7105163: CMS: some mentions of MinChunkSize should be IndexSetStart
Summary: Fixed the instances that were missed in the changeset for 7099817.
Reviewed-by: stefank
author | ysr |
---|---|
date | Wed, 26 Oct 2011 21:07:52 -0700 |
parents | c08412904149 |
children | bca17e38de00 |
comparison
equal
deleted
inserted
replaced
4025:dbfcbecbb2dc | 4068:5a5ed80bea5b |
---|---|
48 | 48 |
49 // highest ranked free list lock rank | 49 // highest ranked free list lock rank |
50 int CompactibleFreeListSpace::_lockRank = Mutex::leaf + 3; | 50 int CompactibleFreeListSpace::_lockRank = Mutex::leaf + 3; |
51 | 51 |
52 // Defaults are 0 so things will break badly if incorrectly initialized. | 52 // Defaults are 0 so things will break badly if incorrectly initialized. |
53 int CompactibleFreeListSpace::IndexSetStart = 0; | 53 size_t CompactibleFreeListSpace::IndexSetStart = 0; |
54 int CompactibleFreeListSpace::IndexSetStride = 0; | 54 size_t CompactibleFreeListSpace::IndexSetStride = 0; |
55 | 55 |
56 size_t MinChunkSize = 0; | 56 size_t MinChunkSize = 0; |
57 | 57 |
58 void CompactibleFreeListSpace::set_cms_values() { | 58 void CompactibleFreeListSpace::set_cms_values() { |
59 // Set CMS global values | 59 // Set CMS global values |
60 assert(MinChunkSize == 0, "already set"); | 60 assert(MinChunkSize == 0, "already set"); |
61 #define numQuanta(x,y) ((x+y-1)/y) | 61 #define numQuanta(x,y) ((x+y-1)/y) |
62 MinChunkSize = numQuanta(sizeof(FreeChunk), MinObjAlignmentInBytes) * MinObjAlignment; | 62 MinChunkSize = numQuanta(sizeof(FreeChunk), MinObjAlignmentInBytes) * MinObjAlignment; |
63 | 63 |
64 assert(IndexSetStart == 0 && IndexSetStride == 0, "already set"); | 64 assert(IndexSetStart == 0 && IndexSetStride == 0, "already set"); |
65 IndexSetStart = (int) MinChunkSize; | 65 IndexSetStart = MinChunkSize; |
66 IndexSetStride = MinObjAlignment; | 66 IndexSetStride = MinObjAlignment; |
67 } | 67 } |
68 | 68 |
69 // Constructor | 69 // Constructor |
70 CompactibleFreeListSpace::CompactibleFreeListSpace(BlockOffsetSharedArray* bs, | 70 CompactibleFreeListSpace::CompactibleFreeListSpace(BlockOffsetSharedArray* bs, |
248 assert(_indexedFreeList[i].hint() == IndexSetSize, "reset check failed"); | 248 assert(_indexedFreeList[i].hint() == IndexSetSize, "reset check failed"); |
249 } | 249 } |
250 } | 250 } |
251 | 251 |
252 void CompactibleFreeListSpace::resetIndexedFreeListArray() { | 252 void CompactibleFreeListSpace::resetIndexedFreeListArray() { |
253 for (int i = 1; i < IndexSetSize; i++) { | 253 for (size_t i = 1; i < IndexSetSize; i++) { |
254 assert(_indexedFreeList[i].size() == (size_t) i, | 254 assert(_indexedFreeList[i].size() == (size_t) i, |
255 "Indexed free list sizes are incorrect"); | 255 "Indexed free list sizes are incorrect"); |
256 _indexedFreeList[i].reset(IndexSetSize); | 256 _indexedFreeList[i].reset(IndexSetSize); |
257 assert(_indexedFreeList[i].count() == 0, "reset check failed"); | 257 assert(_indexedFreeList[i].count() == 0, "reset check failed"); |
258 assert(_indexedFreeList[i].head() == NULL, "reset check failed"); | 258 assert(_indexedFreeList[i].head() == NULL, "reset check failed"); |
335 return sum; | 335 return sum; |
336 } | 336 } |
337 | 337 |
338 size_t CompactibleFreeListSpace::totalCountInIndexedFreeLists() const { | 338 size_t CompactibleFreeListSpace::totalCountInIndexedFreeLists() const { |
339 size_t count = 0; | 339 size_t count = 0; |
340 for (int i = (int)MinChunkSize; i < IndexSetSize; i++) { | 340 for (size_t i = IndexSetStart; i < IndexSetSize; i++) { |
341 debug_only( | 341 debug_only( |
342 ssize_t total_list_count = 0; | 342 ssize_t total_list_count = 0; |
343 for (FreeChunk* fc = _indexedFreeList[i].head(); fc != NULL; | 343 for (FreeChunk* fc = _indexedFreeList[i].head(); fc != NULL; |
344 fc = fc->next()) { | 344 fc = fc->next()) { |
345 total_list_count++; | 345 total_list_count++; |
2198 } | 2198 } |
2199 } | 2199 } |
2200 | 2200 |
2201 void CompactibleFreeListSpace::clearFLCensus() { | 2201 void CompactibleFreeListSpace::clearFLCensus() { |
2202 assert_locked(); | 2202 assert_locked(); |
2203 int i; | 2203 size_t i; |
2204 for (i = IndexSetStart; i < IndexSetSize; i += IndexSetStride) { | 2204 for (i = IndexSetStart; i < IndexSetSize; i += IndexSetStride) { |
2205 FreeList *fl = &_indexedFreeList[i]; | 2205 FreeList *fl = &_indexedFreeList[i]; |
2206 fl->set_prevSweep(fl->count()); | 2206 fl->set_prevSweep(fl->count()); |
2207 fl->set_coalBirths(0); | 2207 fl->set_coalBirths(0); |
2208 fl->set_coalDeaths(0); | 2208 fl->set_coalDeaths(0); |
2492 } | 2492 } |
2493 #endif | 2493 #endif |
2494 | 2494 |
2495 void CompactibleFreeListSpace::verifyIndexedFreeLists() const { | 2495 void CompactibleFreeListSpace::verifyIndexedFreeLists() const { |
2496 size_t i = 0; | 2496 size_t i = 0; |
2497 for (; i < MinChunkSize; i++) { | 2497 for (; i < IndexSetStart; i++) { |
2498 guarantee(_indexedFreeList[i].head() == NULL, "should be NULL"); | 2498 guarantee(_indexedFreeList[i].head() == NULL, "should be NULL"); |
2499 } | 2499 } |
2500 for (; i < IndexSetSize; i++) { | 2500 for (; i < IndexSetSize; i++) { |
2501 verifyIndexedFreeList(i); | 2501 verifyIndexedFreeList(i); |
2502 } | 2502 } |
2505 void CompactibleFreeListSpace::verifyIndexedFreeList(size_t size) const { | 2505 void CompactibleFreeListSpace::verifyIndexedFreeList(size_t size) const { |
2506 FreeChunk* fc = _indexedFreeList[size].head(); | 2506 FreeChunk* fc = _indexedFreeList[size].head(); |
2507 FreeChunk* tail = _indexedFreeList[size].tail(); | 2507 FreeChunk* tail = _indexedFreeList[size].tail(); |
2508 size_t num = _indexedFreeList[size].count(); | 2508 size_t num = _indexedFreeList[size].count(); |
2509 size_t n = 0; | 2509 size_t n = 0; |
2510 guarantee(((size >= MinChunkSize) && (size % IndexSetStride == 0)) || fc == NULL, | 2510 guarantee(((size >= IndexSetStart) && (size % IndexSetStride == 0)) || fc == NULL, |
2511 "Slot should have been empty"); | 2511 "Slot should have been empty"); |
2512 for (; fc != NULL; fc = fc->next(), n++) { | 2512 for (; fc != NULL; fc = fc->next(), n++) { |
2513 guarantee(fc->size() == size, "Size inconsistency"); | 2513 guarantee(fc->size() == size, "Size inconsistency"); |
2514 guarantee(fc->isFree(), "!free?"); | 2514 guarantee(fc->isFree(), "!free?"); |
2515 guarantee(fc->next() == NULL || fc->next()->prev() == fc, "Broken list"); | 2515 guarantee(fc->next() == NULL || fc->next()->prev() == fc, "Broken list"); |
2525 " linear allocation buffers"); | 2525 " linear allocation buffers"); |
2526 assert(MIN_TREE_CHUNK_SIZE*HeapWordSize == sizeof(TreeChunk), | 2526 assert(MIN_TREE_CHUNK_SIZE*HeapWordSize == sizeof(TreeChunk), |
2527 "else MIN_TREE_CHUNK_SIZE is wrong"); | 2527 "else MIN_TREE_CHUNK_SIZE is wrong"); |
2528 assert((IndexSetStride == 2 && IndexSetStart == 4) || // 32-bit | 2528 assert((IndexSetStride == 2 && IndexSetStart == 4) || // 32-bit |
2529 (IndexSetStride == 1 && IndexSetStart == 3), "just checking"); // 64-bit | 2529 (IndexSetStride == 1 && IndexSetStart == 3), "just checking"); // 64-bit |
2530 assert((IndexSetStride != 2) || (MinChunkSize % 2 == 0), | 2530 assert((IndexSetStride != 2) || (IndexSetStart % 2 == 0), |
2531 "Some for-loops may be incorrectly initialized"); | 2531 "Some for-loops may be incorrectly initialized"); |
2532 assert((IndexSetStride != 2) || (IndexSetSize % 2 == 1), | 2532 assert((IndexSetStride != 2) || (IndexSetSize % 2 == 1), |
2533 "For-loops that iterate over IndexSet with stride 2 may be wrong"); | 2533 "For-loops that iterate over IndexSet with stride 2 may be wrong"); |
2534 } | 2534 } |
2535 #endif | 2535 #endif |