This commit is contained in:
Antonios Printezis 2011-10-28 13:04:10 -04:00
commit 3da2f5af5d
2 changed files with 11 additions and 11 deletions

View File

@ -50,8 +50,8 @@
int CompactibleFreeListSpace::_lockRank = Mutex::leaf + 3; int CompactibleFreeListSpace::_lockRank = Mutex::leaf + 3;
// Defaults are 0 so things will break badly if incorrectly initialized. // Defaults are 0 so things will break badly if incorrectly initialized.
int CompactibleFreeListSpace::IndexSetStart = 0; size_t CompactibleFreeListSpace::IndexSetStart = 0;
int CompactibleFreeListSpace::IndexSetStride = 0; size_t CompactibleFreeListSpace::IndexSetStride = 0;
size_t MinChunkSize = 0; size_t MinChunkSize = 0;
@ -62,7 +62,7 @@ void CompactibleFreeListSpace::set_cms_values() {
MinChunkSize = numQuanta(sizeof(FreeChunk), MinObjAlignmentInBytes) * MinObjAlignment; MinChunkSize = numQuanta(sizeof(FreeChunk), MinObjAlignmentInBytes) * MinObjAlignment;
assert(IndexSetStart == 0 && IndexSetStride == 0, "already set"); assert(IndexSetStart == 0 && IndexSetStride == 0, "already set");
IndexSetStart = (int) MinChunkSize; IndexSetStart = MinChunkSize;
IndexSetStride = MinObjAlignment; IndexSetStride = MinObjAlignment;
} }
@ -250,7 +250,7 @@ void CompactibleFreeListSpace::initializeIndexedFreeListArray() {
} }
void CompactibleFreeListSpace::resetIndexedFreeListArray() { void CompactibleFreeListSpace::resetIndexedFreeListArray() {
for (int i = 1; i < IndexSetSize; i++) { for (size_t i = 1; i < IndexSetSize; i++) {
assert(_indexedFreeList[i].size() == (size_t) i, assert(_indexedFreeList[i].size() == (size_t) i,
"Indexed free list sizes are incorrect"); "Indexed free list sizes are incorrect");
_indexedFreeList[i].reset(IndexSetSize); _indexedFreeList[i].reset(IndexSetSize);
@ -337,7 +337,7 @@ size_t CompactibleFreeListSpace::sumIndexedFreeListArrayReturnedBytes() {
size_t CompactibleFreeListSpace::totalCountInIndexedFreeLists() const { size_t CompactibleFreeListSpace::totalCountInIndexedFreeLists() const {
size_t count = 0; size_t count = 0;
for (int i = (int)MinChunkSize; i < IndexSetSize; i++) { for (size_t i = IndexSetStart; i < IndexSetSize; i++) {
debug_only( debug_only(
ssize_t total_list_count = 0; ssize_t total_list_count = 0;
for (FreeChunk* fc = _indexedFreeList[i].head(); fc != NULL; for (FreeChunk* fc = _indexedFreeList[i].head(); fc != NULL;
@ -2200,7 +2200,7 @@ void CompactibleFreeListSpace::setFLHints() {
void CompactibleFreeListSpace::clearFLCensus() { void CompactibleFreeListSpace::clearFLCensus() {
assert_locked(); assert_locked();
int i; size_t i;
for (i = IndexSetStart; i < IndexSetSize; i += IndexSetStride) { for (i = IndexSetStart; i < IndexSetSize; i += IndexSetStride) {
FreeList *fl = &_indexedFreeList[i]; FreeList *fl = &_indexedFreeList[i];
fl->set_prevSweep(fl->count()); fl->set_prevSweep(fl->count());
@ -2494,7 +2494,7 @@ void CompactibleFreeListSpace::verifyFreeLists() const {
void CompactibleFreeListSpace::verifyIndexedFreeLists() const { void CompactibleFreeListSpace::verifyIndexedFreeLists() const {
size_t i = 0; size_t i = 0;
for (; i < MinChunkSize; i++) { for (; i < IndexSetStart; i++) {
guarantee(_indexedFreeList[i].head() == NULL, "should be NULL"); guarantee(_indexedFreeList[i].head() == NULL, "should be NULL");
} }
for (; i < IndexSetSize; i++) { for (; i < IndexSetSize; i++) {
@ -2507,7 +2507,7 @@ void CompactibleFreeListSpace::verifyIndexedFreeList(size_t size) const {
FreeChunk* tail = _indexedFreeList[size].tail(); FreeChunk* tail = _indexedFreeList[size].tail();
size_t num = _indexedFreeList[size].count(); size_t num = _indexedFreeList[size].count();
size_t n = 0; size_t n = 0;
guarantee(((size >= MinChunkSize) && (size % IndexSetStride == 0)) || fc == NULL, guarantee(((size >= IndexSetStart) && (size % IndexSetStride == 0)) || fc == NULL,
"Slot should have been empty"); "Slot should have been empty");
for (; fc != NULL; fc = fc->next(), n++) { for (; fc != NULL; fc = fc->next(), n++) {
guarantee(fc->size() == size, "Size inconsistency"); guarantee(fc->size() == size, "Size inconsistency");
@ -2527,7 +2527,7 @@ void CompactibleFreeListSpace::check_free_list_consistency() const {
"else MIN_TREE_CHUNK_SIZE is wrong"); "else MIN_TREE_CHUNK_SIZE is wrong");
assert((IndexSetStride == 2 && IndexSetStart == 4) || // 32-bit assert((IndexSetStride == 2 && IndexSetStart == 4) || // 32-bit
(IndexSetStride == 1 && IndexSetStart == 3), "just checking"); // 64-bit (IndexSetStride == 1 && IndexSetStart == 3), "just checking"); // 64-bit
assert((IndexSetStride != 2) || (MinChunkSize % 2 == 0), assert((IndexSetStride != 2) || (IndexSetStart % 2 == 0),
"Some for-loops may be incorrectly initialized"); "Some for-loops may be incorrectly initialized");
assert((IndexSetStride != 2) || (IndexSetSize % 2 == 1), assert((IndexSetStride != 2) || (IndexSetSize % 2 == 1),
"For-loops that iterate over IndexSet with stride 2 may be wrong"); "For-loops that iterate over IndexSet with stride 2 may be wrong");

View File

@ -104,8 +104,8 @@ class CompactibleFreeListSpace: public CompactibleSpace {
SmallForDictionary = 257, // size < this then use _indexedFreeList SmallForDictionary = 257, // size < this then use _indexedFreeList
IndexSetSize = SmallForDictionary // keep this odd-sized IndexSetSize = SmallForDictionary // keep this odd-sized
}; };
static int IndexSetStart; static size_t IndexSetStart;
static int IndexSetStride; static size_t IndexSetStride;
private: private:
enum FitStrategyOptions { enum FitStrategyOptions {