Merge
This commit is contained in:
commit
9d991480e9
@ -119,7 +119,7 @@ CompactibleFreeListSpace::CompactibleFreeListSpace(BlockOffsetSharedArray* bs,
|
||||
// moved to its new location before the klass is moved.
|
||||
// Set the _refillSize for the linear allocation blocks
|
||||
if (!use_adaptive_freelists) {
|
||||
FreeChunk* fc = _dictionary->getChunk(mr.word_size());
|
||||
FreeChunk* fc = _dictionary->get_chunk(mr.word_size());
|
||||
// The small linAB initially has all the space and will allocate
|
||||
// a chunk of any size.
|
||||
HeapWord* addr = (HeapWord*) fc;
|
||||
@ -275,12 +275,12 @@ void CompactibleFreeListSpace::reset(MemRegion mr) {
|
||||
assert(mr.word_size() >= MinChunkSize, "Chunk size is too small");
|
||||
_bt.single_block(mr.start(), mr.word_size());
|
||||
FreeChunk* fc = (FreeChunk*) mr.start();
|
||||
fc->setSize(mr.word_size());
|
||||
fc->set_size(mr.word_size());
|
||||
if (mr.word_size() >= IndexSetSize ) {
|
||||
returnChunkToDictionary(fc);
|
||||
} else {
|
||||
_bt.verify_not_unallocated((HeapWord*)fc, fc->size());
|
||||
_indexedFreeList[mr.word_size()].returnChunkAtHead(fc);
|
||||
_indexedFreeList[mr.word_size()].return_chunk_at_head(fc);
|
||||
}
|
||||
}
|
||||
_promoInfo.reset();
|
||||
@ -298,7 +298,7 @@ void CompactibleFreeListSpace::reset_after_compaction() {
|
||||
} else {
|
||||
// Place as much of mr in the linAB as we can get,
|
||||
// provided it was big enough to go into the dictionary.
|
||||
FreeChunk* fc = dictionary()->findLargestDict();
|
||||
FreeChunk* fc = dictionary()->find_largest_dict();
|
||||
if (fc != NULL) {
|
||||
assert(fc->size() == mr.word_size(),
|
||||
"Why was the chunk broken up?");
|
||||
@ -325,14 +325,14 @@ FreeChunk* CompactibleFreeListSpace::find_chunk_at_end() {
|
||||
#ifndef PRODUCT
|
||||
void CompactibleFreeListSpace::initializeIndexedFreeListArrayReturnedBytes() {
|
||||
for (size_t i = IndexSetStart; i < IndexSetSize; i += IndexSetStride) {
|
||||
_indexedFreeList[i].allocation_stats()->set_returnedBytes(0);
|
||||
_indexedFreeList[i].allocation_stats()->set_returned_bytes(0);
|
||||
}
|
||||
}
|
||||
|
||||
size_t CompactibleFreeListSpace::sumIndexedFreeListArrayReturnedBytes() {
|
||||
size_t sum = 0;
|
||||
for (size_t i = IndexSetStart; i < IndexSetSize; i += IndexSetStride) {
|
||||
sum += _indexedFreeList[i].allocation_stats()->returnedBytes();
|
||||
sum += _indexedFreeList[i].allocation_stats()->returned_bytes();
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
@ -356,7 +356,7 @@ size_t CompactibleFreeListSpace::totalCountInIndexedFreeLists() const {
|
||||
|
||||
size_t CompactibleFreeListSpace::totalCount() {
|
||||
size_t num = totalCountInIndexedFreeLists();
|
||||
num += dictionary()->totalCount();
|
||||
num += dictionary()->total_count();
|
||||
if (_smallLinearAllocBlock._word_size != 0) {
|
||||
num++;
|
||||
}
|
||||
@ -366,7 +366,7 @@ size_t CompactibleFreeListSpace::totalCount() {
|
||||
|
||||
bool CompactibleFreeListSpace::is_free_block(const HeapWord* p) const {
|
||||
FreeChunk* fc = (FreeChunk*) p;
|
||||
return fc->isFree();
|
||||
return fc->is_free();
|
||||
}
|
||||
|
||||
size_t CompactibleFreeListSpace::used() const {
|
||||
@ -393,7 +393,7 @@ size_t CompactibleFreeListSpace::free() const {
|
||||
// that supports jvmstat, and you are apt to see the values
|
||||
// flicker in such cases.
|
||||
assert(_dictionary != NULL, "No _dictionary?");
|
||||
return (_dictionary->totalChunkSize(DEBUG_ONLY(freelistLock())) +
|
||||
return (_dictionary->total_chunk_size(DEBUG_ONLY(freelistLock())) +
|
||||
totalSizeInIndexedFreeLists() +
|
||||
_smallLinearAllocBlock._word_size) * HeapWordSize;
|
||||
}
|
||||
@ -401,7 +401,7 @@ size_t CompactibleFreeListSpace::free() const {
|
||||
size_t CompactibleFreeListSpace::max_alloc_in_words() const {
|
||||
assert(_dictionary != NULL, "No _dictionary?");
|
||||
assert_locked();
|
||||
size_t res = _dictionary->maxChunkSize();
|
||||
size_t res = _dictionary->max_chunk_size();
|
||||
res = MAX2(res, MIN2(_smallLinearAllocBlock._word_size,
|
||||
(size_t) SmallForLinearAlloc - 1));
|
||||
// XXX the following could potentially be pretty slow;
|
||||
@ -469,7 +469,7 @@ const {
|
||||
|
||||
void CompactibleFreeListSpace::print_dictionary_free_lists(outputStream* st)
|
||||
const {
|
||||
_dictionary->reportStatistics();
|
||||
_dictionary->report_statistics();
|
||||
st->print_cr("Layout of Freelists in Tree");
|
||||
st->print_cr("---------------------------");
|
||||
_dictionary->print_free_lists(st);
|
||||
@ -547,12 +547,12 @@ void CompactibleFreeListSpace::dump_at_safepoint_with_locks(CMSCollector* c,
|
||||
void CompactibleFreeListSpace::reportFreeListStatistics() const {
|
||||
assert_lock_strong(&_freelistLock);
|
||||
assert(PrintFLSStatistics != 0, "Reporting error");
|
||||
_dictionary->reportStatistics();
|
||||
_dictionary->report_statistics();
|
||||
if (PrintFLSStatistics > 1) {
|
||||
reportIndexedFreeListStatistics();
|
||||
size_t totalSize = totalSizeInIndexedFreeLists() +
|
||||
_dictionary->totalChunkSize(DEBUG_ONLY(freelistLock()));
|
||||
gclog_or_tty->print(" free=%ld frag=%1.4f\n", totalSize, flsFrag());
|
||||
size_t total_size = totalSizeInIndexedFreeLists() +
|
||||
_dictionary->total_chunk_size(DEBUG_ONLY(freelistLock()));
|
||||
gclog_or_tty->print(" free=%ld frag=%1.4f\n", total_size, flsFrag());
|
||||
}
|
||||
}
|
||||
|
||||
@ -560,13 +560,13 @@ void CompactibleFreeListSpace::reportIndexedFreeListStatistics() const {
|
||||
assert_lock_strong(&_freelistLock);
|
||||
gclog_or_tty->print("Statistics for IndexedFreeLists:\n"
|
||||
"--------------------------------\n");
|
||||
size_t totalSize = totalSizeInIndexedFreeLists();
|
||||
size_t freeBlocks = numFreeBlocksInIndexedFreeLists();
|
||||
gclog_or_tty->print("Total Free Space: %d\n", totalSize);
|
||||
size_t total_size = totalSizeInIndexedFreeLists();
|
||||
size_t free_blocks = numFreeBlocksInIndexedFreeLists();
|
||||
gclog_or_tty->print("Total Free Space: %d\n", total_size);
|
||||
gclog_or_tty->print("Max Chunk Size: %d\n", maxChunkSizeInIndexedFreeLists());
|
||||
gclog_or_tty->print("Number of Blocks: %d\n", freeBlocks);
|
||||
if (freeBlocks != 0) {
|
||||
gclog_or_tty->print("Av. Block Size: %d\n", totalSize/freeBlocks);
|
||||
gclog_or_tty->print("Number of Blocks: %d\n", free_blocks);
|
||||
if (free_blocks != 0) {
|
||||
gclog_or_tty->print("Av. Block Size: %d\n", total_size/free_blocks);
|
||||
}
|
||||
}
|
||||
|
||||
@ -913,7 +913,7 @@ CompactibleFreeListSpace::object_iterate_careful(ObjectClosureCareful* cl) {
|
||||
for (addr = bottom(), last = end();
|
||||
addr < last; addr += size) {
|
||||
FreeChunk* fc = (FreeChunk*)addr;
|
||||
if (fc->isFree()) {
|
||||
if (fc->is_free()) {
|
||||
// Since we hold the free list lock, which protects direct
|
||||
// allocation in this generation by mutators, a free object
|
||||
// will remain free throughout this iteration code.
|
||||
@ -955,7 +955,7 @@ CompactibleFreeListSpace::object_iterate_careful_m(MemRegion mr,
|
||||
for (addr = block_start_careful(mr.start()), end = mr.end();
|
||||
addr < end; addr += size) {
|
||||
FreeChunk* fc = (FreeChunk*)addr;
|
||||
if (fc->isFree()) {
|
||||
if (fc->is_free()) {
|
||||
// Since we hold the free list lock, which protects direct
|
||||
// allocation in this generation by mutators, a free object
|
||||
// will remain free throughout this iteration code.
|
||||
@ -1071,7 +1071,7 @@ size_t CompactibleFreeListSpace::block_size_nopar(const HeapWord* p) const {
|
||||
NOT_PRODUCT(verify_objects_initialized());
|
||||
assert(MemRegion(bottom(), end()).contains(p), "p not in space");
|
||||
FreeChunk* fc = (FreeChunk*)p;
|
||||
if (fc->isFree()) {
|
||||
if (fc->is_free()) {
|
||||
return fc->size();
|
||||
} else {
|
||||
// Ignore mark word because this may be a recently promoted
|
||||
@ -1162,7 +1162,7 @@ bool CompactibleFreeListSpace::block_is_obj_nopar(const HeapWord* p) const {
|
||||
FreeChunk* fc = (FreeChunk*)p;
|
||||
assert(is_in_reserved(p), "Should be in space");
|
||||
assert(_bt.block_start(p) == p, "Should be a block boundary");
|
||||
if (!fc->isFree()) {
|
||||
if (!fc->is_free()) {
|
||||
// Ignore mark word because it may have been used to
|
||||
// chain together promoted objects (the last one
|
||||
// would have a null value).
|
||||
@ -1224,7 +1224,7 @@ HeapWord* CompactibleFreeListSpace::allocate(size_t size) {
|
||||
|
||||
FreeChunk* fc = (FreeChunk*)res;
|
||||
fc->markNotFree();
|
||||
assert(!fc->isFree(), "shouldn't be marked free");
|
||||
assert(!fc->is_free(), "shouldn't be marked free");
|
||||
assert(oop(fc)->klass_or_null() == NULL, "should look uninitialized");
|
||||
// Verify that the block offset table shows this to
|
||||
// be a single block, but not one which is unallocated.
|
||||
@ -1336,7 +1336,7 @@ FreeChunk* CompactibleFreeListSpace::getChunkFromGreater(size_t numWords) {
|
||||
FreeList<FreeChunk>* fl = &_indexedFreeList[i];
|
||||
if (fl->head()) {
|
||||
ret = getFromListGreater(fl, numWords);
|
||||
assert(ret == NULL || ret->isFree(), "Should be returning a free chunk");
|
||||
assert(ret == NULL || ret->is_free(), "Should be returning a free chunk");
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@ -1347,7 +1347,7 @@ FreeChunk* CompactibleFreeListSpace::getChunkFromGreater(size_t numWords) {
|
||||
/* Try to get a chunk that satisfies request, while avoiding
|
||||
fragmentation that can't be handled. */
|
||||
{
|
||||
ret = dictionary()->getChunk(currSize);
|
||||
ret = dictionary()->get_chunk(currSize);
|
||||
if (ret != NULL) {
|
||||
assert(ret->size() - numWords >= MinChunkSize,
|
||||
"Chunk is too small");
|
||||
@ -1355,10 +1355,10 @@ FreeChunk* CompactibleFreeListSpace::getChunkFromGreater(size_t numWords) {
|
||||
/* Carve returned chunk. */
|
||||
(void) splitChunkAndReturnRemainder(ret, numWords);
|
||||
/* Label this as no longer a free chunk. */
|
||||
assert(ret->isFree(), "This chunk should be free");
|
||||
ret->linkPrev(NULL);
|
||||
assert(ret->is_free(), "This chunk should be free");
|
||||
ret->link_prev(NULL);
|
||||
}
|
||||
assert(ret == NULL || ret->isFree(), "Should be returning a free chunk");
|
||||
assert(ret == NULL || ret->is_free(), "Should be returning a free chunk");
|
||||
return ret;
|
||||
}
|
||||
ShouldNotReachHere();
|
||||
@ -1366,7 +1366,7 @@ FreeChunk* CompactibleFreeListSpace::getChunkFromGreater(size_t numWords) {
|
||||
|
||||
bool CompactibleFreeListSpace::verifyChunkInIndexedFreeLists(FreeChunk* fc) const {
|
||||
assert(fc->size() < IndexSetSize, "Size of chunk is too large");
|
||||
return _indexedFreeList[fc->size()].verifyChunkInFreeLists(fc);
|
||||
return _indexedFreeList[fc->size()].verify_chunk_in_free_list(fc);
|
||||
}
|
||||
|
||||
bool CompactibleFreeListSpace::verify_chunk_is_linear_alloc_block(FreeChunk* fc) const {
|
||||
@ -1380,13 +1380,13 @@ bool CompactibleFreeListSpace::verify_chunk_is_linear_alloc_block(FreeChunk* fc)
|
||||
// Check if the purported free chunk is present either as a linear
|
||||
// allocation block, the size-indexed table of (smaller) free blocks,
|
||||
// or the larger free blocks kept in the binary tree dictionary.
|
||||
bool CompactibleFreeListSpace::verifyChunkInFreeLists(FreeChunk* fc) const {
|
||||
bool CompactibleFreeListSpace::verify_chunk_in_free_list(FreeChunk* fc) const {
|
||||
if (verify_chunk_is_linear_alloc_block(fc)) {
|
||||
return true;
|
||||
} else if (fc->size() < IndexSetSize) {
|
||||
return verifyChunkInIndexedFreeLists(fc);
|
||||
} else {
|
||||
return dictionary()->verifyChunkInFreeLists(fc);
|
||||
return dictionary()->verify_chunk_in_free_list(fc);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1414,7 +1414,7 @@ FreeChunk* CompactibleFreeListSpace::allocateScratch(size_t size) {
|
||||
}
|
||||
if (fc != NULL) {
|
||||
fc->dontCoalesce();
|
||||
assert(fc->isFree(), "Should be free, but not coalescable");
|
||||
assert(fc->is_free(), "Should be free, but not coalescable");
|
||||
// Verify that the block offset table shows this to
|
||||
// be a single block, but not one which is unallocated.
|
||||
_bt.verify_single_block((HeapWord*)fc, fc->size());
|
||||
@ -1494,7 +1494,7 @@ CompactibleFreeListSpace::getChunkFromLinearAllocBlock(LinearAllocBlock *blk,
|
||||
}
|
||||
// Return the chunk that isn't big enough, and then refill below.
|
||||
addChunkToFreeLists(blk->_ptr, sz);
|
||||
splitBirth(sz);
|
||||
split_birth(sz);
|
||||
// Don't keep statistics on adding back chunk from a LinAB.
|
||||
} else {
|
||||
// A refilled block would not satisfy the request.
|
||||
@ -1506,14 +1506,14 @@ CompactibleFreeListSpace::getChunkFromLinearAllocBlock(LinearAllocBlock *blk,
|
||||
assert(blk->_ptr == NULL || blk->_word_size >= size + MinChunkSize,
|
||||
"block was replenished");
|
||||
if (res != NULL) {
|
||||
splitBirth(size);
|
||||
split_birth(size);
|
||||
repairLinearAllocBlock(blk);
|
||||
} else if (blk->_ptr != NULL) {
|
||||
res = blk->_ptr;
|
||||
size_t blk_size = blk->_word_size;
|
||||
blk->_word_size -= size;
|
||||
blk->_ptr += size;
|
||||
splitBirth(size);
|
||||
split_birth(size);
|
||||
repairLinearAllocBlock(blk);
|
||||
// Update BOT last so that other (parallel) GC threads see a consistent
|
||||
// view of the BOT and free blocks.
|
||||
@ -1542,7 +1542,7 @@ HeapWord* CompactibleFreeListSpace::getChunkFromLinearAllocBlockRemainder(
|
||||
size_t blk_size = blk->_word_size;
|
||||
blk->_word_size -= size;
|
||||
blk->_ptr += size;
|
||||
splitBirth(size);
|
||||
split_birth(size);
|
||||
repairLinearAllocBlock(blk);
|
||||
// Update BOT last so that other (parallel) GC threads see a consistent
|
||||
// view of the BOT and free blocks.
|
||||
@ -1559,7 +1559,7 @@ CompactibleFreeListSpace::getChunkFromIndexedFreeList(size_t size) {
|
||||
assert_locked();
|
||||
assert(size < SmallForDictionary, "just checking");
|
||||
FreeChunk* res;
|
||||
res = _indexedFreeList[size].getChunkAtHead();
|
||||
res = _indexedFreeList[size].get_chunk_at_head();
|
||||
if (res == NULL) {
|
||||
res = getChunkFromIndexedFreeListHelper(size);
|
||||
}
|
||||
@ -1593,7 +1593,7 @@ CompactibleFreeListSpace::getChunkFromIndexedFreeListHelper(size_t size,
|
||||
// Do not replenish from an underpopulated size.
|
||||
if (_indexedFreeList[replenish_size].surplus() > 0 &&
|
||||
_indexedFreeList[replenish_size].head() != NULL) {
|
||||
newFc = _indexedFreeList[replenish_size].getChunkAtHead();
|
||||
newFc = _indexedFreeList[replenish_size].get_chunk_at_head();
|
||||
} else if (bestFitFirst()) {
|
||||
newFc = bestFitSmall(replenish_size);
|
||||
}
|
||||
@ -1626,13 +1626,13 @@ CompactibleFreeListSpace::getChunkFromIndexedFreeListHelper(size_t size,
|
||||
i < (num_blk - 1);
|
||||
curFc = nextFc, nextFc = (FreeChunk*)((HeapWord*)nextFc + size),
|
||||
i++) {
|
||||
curFc->setSize(size);
|
||||
curFc->set_size(size);
|
||||
// Don't record this as a return in order to try and
|
||||
// determine the "returns" from a GC.
|
||||
_bt.verify_not_unallocated((HeapWord*) fc, size);
|
||||
_indexedFreeList[size].returnChunkAtTail(curFc, false);
|
||||
_indexedFreeList[size].return_chunk_at_tail(curFc, false);
|
||||
_bt.mark_block((HeapWord*)curFc, size);
|
||||
splitBirth(size);
|
||||
split_birth(size);
|
||||
// Don't record the initial population of the indexed list
|
||||
// as a split birth.
|
||||
}
|
||||
@ -1640,9 +1640,9 @@ CompactibleFreeListSpace::getChunkFromIndexedFreeListHelper(size_t size,
|
||||
// check that the arithmetic was OK above
|
||||
assert((HeapWord*)nextFc == (HeapWord*)newFc + num_blk*size,
|
||||
"inconsistency in carving newFc");
|
||||
curFc->setSize(size);
|
||||
curFc->set_size(size);
|
||||
_bt.mark_block((HeapWord*)curFc, size);
|
||||
splitBirth(size);
|
||||
split_birth(size);
|
||||
fc = curFc;
|
||||
} else {
|
||||
// Return entire block to caller
|
||||
@ -1655,14 +1655,14 @@ CompactibleFreeListSpace::getChunkFromIndexedFreeListHelper(size_t size,
|
||||
// replenish the indexed free list.
|
||||
fc = getChunkFromDictionaryExact(size);
|
||||
}
|
||||
// assert(fc == NULL || fc->isFree(), "Should be returning a free chunk");
|
||||
// assert(fc == NULL || fc->is_free(), "Should be returning a free chunk");
|
||||
return fc;
|
||||
}
|
||||
|
||||
FreeChunk*
|
||||
CompactibleFreeListSpace::getChunkFromDictionary(size_t size) {
|
||||
assert_locked();
|
||||
FreeChunk* fc = _dictionary->getChunk(size);
|
||||
FreeChunk* fc = _dictionary->get_chunk(size);
|
||||
if (fc == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
@ -1679,7 +1679,7 @@ CompactibleFreeListSpace::getChunkFromDictionary(size_t size) {
|
||||
FreeChunk*
|
||||
CompactibleFreeListSpace::getChunkFromDictionaryExact(size_t size) {
|
||||
assert_locked();
|
||||
FreeChunk* fc = _dictionary->getChunk(size);
|
||||
FreeChunk* fc = _dictionary->get_chunk(size);
|
||||
if (fc == NULL) {
|
||||
return fc;
|
||||
}
|
||||
@ -1688,11 +1688,11 @@ CompactibleFreeListSpace::getChunkFromDictionaryExact(size_t size) {
|
||||
_bt.verify_single_block((HeapWord*)fc, size);
|
||||
return fc;
|
||||
}
|
||||
assert(fc->size() > size, "getChunk() guarantee");
|
||||
assert(fc->size() > size, "get_chunk() guarantee");
|
||||
if (fc->size() < size + MinChunkSize) {
|
||||
// Return the chunk to the dictionary and go get a bigger one.
|
||||
returnChunkToDictionary(fc);
|
||||
fc = _dictionary->getChunk(size + MinChunkSize);
|
||||
fc = _dictionary->get_chunk(size + MinChunkSize);
|
||||
if (fc == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
@ -1713,7 +1713,7 @@ CompactibleFreeListSpace::returnChunkToDictionary(FreeChunk* chunk) {
|
||||
_bt.verify_single_block((HeapWord*)chunk, size);
|
||||
// adjust _unallocated_block downward, as necessary
|
||||
_bt.freed((HeapWord*)chunk, size);
|
||||
_dictionary->returnChunk(chunk);
|
||||
_dictionary->return_chunk(chunk);
|
||||
#ifndef PRODUCT
|
||||
if (CMSCollector::abstract_state() != CMSCollector::Sweeping) {
|
||||
TreeChunk<FreeChunk>::as_TreeChunk(chunk)->list()->verify_stats();
|
||||
@ -1728,9 +1728,9 @@ CompactibleFreeListSpace::returnChunkToFreeList(FreeChunk* fc) {
|
||||
_bt.verify_single_block((HeapWord*) fc, size);
|
||||
_bt.verify_not_unallocated((HeapWord*) fc, size);
|
||||
if (_adaptive_freelists) {
|
||||
_indexedFreeList[size].returnChunkAtTail(fc);
|
||||
_indexedFreeList[size].return_chunk_at_tail(fc);
|
||||
} else {
|
||||
_indexedFreeList[size].returnChunkAtHead(fc);
|
||||
_indexedFreeList[size].return_chunk_at_head(fc);
|
||||
}
|
||||
#ifndef PRODUCT
|
||||
if (CMSCollector::abstract_state() != CMSCollector::Sweeping) {
|
||||
@ -1758,7 +1758,7 @@ CompactibleFreeListSpace::addChunkToFreeListsAtEndRecordingStats(
|
||||
FreeChunk* ec;
|
||||
{
|
||||
MutexLockerEx x(lock, Mutex::_no_safepoint_check_flag);
|
||||
ec = dictionary()->findLargestDict(); // get largest block
|
||||
ec = dictionary()->find_largest_dict(); // get largest block
|
||||
if (ec != NULL && ec->end() == chunk) {
|
||||
// It's a coterminal block - we can coalesce.
|
||||
size_t old_size = ec->size();
|
||||
@ -1769,7 +1769,7 @@ CompactibleFreeListSpace::addChunkToFreeListsAtEndRecordingStats(
|
||||
ec = (FreeChunk*)chunk;
|
||||
}
|
||||
}
|
||||
ec->setSize(size);
|
||||
ec->set_size(size);
|
||||
debug_only(ec->mangleFreed(size));
|
||||
if (size < SmallForDictionary) {
|
||||
lock = _indexedFreeListParLocks[size];
|
||||
@ -1792,7 +1792,7 @@ CompactibleFreeListSpace::addChunkToFreeLists(HeapWord* chunk,
|
||||
_bt.verify_single_block(chunk, size);
|
||||
|
||||
FreeChunk* fc = (FreeChunk*) chunk;
|
||||
fc->setSize(size);
|
||||
fc->set_size(size);
|
||||
debug_only(fc->mangleFreed(size));
|
||||
if (size < SmallForDictionary) {
|
||||
returnChunkToFreeList(fc);
|
||||
@ -1835,7 +1835,7 @@ CompactibleFreeListSpace::removeChunkFromDictionary(FreeChunk* fc) {
|
||||
assert_locked();
|
||||
assert(fc != NULL, "null chunk");
|
||||
_bt.verify_single_block((HeapWord*)fc, size);
|
||||
_dictionary->removeChunk(fc);
|
||||
_dictionary->remove_chunk(fc);
|
||||
// adjust _unallocated_block upward, as necessary
|
||||
_bt.allocated((HeapWord*)fc, size);
|
||||
}
|
||||
@ -1850,7 +1850,7 @@ CompactibleFreeListSpace::removeChunkFromIndexedFreeList(FreeChunk* fc) {
|
||||
verifyIndexedFreeList(size);
|
||||
}
|
||||
)
|
||||
_indexedFreeList[size].removeChunk(fc);
|
||||
_indexedFreeList[size].remove_chunk(fc);
|
||||
NOT_PRODUCT(
|
||||
if (FLSVerifyIndexTable) {
|
||||
verifyIndexedFreeList(size);
|
||||
@ -1874,7 +1874,7 @@ FreeChunk* CompactibleFreeListSpace::bestFitSmall(size_t numWords) {
|
||||
// and split out a free chunk which is returned.
|
||||
_indexedFreeList[start].set_hint(hint);
|
||||
FreeChunk* res = getFromListGreater(fl, numWords);
|
||||
assert(res == NULL || res->isFree(),
|
||||
assert(res == NULL || res->is_free(),
|
||||
"Should be returning a free chunk");
|
||||
return res;
|
||||
}
|
||||
@ -1896,13 +1896,13 @@ FreeChunk* CompactibleFreeListSpace::getFromListGreater(FreeList<FreeChunk>* fl,
|
||||
assert(oldNumWords >= numWords + MinChunkSize,
|
||||
"Size of chunks in the list is too small");
|
||||
|
||||
fl->removeChunk(curr);
|
||||
fl->remove_chunk(curr);
|
||||
// recorded indirectly by splitChunkAndReturnRemainder -
|
||||
// smallSplit(oldNumWords, numWords);
|
||||
FreeChunk* new_chunk = splitChunkAndReturnRemainder(curr, numWords);
|
||||
// Does anything have to be done for the remainder in terms of
|
||||
// fixing the card table?
|
||||
assert(new_chunk == NULL || new_chunk->isFree(),
|
||||
assert(new_chunk == NULL || new_chunk->is_free(),
|
||||
"Should be returning a free chunk");
|
||||
return new_chunk;
|
||||
}
|
||||
@ -1920,13 +1920,13 @@ CompactibleFreeListSpace::splitChunkAndReturnRemainder(FreeChunk* chunk,
|
||||
assert(rem_size >= MinChunkSize, "Free chunk smaller than minimum");
|
||||
FreeChunk* ffc = (FreeChunk*)((HeapWord*)chunk + new_size);
|
||||
assert(is_aligned(ffc), "alignment problem");
|
||||
ffc->setSize(rem_size);
|
||||
ffc->linkNext(NULL);
|
||||
ffc->linkPrev(NULL); // Mark as a free block for other (parallel) GC threads.
|
||||
ffc->set_size(rem_size);
|
||||
ffc->link_next(NULL);
|
||||
ffc->link_prev(NULL); // Mark as a free block for other (parallel) GC threads.
|
||||
// Above must occur before BOT is updated below.
|
||||
// adjust block offset table
|
||||
OrderAccess::storestore();
|
||||
assert(chunk->isFree() && ffc->isFree(), "Error");
|
||||
assert(chunk->is_free() && ffc->is_free(), "Error");
|
||||
_bt.split_block((HeapWord*)chunk, chunk->size(), new_size);
|
||||
if (rem_size < SmallForDictionary) {
|
||||
bool is_par = (SharedHeap::heap()->n_par_threads() > 0);
|
||||
@ -1941,7 +1941,7 @@ CompactibleFreeListSpace::splitChunkAndReturnRemainder(FreeChunk* chunk,
|
||||
returnChunkToDictionary(ffc);
|
||||
split(size ,rem_size);
|
||||
}
|
||||
chunk->setSize(new_size);
|
||||
chunk->set_size(new_size);
|
||||
return chunk;
|
||||
}
|
||||
|
||||
@ -2048,10 +2048,10 @@ void CompactibleFreeListSpace::repairLinearAllocBlock(LinearAllocBlock* blk) {
|
||||
assert(blk->_word_size != 0 && blk->_word_size >= MinChunkSize,
|
||||
"Minimum block size requirement");
|
||||
FreeChunk* fc = (FreeChunk*)(blk->_ptr);
|
||||
fc->setSize(blk->_word_size);
|
||||
fc->linkPrev(NULL); // mark as free
|
||||
fc->set_size(blk->_word_size);
|
||||
fc->link_prev(NULL); // mark as free
|
||||
fc->dontCoalesce();
|
||||
assert(fc->isFree(), "just marked it free");
|
||||
assert(fc->is_free(), "just marked it free");
|
||||
assert(fc->cantCoalesce(), "just marked it uncoalescable");
|
||||
}
|
||||
}
|
||||
@ -2151,7 +2151,7 @@ double CompactibleFreeListSpace::flsFrag() const {
|
||||
}
|
||||
|
||||
double totFree = itabFree +
|
||||
_dictionary->totalChunkSize(DEBUG_ONLY(freelistLock()));
|
||||
_dictionary->total_chunk_size(DEBUG_ONLY(freelistLock()));
|
||||
if (totFree > 0) {
|
||||
frag = ((frag + _dictionary->sum_of_squared_block_sizes()) /
|
||||
(totFree * totFree));
|
||||
@ -2174,11 +2174,11 @@ void CompactibleFreeListSpace::beginSweepFLCensus(
|
||||
gclog_or_tty->print("size[%d] : ", i);
|
||||
}
|
||||
fl->compute_desired(inter_sweep_current, inter_sweep_estimate, intra_sweep_estimate);
|
||||
fl->set_coalDesired((ssize_t)((double)fl->desired() * CMSSmallCoalSurplusPercent));
|
||||
fl->set_beforeSweep(fl->count());
|
||||
fl->set_bfrSurp(fl->surplus());
|
||||
fl->set_coal_desired((ssize_t)((double)fl->desired() * CMSSmallCoalSurplusPercent));
|
||||
fl->set_before_sweep(fl->count());
|
||||
fl->set_bfr_surp(fl->surplus());
|
||||
}
|
||||
_dictionary->beginSweepDictCensus(CMSLargeCoalSurplusPercent,
|
||||
_dictionary->begin_sweep_dict_census(CMSLargeCoalSurplusPercent,
|
||||
inter_sweep_current,
|
||||
inter_sweep_estimate,
|
||||
intra_sweep_estimate);
|
||||
@ -2212,17 +2212,17 @@ void CompactibleFreeListSpace::clearFLCensus() {
|
||||
size_t i;
|
||||
for (i = IndexSetStart; i < IndexSetSize; i += IndexSetStride) {
|
||||
FreeList<FreeChunk> *fl = &_indexedFreeList[i];
|
||||
fl->set_prevSweep(fl->count());
|
||||
fl->set_coalBirths(0);
|
||||
fl->set_coalDeaths(0);
|
||||
fl->set_splitBirths(0);
|
||||
fl->set_splitDeaths(0);
|
||||
fl->set_prev_sweep(fl->count());
|
||||
fl->set_coal_births(0);
|
||||
fl->set_coal_deaths(0);
|
||||
fl->set_split_births(0);
|
||||
fl->set_split_deaths(0);
|
||||
}
|
||||
}
|
||||
|
||||
void CompactibleFreeListSpace::endSweepFLCensus(size_t sweep_count) {
|
||||
if (PrintFLSStatistics > 0) {
|
||||
HeapWord* largestAddr = (HeapWord*) dictionary()->findLargestDict();
|
||||
HeapWord* largestAddr = (HeapWord*) dictionary()->find_largest_dict();
|
||||
gclog_or_tty->print_cr("CMS: Large block " PTR_FORMAT,
|
||||
largestAddr);
|
||||
}
|
||||
@ -2233,30 +2233,30 @@ void CompactibleFreeListSpace::endSweepFLCensus(size_t sweep_count) {
|
||||
}
|
||||
clearFLCensus();
|
||||
assert_locked();
|
||||
_dictionary->endSweepDictCensus(CMSLargeSplitSurplusPercent);
|
||||
_dictionary->end_sweep_dict_census(CMSLargeSplitSurplusPercent);
|
||||
}
|
||||
|
||||
bool CompactibleFreeListSpace::coalOverPopulated(size_t size) {
|
||||
if (size < SmallForDictionary) {
|
||||
FreeList<FreeChunk> *fl = &_indexedFreeList[size];
|
||||
return (fl->coalDesired() < 0) ||
|
||||
((int)fl->count() > fl->coalDesired());
|
||||
return (fl->coal_desired() < 0) ||
|
||||
((int)fl->count() > fl->coal_desired());
|
||||
} else {
|
||||
return dictionary()->coalDictOverPopulated(size);
|
||||
return dictionary()->coal_dict_over_populated(size);
|
||||
}
|
||||
}
|
||||
|
||||
void CompactibleFreeListSpace::smallCoalBirth(size_t size) {
|
||||
assert(size < SmallForDictionary, "Size too large for indexed list");
|
||||
FreeList<FreeChunk> *fl = &_indexedFreeList[size];
|
||||
fl->increment_coalBirths();
|
||||
fl->increment_coal_births();
|
||||
fl->increment_surplus();
|
||||
}
|
||||
|
||||
void CompactibleFreeListSpace::smallCoalDeath(size_t size) {
|
||||
assert(size < SmallForDictionary, "Size too large for indexed list");
|
||||
FreeList<FreeChunk> *fl = &_indexedFreeList[size];
|
||||
fl->increment_coalDeaths();
|
||||
fl->increment_coal_deaths();
|
||||
fl->decrement_surplus();
|
||||
}
|
||||
|
||||
@ -2264,7 +2264,7 @@ void CompactibleFreeListSpace::coalBirth(size_t size) {
|
||||
if (size < SmallForDictionary) {
|
||||
smallCoalBirth(size);
|
||||
} else {
|
||||
dictionary()->dictCensusUpdate(size,
|
||||
dictionary()->dict_census_udpate(size,
|
||||
false /* split */,
|
||||
true /* birth */);
|
||||
}
|
||||
@ -2274,7 +2274,7 @@ void CompactibleFreeListSpace::coalDeath(size_t size) {
|
||||
if(size < SmallForDictionary) {
|
||||
smallCoalDeath(size);
|
||||
} else {
|
||||
dictionary()->dictCensusUpdate(size,
|
||||
dictionary()->dict_census_udpate(size,
|
||||
false /* split */,
|
||||
false /* birth */);
|
||||
}
|
||||
@ -2283,22 +2283,22 @@ void CompactibleFreeListSpace::coalDeath(size_t size) {
|
||||
void CompactibleFreeListSpace::smallSplitBirth(size_t size) {
|
||||
assert(size < SmallForDictionary, "Size too large for indexed list");
|
||||
FreeList<FreeChunk> *fl = &_indexedFreeList[size];
|
||||
fl->increment_splitBirths();
|
||||
fl->increment_split_births();
|
||||
fl->increment_surplus();
|
||||
}
|
||||
|
||||
void CompactibleFreeListSpace::smallSplitDeath(size_t size) {
|
||||
assert(size < SmallForDictionary, "Size too large for indexed list");
|
||||
FreeList<FreeChunk> *fl = &_indexedFreeList[size];
|
||||
fl->increment_splitDeaths();
|
||||
fl->increment_split_deaths();
|
||||
fl->decrement_surplus();
|
||||
}
|
||||
|
||||
void CompactibleFreeListSpace::splitBirth(size_t size) {
|
||||
void CompactibleFreeListSpace::split_birth(size_t size) {
|
||||
if (size < SmallForDictionary) {
|
||||
smallSplitBirth(size);
|
||||
} else {
|
||||
dictionary()->dictCensusUpdate(size,
|
||||
dictionary()->dict_census_udpate(size,
|
||||
true /* split */,
|
||||
true /* birth */);
|
||||
}
|
||||
@ -2308,7 +2308,7 @@ void CompactibleFreeListSpace::splitDeath(size_t size) {
|
||||
if (size < SmallForDictionary) {
|
||||
smallSplitDeath(size);
|
||||
} else {
|
||||
dictionary()->dictCensusUpdate(size,
|
||||
dictionary()->dict_census_udpate(size,
|
||||
true /* split */,
|
||||
false /* birth */);
|
||||
}
|
||||
@ -2317,8 +2317,8 @@ void CompactibleFreeListSpace::splitDeath(size_t size) {
|
||||
void CompactibleFreeListSpace::split(size_t from, size_t to1) {
|
||||
size_t to2 = from - to1;
|
||||
splitDeath(from);
|
||||
splitBirth(to1);
|
||||
splitBirth(to2);
|
||||
split_birth(to1);
|
||||
split_birth(to2);
|
||||
}
|
||||
|
||||
void CompactibleFreeListSpace::print() const {
|
||||
@ -2364,7 +2364,7 @@ class VerifyAllBlksClosure: public BlkClosure {
|
||||
FreeChunk* fc = (FreeChunk*)addr;
|
||||
res = fc->size();
|
||||
if (FLSVerifyLists && !fc->cantCoalesce()) {
|
||||
guarantee(_sp->verifyChunkInFreeLists(fc),
|
||||
guarantee(_sp->verify_chunk_in_free_list(fc),
|
||||
"Chunk should be on a free list");
|
||||
}
|
||||
}
|
||||
@ -2520,7 +2520,7 @@ void CompactibleFreeListSpace::verifyIndexedFreeList(size_t size) const {
|
||||
"Slot should have been empty");
|
||||
for (; fc != NULL; fc = fc->next(), n++) {
|
||||
guarantee(fc->size() == size, "Size inconsistency");
|
||||
guarantee(fc->isFree(), "!free?");
|
||||
guarantee(fc->is_free(), "!free?");
|
||||
guarantee(fc->next() == NULL || fc->next()->prev() == fc, "Broken list");
|
||||
guarantee((fc->next() == NULL) == (fc == tail), "Incorrect tail");
|
||||
}
|
||||
@ -2529,7 +2529,7 @@ void CompactibleFreeListSpace::verifyIndexedFreeList(size_t size) const {
|
||||
|
||||
#ifndef PRODUCT
|
||||
void CompactibleFreeListSpace::check_free_list_consistency() const {
|
||||
assert(_dictionary->minSize() <= IndexSetSize,
|
||||
assert(_dictionary->min_size() <= IndexSetSize,
|
||||
"Some sizes can't be allocated without recourse to"
|
||||
" linear allocation buffers");
|
||||
assert(BinaryTreeDictionary<FreeChunk>::min_tree_chunk_size*HeapWordSize == sizeof(TreeChunk<FreeChunk>),
|
||||
@ -2548,33 +2548,33 @@ void CompactibleFreeListSpace::printFLCensus(size_t sweep_count) const {
|
||||
FreeList<FreeChunk> total;
|
||||
gclog_or_tty->print("end sweep# " SIZE_FORMAT "\n", sweep_count);
|
||||
FreeList<FreeChunk>::print_labels_on(gclog_or_tty, "size");
|
||||
size_t totalFree = 0;
|
||||
size_t total_free = 0;
|
||||
for (size_t i = IndexSetStart; i < IndexSetSize; i += IndexSetStride) {
|
||||
const FreeList<FreeChunk> *fl = &_indexedFreeList[i];
|
||||
totalFree += fl->count() * fl->size();
|
||||
total_free += fl->count() * fl->size();
|
||||
if (i % (40*IndexSetStride) == 0) {
|
||||
FreeList<FreeChunk>::print_labels_on(gclog_or_tty, "size");
|
||||
}
|
||||
fl->print_on(gclog_or_tty);
|
||||
total.set_bfrSurp( total.bfrSurp() + fl->bfrSurp() );
|
||||
total.set_bfr_surp( total.bfr_surp() + fl->bfr_surp() );
|
||||
total.set_surplus( total.surplus() + fl->surplus() );
|
||||
total.set_desired( total.desired() + fl->desired() );
|
||||
total.set_prevSweep( total.prevSweep() + fl->prevSweep() );
|
||||
total.set_beforeSweep(total.beforeSweep() + fl->beforeSweep());
|
||||
total.set_prev_sweep( total.prev_sweep() + fl->prev_sweep() );
|
||||
total.set_before_sweep(total.before_sweep() + fl->before_sweep());
|
||||
total.set_count( total.count() + fl->count() );
|
||||
total.set_coalBirths( total.coalBirths() + fl->coalBirths() );
|
||||
total.set_coalDeaths( total.coalDeaths() + fl->coalDeaths() );
|
||||
total.set_splitBirths(total.splitBirths() + fl->splitBirths());
|
||||
total.set_splitDeaths(total.splitDeaths() + fl->splitDeaths());
|
||||
total.set_coal_births( total.coal_births() + fl->coal_births() );
|
||||
total.set_coal_deaths( total.coal_deaths() + fl->coal_deaths() );
|
||||
total.set_split_births(total.split_births() + fl->split_births());
|
||||
total.set_split_deaths(total.split_deaths() + fl->split_deaths());
|
||||
}
|
||||
total.print_on(gclog_or_tty, "TOTAL");
|
||||
gclog_or_tty->print_cr("Total free in indexed lists "
|
||||
SIZE_FORMAT " words", totalFree);
|
||||
SIZE_FORMAT " words", total_free);
|
||||
gclog_or_tty->print("growth: %8.5f deficit: %8.5f\n",
|
||||
(double)(total.splitBirths()+total.coalBirths()-total.splitDeaths()-total.coalDeaths())/
|
||||
(total.prevSweep() != 0 ? (double)total.prevSweep() : 1.0),
|
||||
(double)(total.split_births()+total.coal_births()-total.split_deaths()-total.coal_deaths())/
|
||||
(total.prev_sweep() != 0 ? (double)total.prev_sweep() : 1.0),
|
||||
(double)(total.desired() - total.count())/(total.desired() != 0 ? (double)total.desired() : 1.0));
|
||||
_dictionary->printDictCensus();
|
||||
_dictionary->print_dict_census();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@ -2643,11 +2643,11 @@ HeapWord* CFLS_LAB::alloc(size_t word_sz) {
|
||||
// If it didn't work, give up.
|
||||
if (fl->count() == 0) return NULL;
|
||||
}
|
||||
res = fl->getChunkAtHead();
|
||||
res = fl->get_chunk_at_head();
|
||||
assert(res != NULL, "Why was count non-zero?");
|
||||
}
|
||||
res->markNotFree();
|
||||
assert(!res->isFree(), "shouldn't be marked free");
|
||||
assert(!res->is_free(), "shouldn't be marked free");
|
||||
assert(oop(res)->klass_or_null() == NULL, "should look uninitialized");
|
||||
// mangle a just allocated object with a distinct pattern.
|
||||
debug_only(res->mangleAllocated(word_sz));
|
||||
@ -2786,9 +2786,9 @@ void CompactibleFreeListSpace:: par_get_chunk_of_blocks(size_t word_sz, size_t n
|
||||
// we increment the split death count by the number of blocks
|
||||
// we just took from the cur_sz-size blocks list and which
|
||||
// we will be splitting below.
|
||||
ssize_t deaths = gfl->splitDeaths() +
|
||||
ssize_t deaths = gfl->split_deaths() +
|
||||
fl_for_cur_sz.count();
|
||||
gfl->set_splitDeaths(deaths);
|
||||
gfl->set_split_deaths(deaths);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2799,21 +2799,21 @@ void CompactibleFreeListSpace:: par_get_chunk_of_blocks(size_t word_sz, size_t n
|
||||
} else {
|
||||
// Divide each block on fl_for_cur_sz up k ways.
|
||||
FreeChunk* fc;
|
||||
while ((fc = fl_for_cur_sz.getChunkAtHead()) != NULL) {
|
||||
while ((fc = fl_for_cur_sz.get_chunk_at_head()) != NULL) {
|
||||
// Must do this in reverse order, so that anybody attempting to
|
||||
// access the main chunk sees it as a single free block until we
|
||||
// change it.
|
||||
size_t fc_size = fc->size();
|
||||
assert(fc->isFree(), "Error");
|
||||
assert(fc->is_free(), "Error");
|
||||
for (int i = k-1; i >= 0; i--) {
|
||||
FreeChunk* ffc = (FreeChunk*)((HeapWord*)fc + i * word_sz);
|
||||
assert((i != 0) ||
|
||||
((fc == ffc) && ffc->isFree() &&
|
||||
((fc == ffc) && ffc->is_free() &&
|
||||
(ffc->size() == k*word_sz) && (fc_size == word_sz)),
|
||||
"Counting error");
|
||||
ffc->setSize(word_sz);
|
||||
ffc->linkPrev(NULL); // Mark as a free block for other (parallel) GC threads.
|
||||
ffc->linkNext(NULL);
|
||||
ffc->set_size(word_sz);
|
||||
ffc->link_prev(NULL); // Mark as a free block for other (parallel) GC threads.
|
||||
ffc->link_next(NULL);
|
||||
// Above must occur before BOT is updated below.
|
||||
OrderAccess::storestore();
|
||||
// splitting from the right, fc_size == i * word_sz
|
||||
@ -2824,7 +2824,7 @@ void CompactibleFreeListSpace:: par_get_chunk_of_blocks(size_t word_sz, size_t n
|
||||
_bt.verify_single_block((HeapWord*)fc, fc_size);
|
||||
_bt.verify_single_block((HeapWord*)ffc, word_sz);
|
||||
// Push this on "fl".
|
||||
fl->returnChunkAtHead(ffc);
|
||||
fl->return_chunk_at_head(ffc);
|
||||
}
|
||||
// TRAP
|
||||
assert(fl->tail()->next() == NULL, "List invariant.");
|
||||
@ -2834,8 +2834,8 @@ void CompactibleFreeListSpace:: par_get_chunk_of_blocks(size_t word_sz, size_t n
|
||||
size_t num = fl->count();
|
||||
MutexLockerEx x(_indexedFreeListParLocks[word_sz],
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
ssize_t births = _indexedFreeList[word_sz].splitBirths() + num;
|
||||
_indexedFreeList[word_sz].set_splitBirths(births);
|
||||
ssize_t births = _indexedFreeList[word_sz].split_births() + num;
|
||||
_indexedFreeList[word_sz].set_split_births(births);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -2848,12 +2848,12 @@ void CompactibleFreeListSpace:: par_get_chunk_of_blocks(size_t word_sz, size_t n
|
||||
MutexLockerEx x(parDictionaryAllocLock(),
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
while (n > 0) {
|
||||
fc = dictionary()->getChunk(MAX2(n * word_sz,
|
||||
_dictionary->minSize()),
|
||||
fc = dictionary()->get_chunk(MAX2(n * word_sz,
|
||||
_dictionary->min_size()),
|
||||
FreeBlockDictionary<FreeChunk>::atLeast);
|
||||
if (fc != NULL) {
|
||||
_bt.allocated((HeapWord*)fc, fc->size(), true /* reducing */); // update _unallocated_blk
|
||||
dictionary()->dictCensusUpdate(fc->size(),
|
||||
dictionary()->dict_census_udpate(fc->size(),
|
||||
true /*split*/,
|
||||
false /*birth*/);
|
||||
break;
|
||||
@ -2864,7 +2864,7 @@ void CompactibleFreeListSpace:: par_get_chunk_of_blocks(size_t word_sz, size_t n
|
||||
if (fc == NULL) return;
|
||||
// Otherwise, split up that block.
|
||||
assert((ssize_t)n >= 1, "Control point invariant");
|
||||
assert(fc->isFree(), "Error: should be a free block");
|
||||
assert(fc->is_free(), "Error: should be a free block");
|
||||
_bt.verify_single_block((HeapWord*)fc, fc->size());
|
||||
const size_t nn = fc->size() / word_sz;
|
||||
n = MIN2(nn, n);
|
||||
@ -2895,18 +2895,18 @@ void CompactibleFreeListSpace:: par_get_chunk_of_blocks(size_t word_sz, size_t n
|
||||
if (rem > 0) {
|
||||
size_t prefix_size = n * word_sz;
|
||||
rem_fc = (FreeChunk*)((HeapWord*)fc + prefix_size);
|
||||
rem_fc->setSize(rem);
|
||||
rem_fc->linkPrev(NULL); // Mark as a free block for other (parallel) GC threads.
|
||||
rem_fc->linkNext(NULL);
|
||||
rem_fc->set_size(rem);
|
||||
rem_fc->link_prev(NULL); // Mark as a free block for other (parallel) GC threads.
|
||||
rem_fc->link_next(NULL);
|
||||
// Above must occur before BOT is updated below.
|
||||
assert((ssize_t)n > 0 && prefix_size > 0 && rem_fc > fc, "Error");
|
||||
OrderAccess::storestore();
|
||||
_bt.split_block((HeapWord*)fc, fc->size(), prefix_size);
|
||||
assert(fc->isFree(), "Error");
|
||||
fc->setSize(prefix_size);
|
||||
assert(fc->is_free(), "Error");
|
||||
fc->set_size(prefix_size);
|
||||
if (rem >= IndexSetSize) {
|
||||
returnChunkToDictionary(rem_fc);
|
||||
dictionary()->dictCensusUpdate(rem, true /*split*/, true /*birth*/);
|
||||
dictionary()->dict_census_udpate(rem, true /*split*/, true /*birth*/);
|
||||
rem_fc = NULL;
|
||||
}
|
||||
// Otherwise, return it to the small list below.
|
||||
@ -2916,7 +2916,7 @@ void CompactibleFreeListSpace:: par_get_chunk_of_blocks(size_t word_sz, size_t n
|
||||
MutexLockerEx x(_indexedFreeListParLocks[rem],
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
_bt.verify_not_unallocated((HeapWord*)rem_fc, rem_fc->size());
|
||||
_indexedFreeList[rem].returnChunkAtHead(rem_fc);
|
||||
_indexedFreeList[rem].return_chunk_at_head(rem_fc);
|
||||
smallSplitBirth(rem);
|
||||
}
|
||||
assert((ssize_t)n > 0 && fc != NULL, "Consistency");
|
||||
@ -2928,9 +2928,9 @@ void CompactibleFreeListSpace:: par_get_chunk_of_blocks(size_t word_sz, size_t n
|
||||
// All but first chunk in this loop
|
||||
for (ssize_t i = n-1; i > 0; i--) {
|
||||
FreeChunk* ffc = (FreeChunk*)((HeapWord*)fc + i * word_sz);
|
||||
ffc->setSize(word_sz);
|
||||
ffc->linkPrev(NULL); // Mark as a free block for other (parallel) GC threads.
|
||||
ffc->linkNext(NULL);
|
||||
ffc->set_size(word_sz);
|
||||
ffc->link_prev(NULL); // Mark as a free block for other (parallel) GC threads.
|
||||
ffc->link_next(NULL);
|
||||
// Above must occur before BOT is updated below.
|
||||
OrderAccess::storestore();
|
||||
// splitting from the right, fc_size == (n - i + 1) * wordsize
|
||||
@ -2940,25 +2940,25 @@ void CompactibleFreeListSpace:: par_get_chunk_of_blocks(size_t word_sz, size_t n
|
||||
_bt.verify_single_block((HeapWord*)ffc, ffc->size());
|
||||
_bt.verify_single_block((HeapWord*)fc, fc_size);
|
||||
// Push this on "fl".
|
||||
fl->returnChunkAtHead(ffc);
|
||||
fl->return_chunk_at_head(ffc);
|
||||
}
|
||||
// First chunk
|
||||
assert(fc->isFree() && fc->size() == n*word_sz, "Error: should still be a free block");
|
||||
assert(fc->is_free() && fc->size() == n*word_sz, "Error: should still be a free block");
|
||||
// The blocks above should show their new sizes before the first block below
|
||||
fc->setSize(word_sz);
|
||||
fc->linkPrev(NULL); // idempotent wrt free-ness, see assert above
|
||||
fc->linkNext(NULL);
|
||||
fc->set_size(word_sz);
|
||||
fc->link_prev(NULL); // idempotent wrt free-ness, see assert above
|
||||
fc->link_next(NULL);
|
||||
_bt.verify_not_unallocated((HeapWord*)fc, fc->size());
|
||||
_bt.verify_single_block((HeapWord*)fc, fc->size());
|
||||
fl->returnChunkAtHead(fc);
|
||||
fl->return_chunk_at_head(fc);
|
||||
|
||||
assert((ssize_t)n > 0 && (ssize_t)n == fl->count(), "Incorrect number of blocks");
|
||||
{
|
||||
// Update the stats for this block size.
|
||||
MutexLockerEx x(_indexedFreeListParLocks[word_sz],
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
const ssize_t births = _indexedFreeList[word_sz].splitBirths() + n;
|
||||
_indexedFreeList[word_sz].set_splitBirths(births);
|
||||
const ssize_t births = _indexedFreeList[word_sz].split_births() + n;
|
||||
_indexedFreeList[word_sz].set_split_births(births);
|
||||
// ssize_t new_surplus = _indexedFreeList[word_sz].surplus() + n;
|
||||
// _indexedFreeList[word_sz].set_surplus(new_surplus);
|
||||
}
|
||||
|
@ -499,7 +499,7 @@ class CompactibleFreeListSpace: public CompactibleSpace {
|
||||
// Verify that the given chunk is in the free lists:
|
||||
// i.e. either the binary tree dictionary, the indexed free lists
|
||||
// or the linear allocation block.
|
||||
bool verifyChunkInFreeLists(FreeChunk* fc) const;
|
||||
bool verify_chunk_in_free_list(FreeChunk* fc) const;
|
||||
// Verify that the given chunk is the linear allocation block
|
||||
bool verify_chunk_is_linear_alloc_block(FreeChunk* fc) const;
|
||||
// Do some basic checks on the the free lists.
|
||||
@ -608,7 +608,7 @@ class CompactibleFreeListSpace: public CompactibleSpace {
|
||||
void coalDeath(size_t size);
|
||||
void smallSplitBirth(size_t size);
|
||||
void smallSplitDeath(size_t size);
|
||||
void splitBirth(size_t size);
|
||||
void split_birth(size_t size);
|
||||
void splitDeath(size_t size);
|
||||
void split(size_t from, size_t to1);
|
||||
|
||||
|
@ -1026,7 +1026,7 @@ HeapWord* ConcurrentMarkSweepGeneration::have_lock_and_allocate(size_t size,
|
||||
// its mark-bit or P-bits not yet set. Such objects need
|
||||
// to be safely navigable by block_start().
|
||||
assert(oop(res)->klass_or_null() == NULL, "Object should be uninitialized here.");
|
||||
assert(!((FreeChunk*)res)->isFree(), "Error, block will look free but show wrong size");
|
||||
assert(!((FreeChunk*)res)->is_free(), "Error, block will look free but show wrong size");
|
||||
collector()->direct_allocated(res, adjustedSize);
|
||||
_direct_allocated_words += adjustedSize;
|
||||
// allocation counters
|
||||
@ -1391,7 +1391,7 @@ ConcurrentMarkSweepGeneration::par_promote(int thread_num,
|
||||
oop obj = oop(obj_ptr);
|
||||
OrderAccess::storestore();
|
||||
assert(obj->klass_or_null() == NULL, "Object should be uninitialized here.");
|
||||
assert(!((FreeChunk*)obj_ptr)->isFree(), "Error, block will look free but show wrong size");
|
||||
assert(!((FreeChunk*)obj_ptr)->is_free(), "Error, block will look free but show wrong size");
|
||||
// IMPORTANT: See note on object initialization for CMS above.
|
||||
// Otherwise, copy the object. Here we must be careful to insert the
|
||||
// klass pointer last, since this marks the block as an allocated object.
|
||||
@ -1400,7 +1400,7 @@ ConcurrentMarkSweepGeneration::par_promote(int thread_num,
|
||||
// Restore the mark word copied above.
|
||||
obj->set_mark(m);
|
||||
assert(obj->klass_or_null() == NULL, "Object should be uninitialized here.");
|
||||
assert(!((FreeChunk*)obj_ptr)->isFree(), "Error, block will look free but show wrong size");
|
||||
assert(!((FreeChunk*)obj_ptr)->is_free(), "Error, block will look free but show wrong size");
|
||||
OrderAccess::storestore();
|
||||
|
||||
if (UseCompressedOops) {
|
||||
@ -1421,7 +1421,7 @@ ConcurrentMarkSweepGeneration::par_promote(int thread_num,
|
||||
promoInfo->track((PromotedObject*)obj, old->klass());
|
||||
}
|
||||
assert(obj->klass_or_null() == NULL, "Object should be uninitialized here.");
|
||||
assert(!((FreeChunk*)obj_ptr)->isFree(), "Error, block will look free but show wrong size");
|
||||
assert(!((FreeChunk*)obj_ptr)->is_free(), "Error, block will look free but show wrong size");
|
||||
assert(old->is_oop(), "Will use and dereference old klass ptr below");
|
||||
|
||||
// Finally, install the klass pointer (this should be volatile).
|
||||
@ -2034,7 +2034,7 @@ void CMSCollector::do_compaction_work(bool clear_all_soft_refs) {
|
||||
pointer_delta(cms_space->end(), cms_space->compaction_top())
|
||||
* HeapWordSize,
|
||||
"All the free space should be compacted into one chunk at top");
|
||||
assert(cms_space->dictionary()->totalChunkSize(
|
||||
assert(cms_space->dictionary()->total_chunk_size(
|
||||
debug_only(cms_space->freelistLock())) == 0 ||
|
||||
cms_space->totalSizeInIndexedFreeLists() == 0,
|
||||
"All the free space should be in a single chunk");
|
||||
@ -6131,7 +6131,7 @@ void ConcurrentMarkSweepGeneration::setNearLargestChunk() {
|
||||
double nearLargestPercent = FLSLargestBlockCoalesceProximity;
|
||||
HeapWord* minAddr = _cmsSpace->bottom();
|
||||
HeapWord* largestAddr =
|
||||
(HeapWord*) _cmsSpace->dictionary()->findLargestDict();
|
||||
(HeapWord*) _cmsSpace->dictionary()->find_largest_dict();
|
||||
if (largestAddr == NULL) {
|
||||
// The dictionary appears to be empty. In this case
|
||||
// try to coalesce at the end of the heap.
|
||||
@ -7906,7 +7906,7 @@ SweepClosure::SweepClosure(CMSCollector* collector,
|
||||
_last_fc = NULL;
|
||||
|
||||
_sp->initializeIndexedFreeListArrayReturnedBytes();
|
||||
_sp->dictionary()->initializeDictReturnedBytes();
|
||||
_sp->dictionary()->initialize_dict_returned_bytes();
|
||||
)
|
||||
assert(_limit >= _sp->bottom() && _limit <= _sp->end(),
|
||||
"sweep _limit out of bounds");
|
||||
@ -7954,13 +7954,13 @@ SweepClosure::~SweepClosure() {
|
||||
|
||||
if (PrintCMSStatistics && CMSVerifyReturnedBytes) {
|
||||
size_t indexListReturnedBytes = _sp->sumIndexedFreeListArrayReturnedBytes();
|
||||
size_t dictReturnedBytes = _sp->dictionary()->sumDictReturnedBytes();
|
||||
size_t returnedBytes = indexListReturnedBytes + dictReturnedBytes;
|
||||
gclog_or_tty->print("Returned "SIZE_FORMAT" bytes", returnedBytes);
|
||||
size_t dict_returned_bytes = _sp->dictionary()->sum_dict_returned_bytes();
|
||||
size_t returned_bytes = indexListReturnedBytes + dict_returned_bytes;
|
||||
gclog_or_tty->print("Returned "SIZE_FORMAT" bytes", returned_bytes);
|
||||
gclog_or_tty->print(" Indexed List Returned "SIZE_FORMAT" bytes",
|
||||
indexListReturnedBytes);
|
||||
gclog_or_tty->print_cr(" Dictionary Returned "SIZE_FORMAT" bytes",
|
||||
dictReturnedBytes);
|
||||
dict_returned_bytes);
|
||||
}
|
||||
}
|
||||
if (CMSTraceSweeper) {
|
||||
@ -7985,9 +7985,9 @@ void SweepClosure::initialize_free_range(HeapWord* freeFinger,
|
||||
if (CMSTestInFreeList) {
|
||||
if (freeRangeInFreeLists) {
|
||||
FreeChunk* fc = (FreeChunk*) freeFinger;
|
||||
assert(fc->isFree(), "A chunk on the free list should be free.");
|
||||
assert(fc->is_free(), "A chunk on the free list should be free.");
|
||||
assert(fc->size() > 0, "Free range should have a size");
|
||||
assert(_sp->verifyChunkInFreeLists(fc), "Chunk is not in free lists");
|
||||
assert(_sp->verify_chunk_in_free_list(fc), "Chunk is not in free lists");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -8057,7 +8057,7 @@ size_t SweepClosure::do_blk_careful(HeapWord* addr) {
|
||||
assert(addr < _limit, "sweep invariant");
|
||||
// check if we should yield
|
||||
do_yield_check(addr);
|
||||
if (fc->isFree()) {
|
||||
if (fc->is_free()) {
|
||||
// Chunk that is already free
|
||||
res = fc->size();
|
||||
do_already_free_chunk(fc);
|
||||
@ -8145,7 +8145,7 @@ void SweepClosure::do_already_free_chunk(FreeChunk* fc) {
|
||||
// Chunks that cannot be coalesced are not in the
|
||||
// free lists.
|
||||
if (CMSTestInFreeList && !fc->cantCoalesce()) {
|
||||
assert(_sp->verifyChunkInFreeLists(fc),
|
||||
assert(_sp->verify_chunk_in_free_list(fc),
|
||||
"free chunk should be in free lists");
|
||||
}
|
||||
// a chunk that is already free, should not have been
|
||||
@ -8171,7 +8171,7 @@ void SweepClosure::do_already_free_chunk(FreeChunk* fc) {
|
||||
FreeChunk* nextChunk = (FreeChunk*)(addr + size);
|
||||
assert((HeapWord*)nextChunk <= _sp->end(), "Chunk size out of bounds?");
|
||||
if ((HeapWord*)nextChunk < _sp->end() && // There is another free chunk to the right ...
|
||||
nextChunk->isFree() && // ... which is free...
|
||||
nextChunk->is_free() && // ... which is free...
|
||||
nextChunk->cantCoalesce()) { // ... but can't be coalesced
|
||||
// nothing to do
|
||||
} else {
|
||||
@ -8203,7 +8203,7 @@ void SweepClosure::do_already_free_chunk(FreeChunk* fc) {
|
||||
assert(ffc->size() == pointer_delta(addr, freeFinger()),
|
||||
"Size of free range is inconsistent with chunk size.");
|
||||
if (CMSTestInFreeList) {
|
||||
assert(_sp->verifyChunkInFreeLists(ffc),
|
||||
assert(_sp->verify_chunk_in_free_list(ffc),
|
||||
"free range is not in free lists");
|
||||
}
|
||||
_sp->removeFreeChunkFromFreeLists(ffc);
|
||||
@ -8262,7 +8262,7 @@ size_t SweepClosure::do_garbage_chunk(FreeChunk* fc) {
|
||||
assert(ffc->size() == pointer_delta(addr, freeFinger()),
|
||||
"Size of free range is inconsistent with chunk size.");
|
||||
if (CMSTestInFreeList) {
|
||||
assert(_sp->verifyChunkInFreeLists(ffc),
|
||||
assert(_sp->verify_chunk_in_free_list(ffc),
|
||||
"free range is not in free lists");
|
||||
}
|
||||
_sp->removeFreeChunkFromFreeLists(ffc);
|
||||
@ -8351,11 +8351,11 @@ void SweepClosure::do_post_free_or_garbage_chunk(FreeChunk* fc,
|
||||
size_t chunkSize) {
|
||||
// do_post_free_or_garbage_chunk() should only be called in the case
|
||||
// of the adaptive free list allocator.
|
||||
const bool fcInFreeLists = fc->isFree();
|
||||
const bool fcInFreeLists = fc->is_free();
|
||||
assert(_sp->adaptive_freelists(), "Should only be used in this case.");
|
||||
assert((HeapWord*)fc <= _limit, "sweep invariant");
|
||||
if (CMSTestInFreeList && fcInFreeLists) {
|
||||
assert(_sp->verifyChunkInFreeLists(fc), "free chunk is not in free lists");
|
||||
assert(_sp->verify_chunk_in_free_list(fc), "free chunk is not in free lists");
|
||||
}
|
||||
|
||||
if (CMSTraceSweeper) {
|
||||
@ -8410,7 +8410,7 @@ void SweepClosure::do_post_free_or_garbage_chunk(FreeChunk* fc,
|
||||
assert(ffc->size() == pointer_delta(fc_addr, freeFinger()),
|
||||
"Size of free range is inconsistent with chunk size.");
|
||||
if (CMSTestInFreeList) {
|
||||
assert(_sp->verifyChunkInFreeLists(ffc),
|
||||
assert(_sp->verify_chunk_in_free_list(ffc),
|
||||
"Chunk is not in free lists");
|
||||
}
|
||||
_sp->coalDeath(ffc->size());
|
||||
@ -8459,7 +8459,7 @@ void SweepClosure::lookahead_and_flush(FreeChunk* fc, size_t chunk_size) {
|
||||
" when examining fc = " PTR_FORMAT "(" SIZE_FORMAT ")",
|
||||
_limit, _sp->bottom(), _sp->end(), fc, chunk_size));
|
||||
if (eob >= _limit) {
|
||||
assert(eob == _limit || fc->isFree(), "Only a free chunk should allow us to cross over the limit");
|
||||
assert(eob == _limit || fc->is_free(), "Only a free chunk should allow us to cross over the limit");
|
||||
if (CMSTraceSweeper) {
|
||||
gclog_or_tty->print_cr("_limit " PTR_FORMAT " reached or crossed by block "
|
||||
"[" PTR_FORMAT "," PTR_FORMAT ") in space "
|
||||
@ -8482,8 +8482,8 @@ void SweepClosure::flush_cur_free_chunk(HeapWord* chunk, size_t size) {
|
||||
if (!freeRangeInFreeLists()) {
|
||||
if (CMSTestInFreeList) {
|
||||
FreeChunk* fc = (FreeChunk*) chunk;
|
||||
fc->setSize(size);
|
||||
assert(!_sp->verifyChunkInFreeLists(fc),
|
||||
fc->set_size(size);
|
||||
assert(!_sp->verify_chunk_in_free_list(fc),
|
||||
"chunk should not be in free lists yet");
|
||||
}
|
||||
if (CMSTraceSweeper) {
|
||||
@ -8557,8 +8557,8 @@ void SweepClosure::do_yield_work(HeapWord* addr) {
|
||||
// This is actually very useful in a product build if it can
|
||||
// be called from the debugger. Compile it into the product
|
||||
// as needed.
|
||||
bool debug_verifyChunkInFreeLists(FreeChunk* fc) {
|
||||
return debug_cms_space->verifyChunkInFreeLists(fc);
|
||||
bool debug_verify_chunk_in_free_list(FreeChunk* fc) {
|
||||
return debug_cms_space->verify_chunk_in_free_list(fc);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -9255,7 +9255,7 @@ void ASConcurrentMarkSweepGeneration::shrink_by(size_t desired_bytes) {
|
||||
size_t chunk_at_end_old_size = chunk_at_end->size();
|
||||
assert(chunk_at_end_old_size >= word_size_change,
|
||||
"Shrink is too large");
|
||||
chunk_at_end->setSize(chunk_at_end_old_size -
|
||||
chunk_at_end->set_size(chunk_at_end_old_size -
|
||||
word_size_change);
|
||||
_cmsSpace->freed((HeapWord*) chunk_at_end->end(),
|
||||
word_size_change);
|
||||
|
@ -75,20 +75,20 @@ class FreeChunk VALUE_OBJ_CLASS_SPEC {
|
||||
// calls. We really want the read of _mark and _prev from this pointer
|
||||
// to be volatile but making the fields volatile causes all sorts of
|
||||
// compilation errors.
|
||||
return ((volatile FreeChunk*)addr)->isFree();
|
||||
return ((volatile FreeChunk*)addr)->is_free();
|
||||
}
|
||||
|
||||
bool isFree() const volatile {
|
||||
bool is_free() const volatile {
|
||||
LP64_ONLY(if (UseCompressedOops) return mark()->is_cms_free_chunk(); else)
|
||||
return (((intptr_t)_prev) & 0x1) == 0x1;
|
||||
}
|
||||
bool cantCoalesce() const {
|
||||
assert(isFree(), "can't get coalesce bit on not free");
|
||||
assert(is_free(), "can't get coalesce bit on not free");
|
||||
return (((intptr_t)_prev) & 0x2) == 0x2;
|
||||
}
|
||||
void dontCoalesce() {
|
||||
// the block should be free
|
||||
assert(isFree(), "Should look like a free block");
|
||||
assert(is_free(), "Should look like a free block");
|
||||
_prev = (FreeChunk*)(((intptr_t)_prev) | 0x2);
|
||||
}
|
||||
FreeChunk* prev() const {
|
||||
@ -103,23 +103,23 @@ class FreeChunk VALUE_OBJ_CLASS_SPEC {
|
||||
LP64_ONLY(if (UseCompressedOops) return mark()->get_size(); else )
|
||||
return _size;
|
||||
}
|
||||
void setSize(size_t sz) {
|
||||
void set_size(size_t sz) {
|
||||
LP64_ONLY(if (UseCompressedOops) set_mark(markOopDesc::set_size_and_free(sz)); else )
|
||||
_size = sz;
|
||||
}
|
||||
|
||||
FreeChunk* next() const { return _next; }
|
||||
|
||||
void linkAfter(FreeChunk* ptr) {
|
||||
linkNext(ptr);
|
||||
if (ptr != NULL) ptr->linkPrev(this);
|
||||
void link_after(FreeChunk* ptr) {
|
||||
link_next(ptr);
|
||||
if (ptr != NULL) ptr->link_prev(this);
|
||||
}
|
||||
void linkNext(FreeChunk* ptr) { _next = ptr; }
|
||||
void linkPrev(FreeChunk* ptr) {
|
||||
void link_next(FreeChunk* ptr) { _next = ptr; }
|
||||
void link_prev(FreeChunk* ptr) {
|
||||
LP64_ONLY(if (UseCompressedOops) _prev = ptr; else)
|
||||
_prev = (FreeChunk*)((intptr_t)ptr | 0x1);
|
||||
}
|
||||
void clearNext() { _next = NULL; }
|
||||
void clear_next() { _next = NULL; }
|
||||
void markNotFree() {
|
||||
// Set _prev (klass) to null before (if) clearing the mark word below
|
||||
_prev = NULL;
|
||||
@ -129,7 +129,7 @@ class FreeChunk VALUE_OBJ_CLASS_SPEC {
|
||||
set_mark(markOopDesc::prototype());
|
||||
}
|
||||
#endif
|
||||
assert(!isFree(), "Error");
|
||||
assert(!is_free(), "Error");
|
||||
}
|
||||
|
||||
// Return the address past the end of this chunk
|
||||
|
@ -121,7 +121,7 @@ void PromotionInfo::track(PromotedObject* trackOop) {
|
||||
void PromotionInfo::track(PromotedObject* trackOop, klassOop klassOfOop) {
|
||||
// make a copy of header as it may need to be spooled
|
||||
markOop mark = oop(trackOop)->mark();
|
||||
trackOop->clearNext();
|
||||
trackOop->clear_next();
|
||||
if (mark->must_be_preserved_for_cms_scavenge(klassOfOop)) {
|
||||
// save non-prototypical header, and mark oop
|
||||
saveDisplacedHeader(mark);
|
||||
|
@ -43,7 +43,7 @@ class PromotedObject VALUE_OBJ_CLASS_SPEC {
|
||||
// whose position will depend on endian-ness of the platform.
|
||||
// This is so that there is no interference with the
|
||||
// cms_free_bit occupying bit position 7 (lsb == 0)
|
||||
// when we are using compressed oops; see FreeChunk::isFree().
|
||||
// when we are using compressed oops; see FreeChunk::is_free().
|
||||
// We cannot move the cms_free_bit down because currently
|
||||
// biased locking code assumes that age bits are contiguous
|
||||
// with the lock bits. Even if that assumption were relaxed,
|
||||
@ -65,7 +65,7 @@ class PromotedObject VALUE_OBJ_CLASS_SPEC {
|
||||
};
|
||||
public:
|
||||
inline PromotedObject* next() const {
|
||||
assert(!((FreeChunk*)this)->isFree(), "Error");
|
||||
assert(!((FreeChunk*)this)->is_free(), "Error");
|
||||
PromotedObject* res;
|
||||
if (UseCompressedOops) {
|
||||
// The next pointer is a compressed oop stored in the top 32 bits
|
||||
@ -85,27 +85,27 @@ class PromotedObject VALUE_OBJ_CLASS_SPEC {
|
||||
} else {
|
||||
_next |= (intptr_t)x;
|
||||
}
|
||||
assert(!((FreeChunk*)this)->isFree(), "Error");
|
||||
assert(!((FreeChunk*)this)->is_free(), "Error");
|
||||
}
|
||||
inline void setPromotedMark() {
|
||||
_next |= promoted_mask;
|
||||
assert(!((FreeChunk*)this)->isFree(), "Error");
|
||||
assert(!((FreeChunk*)this)->is_free(), "Error");
|
||||
}
|
||||
inline bool hasPromotedMark() const {
|
||||
assert(!((FreeChunk*)this)->isFree(), "Error");
|
||||
assert(!((FreeChunk*)this)->is_free(), "Error");
|
||||
return (_next & promoted_mask) == promoted_mask;
|
||||
}
|
||||
inline void setDisplacedMark() {
|
||||
_next |= displaced_mark;
|
||||
assert(!((FreeChunk*)this)->isFree(), "Error");
|
||||
assert(!((FreeChunk*)this)->is_free(), "Error");
|
||||
}
|
||||
inline bool hasDisplacedMark() const {
|
||||
assert(!((FreeChunk*)this)->isFree(), "Error");
|
||||
assert(!((FreeChunk*)this)->is_free(), "Error");
|
||||
return (_next & displaced_mark) != 0;
|
||||
}
|
||||
inline void clearNext() {
|
||||
inline void clear_next() {
|
||||
_next = 0;
|
||||
assert(!((FreeChunk*)this)->isFree(), "Error");
|
||||
assert(!((FreeChunk*)this)->is_free(), "Error");
|
||||
}
|
||||
debug_only(void *next_addr() { return (void *) &_next; })
|
||||
};
|
||||
|
@ -46,7 +46,7 @@
|
||||
nonstatic_field(LinearAllocBlock, _word_size, size_t) \
|
||||
nonstatic_field(FreeList<FreeChunk>, _size, size_t) \
|
||||
nonstatic_field(FreeList<FreeChunk>, _count, ssize_t) \
|
||||
nonstatic_field(BinaryTreeDictionary<FreeChunk>,_totalSize, size_t) \
|
||||
nonstatic_field(BinaryTreeDictionary<FreeChunk>,_total_size, size_t) \
|
||||
nonstatic_field(CompactibleFreeListSpace, _dictionary, FreeBlockDictionary<FreeChunk>*) \
|
||||
nonstatic_field(CompactibleFreeListSpace, _indexedFreeList[0], FreeList<FreeChunk>) \
|
||||
nonstatic_field(CompactibleFreeListSpace, _smallLinearAllocBlock, LinearAllocBlock)
|
||||
|
@ -39,7 +39,7 @@ class AllocationStats VALUE_OBJ_CLASS_SPEC {
|
||||
// We measure the demand between the end of the previous sweep and
|
||||
// beginning of this sweep:
|
||||
// Count(end_last_sweep) - Count(start_this_sweep)
|
||||
// + splitBirths(between) - splitDeaths(between)
|
||||
// + split_births(between) - split_deaths(between)
|
||||
// The above number divided by the time since the end of the
|
||||
// previous sweep gives us a time rate of demand for blocks
|
||||
// of this size. We compute a padded average of this rate as
|
||||
@ -51,34 +51,34 @@ class AllocationStats VALUE_OBJ_CLASS_SPEC {
|
||||
AdaptivePaddedAverage _demand_rate_estimate;
|
||||
|
||||
ssize_t _desired; // Demand stimate computed as described above
|
||||
ssize_t _coalDesired; // desired +/- small-percent for tuning coalescing
|
||||
ssize_t _coal_desired; // desired +/- small-percent for tuning coalescing
|
||||
|
||||
ssize_t _surplus; // count - (desired +/- small-percent),
|
||||
// used to tune splitting in best fit
|
||||
ssize_t _bfrSurp; // surplus at start of current sweep
|
||||
ssize_t _prevSweep; // count from end of previous sweep
|
||||
ssize_t _beforeSweep; // count from before current sweep
|
||||
ssize_t _coalBirths; // additional chunks from coalescing
|
||||
ssize_t _coalDeaths; // loss from coalescing
|
||||
ssize_t _splitBirths; // additional chunks from splitting
|
||||
ssize_t _splitDeaths; // loss from splitting
|
||||
size_t _returnedBytes; // number of bytes returned to list.
|
||||
ssize_t _bfr_surp; // surplus at start of current sweep
|
||||
ssize_t _prev_sweep; // count from end of previous sweep
|
||||
ssize_t _before_sweep; // count from before current sweep
|
||||
ssize_t _coal_births; // additional chunks from coalescing
|
||||
ssize_t _coal_deaths; // loss from coalescing
|
||||
ssize_t _split_births; // additional chunks from splitting
|
||||
ssize_t _split_deaths; // loss from splitting
|
||||
size_t _returned_bytes; // number of bytes returned to list.
|
||||
public:
|
||||
void initialize(bool split_birth = false) {
|
||||
AdaptivePaddedAverage* dummy =
|
||||
new (&_demand_rate_estimate) AdaptivePaddedAverage(CMS_FLSWeight,
|
||||
CMS_FLSPadding);
|
||||
_desired = 0;
|
||||
_coalDesired = 0;
|
||||
_coal_desired = 0;
|
||||
_surplus = 0;
|
||||
_bfrSurp = 0;
|
||||
_prevSweep = 0;
|
||||
_beforeSweep = 0;
|
||||
_coalBirths = 0;
|
||||
_coalDeaths = 0;
|
||||
_splitBirths = (split_birth ? 1 : 0);
|
||||
_splitDeaths = 0;
|
||||
_returnedBytes = 0;
|
||||
_bfr_surp = 0;
|
||||
_prev_sweep = 0;
|
||||
_before_sweep = 0;
|
||||
_coal_births = 0;
|
||||
_coal_deaths = 0;
|
||||
_split_births = (split_birth ? 1 : 0);
|
||||
_split_deaths = 0;
|
||||
_returned_bytes = 0;
|
||||
}
|
||||
|
||||
AllocationStats() {
|
||||
@ -99,12 +99,12 @@ class AllocationStats VALUE_OBJ_CLASS_SPEC {
|
||||
// vulnerable to noisy glitches. In such cases, we
|
||||
// ignore the current sample and use currently available
|
||||
// historical estimates.
|
||||
assert(prevSweep() + splitBirths() + coalBirths() // "Total Production Stock"
|
||||
>= splitDeaths() + coalDeaths() + (ssize_t)count, // "Current stock + depletion"
|
||||
assert(prev_sweep() + split_births() + coal_births() // "Total Production Stock"
|
||||
>= split_deaths() + coal_deaths() + (ssize_t)count, // "Current stock + depletion"
|
||||
"Conservation Principle");
|
||||
if (inter_sweep_current > _threshold) {
|
||||
ssize_t demand = prevSweep() - (ssize_t)count + splitBirths() + coalBirths()
|
||||
- splitDeaths() - coalDeaths();
|
||||
ssize_t demand = prev_sweep() - (ssize_t)count + split_births() + coal_births()
|
||||
- split_deaths() - coal_deaths();
|
||||
assert(demand >= 0,
|
||||
err_msg("Demand (" SSIZE_FORMAT ") should be non-negative for "
|
||||
PTR_FORMAT " (size=" SIZE_FORMAT ")",
|
||||
@ -130,40 +130,40 @@ class AllocationStats VALUE_OBJ_CLASS_SPEC {
|
||||
ssize_t desired() const { return _desired; }
|
||||
void set_desired(ssize_t v) { _desired = v; }
|
||||
|
||||
ssize_t coalDesired() const { return _coalDesired; }
|
||||
void set_coalDesired(ssize_t v) { _coalDesired = v; }
|
||||
ssize_t coal_desired() const { return _coal_desired; }
|
||||
void set_coal_desired(ssize_t v) { _coal_desired = v; }
|
||||
|
||||
ssize_t surplus() const { return _surplus; }
|
||||
void set_surplus(ssize_t v) { _surplus = v; }
|
||||
void increment_surplus() { _surplus++; }
|
||||
void decrement_surplus() { _surplus--; }
|
||||
|
||||
ssize_t bfrSurp() const { return _bfrSurp; }
|
||||
void set_bfrSurp(ssize_t v) { _bfrSurp = v; }
|
||||
ssize_t prevSweep() const { return _prevSweep; }
|
||||
void set_prevSweep(ssize_t v) { _prevSweep = v; }
|
||||
ssize_t beforeSweep() const { return _beforeSweep; }
|
||||
void set_beforeSweep(ssize_t v) { _beforeSweep = v; }
|
||||
ssize_t bfr_surp() const { return _bfr_surp; }
|
||||
void set_bfr_surp(ssize_t v) { _bfr_surp = v; }
|
||||
ssize_t prev_sweep() const { return _prev_sweep; }
|
||||
void set_prev_sweep(ssize_t v) { _prev_sweep = v; }
|
||||
ssize_t before_sweep() const { return _before_sweep; }
|
||||
void set_before_sweep(ssize_t v) { _before_sweep = v; }
|
||||
|
||||
ssize_t coalBirths() const { return _coalBirths; }
|
||||
void set_coalBirths(ssize_t v) { _coalBirths = v; }
|
||||
void increment_coalBirths() { _coalBirths++; }
|
||||
ssize_t coal_births() const { return _coal_births; }
|
||||
void set_coal_births(ssize_t v) { _coal_births = v; }
|
||||
void increment_coal_births() { _coal_births++; }
|
||||
|
||||
ssize_t coalDeaths() const { return _coalDeaths; }
|
||||
void set_coalDeaths(ssize_t v) { _coalDeaths = v; }
|
||||
void increment_coalDeaths() { _coalDeaths++; }
|
||||
ssize_t coal_deaths() const { return _coal_deaths; }
|
||||
void set_coal_deaths(ssize_t v) { _coal_deaths = v; }
|
||||
void increment_coal_deaths() { _coal_deaths++; }
|
||||
|
||||
ssize_t splitBirths() const { return _splitBirths; }
|
||||
void set_splitBirths(ssize_t v) { _splitBirths = v; }
|
||||
void increment_splitBirths() { _splitBirths++; }
|
||||
ssize_t split_births() const { return _split_births; }
|
||||
void set_split_births(ssize_t v) { _split_births = v; }
|
||||
void increment_split_births() { _split_births++; }
|
||||
|
||||
ssize_t splitDeaths() const { return _splitDeaths; }
|
||||
void set_splitDeaths(ssize_t v) { _splitDeaths = v; }
|
||||
void increment_splitDeaths() { _splitDeaths++; }
|
||||
ssize_t split_deaths() const { return _split_deaths; }
|
||||
void set_split_deaths(ssize_t v) { _split_deaths = v; }
|
||||
void increment_split_deaths() { _split_deaths++; }
|
||||
|
||||
NOT_PRODUCT(
|
||||
size_t returnedBytes() const { return _returnedBytes; }
|
||||
void set_returnedBytes(size_t v) { _returnedBytes = v; }
|
||||
size_t returned_bytes() const { return _returned_bytes; }
|
||||
void set_returned_bytes(size_t v) { _returned_bytes = v; }
|
||||
)
|
||||
};
|
||||
|
||||
|
@ -44,7 +44,7 @@ TreeChunk<Chunk>* TreeChunk<Chunk>::as_TreeChunk(Chunk* fc) {
|
||||
}
|
||||
|
||||
template <class Chunk>
|
||||
void TreeChunk<Chunk>::verifyTreeChunkList() const {
|
||||
void TreeChunk<Chunk>::verify_tree_chunk_list() const {
|
||||
TreeChunk<Chunk>* nextTC = (TreeChunk<Chunk>*)next();
|
||||
if (prev() != NULL) { // interior list node shouldn'r have tree fields
|
||||
guarantee(embedded_list()->parent() == NULL && embedded_list()->left() == NULL &&
|
||||
@ -53,7 +53,7 @@ void TreeChunk<Chunk>::verifyTreeChunkList() const {
|
||||
if (nextTC != NULL) {
|
||||
guarantee(as_TreeChunk(nextTC->prev()) == this, "broken chain");
|
||||
guarantee(nextTC->size() == size(), "wrong size");
|
||||
nextTC->verifyTreeChunkList();
|
||||
nextTC->verify_tree_chunk_list();
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,9 +73,9 @@ TreeList<Chunk>* TreeList<Chunk>::as_TreeList(TreeChunk<Chunk>* tc) {
|
||||
tl->link_tail(tc);
|
||||
tl->set_count(1);
|
||||
tl->init_statistics(true /* split_birth */);
|
||||
tl->setParent(NULL);
|
||||
tl->setLeft(NULL);
|
||||
tl->setRight(NULL);
|
||||
tl->set_parent(NULL);
|
||||
tl->set_left(NULL);
|
||||
tl->set_right(NULL);
|
||||
return tl;
|
||||
}
|
||||
|
||||
@ -92,15 +92,15 @@ TreeList<Chunk>* TreeList<Chunk>::as_TreeList(HeapWord* addr, size_t size) {
|
||||
SpaceMangler::is_mangled((HeapWord*) tc->next_addr())) ||
|
||||
(tc->size() == 0 && tc->prev() == NULL && tc->next() == NULL),
|
||||
"Space should be clear or mangled");
|
||||
tc->setSize(size);
|
||||
tc->linkPrev(NULL);
|
||||
tc->linkNext(NULL);
|
||||
tc->set_size(size);
|
||||
tc->link_prev(NULL);
|
||||
tc->link_next(NULL);
|
||||
TreeList<Chunk>* tl = TreeList<Chunk>::as_TreeList(tc);
|
||||
return tl;
|
||||
}
|
||||
|
||||
template <class Chunk>
|
||||
TreeList<Chunk>* TreeList<Chunk>::removeChunkReplaceIfNeeded(TreeChunk<Chunk>* tc) {
|
||||
TreeList<Chunk>* TreeList<Chunk>::remove_chunk_replace_if_needed(TreeChunk<Chunk>* tc) {
|
||||
|
||||
TreeList<Chunk>* retTL = this;
|
||||
Chunk* list = head();
|
||||
@ -108,7 +108,7 @@ TreeList<Chunk>* TreeList<Chunk>::removeChunkReplaceIfNeeded(TreeChunk<Chunk>* t
|
||||
assert(tc != NULL, "Chunk being removed is NULL");
|
||||
assert(parent() == NULL || this == parent()->left() ||
|
||||
this == parent()->right(), "list is inconsistent");
|
||||
assert(tc->isFree(), "Header is not marked correctly");
|
||||
assert(tc->is_free(), "Header is not marked correctly");
|
||||
assert(head() == NULL || head()->prev() == NULL, "list invariant");
|
||||
assert(tail() == NULL || tail()->next() == NULL, "list invariant");
|
||||
|
||||
@ -148,24 +148,24 @@ TreeList<Chunk>* TreeList<Chunk>::removeChunkReplaceIfNeeded(TreeChunk<Chunk>* t
|
||||
// Fix the parent to point to the new TreeList<Chunk>.
|
||||
if (retTL->parent() != NULL) {
|
||||
if (this == retTL->parent()->left()) {
|
||||
retTL->parent()->setLeft(retTL);
|
||||
retTL->parent()->set_left(retTL);
|
||||
} else {
|
||||
assert(this == retTL->parent()->right(), "Parent is incorrect");
|
||||
retTL->parent()->setRight(retTL);
|
||||
retTL->parent()->set_right(retTL);
|
||||
}
|
||||
}
|
||||
// Fix the children's parent pointers to point to the
|
||||
// new list.
|
||||
assert(right() == retTL->right(), "Should have been copied");
|
||||
if (retTL->right() != NULL) {
|
||||
retTL->right()->setParent(retTL);
|
||||
retTL->right()->set_parent(retTL);
|
||||
}
|
||||
assert(left() == retTL->left(), "Should have been copied");
|
||||
if (retTL->left() != NULL) {
|
||||
retTL->left()->setParent(retTL);
|
||||
retTL->left()->set_parent(retTL);
|
||||
}
|
||||
retTL->link_head(nextTC);
|
||||
assert(nextTC->isFree(), "Should be a free chunk");
|
||||
assert(nextTC->is_free(), "Should be a free chunk");
|
||||
}
|
||||
} else {
|
||||
if (nextTC == NULL) {
|
||||
@ -173,7 +173,7 @@ TreeList<Chunk>* TreeList<Chunk>::removeChunkReplaceIfNeeded(TreeChunk<Chunk>* t
|
||||
link_tail(prevFC);
|
||||
}
|
||||
// Chunk is interior to the list
|
||||
prevFC->linkAfter(nextTC);
|
||||
prevFC->link_after(nextTC);
|
||||
}
|
||||
|
||||
// Below this point the embeded TreeList<Chunk> being used for the
|
||||
@ -183,8 +183,8 @@ TreeList<Chunk>* TreeList<Chunk>::removeChunkReplaceIfNeeded(TreeChunk<Chunk>* t
|
||||
assert(!retTL->head() || retTL->size() == retTL->head()->size(),
|
||||
"Wrong sized chunk in list");
|
||||
debug_only(
|
||||
tc->linkPrev(NULL);
|
||||
tc->linkNext(NULL);
|
||||
tc->link_prev(NULL);
|
||||
tc->link_next(NULL);
|
||||
tc->set_list(NULL);
|
||||
bool prev_found = false;
|
||||
bool next_found = false;
|
||||
@ -207,7 +207,7 @@ TreeList<Chunk>* TreeList<Chunk>::removeChunkReplaceIfNeeded(TreeChunk<Chunk>* t
|
||||
)
|
||||
retTL->decrement_count();
|
||||
|
||||
assert(tc->isFree(), "Should still be a free chunk");
|
||||
assert(tc->is_free(), "Should still be a free chunk");
|
||||
assert(retTL->head() == NULL || retTL->head()->prev() == NULL,
|
||||
"list invariant");
|
||||
assert(retTL->tail() == NULL || retTL->tail()->next() == NULL,
|
||||
@ -216,22 +216,22 @@ TreeList<Chunk>* TreeList<Chunk>::removeChunkReplaceIfNeeded(TreeChunk<Chunk>* t
|
||||
}
|
||||
|
||||
template <class Chunk>
|
||||
void TreeList<Chunk>::returnChunkAtTail(TreeChunk<Chunk>* chunk) {
|
||||
void TreeList<Chunk>::return_chunk_at_tail(TreeChunk<Chunk>* chunk) {
|
||||
assert(chunk != NULL, "returning NULL chunk");
|
||||
assert(chunk->list() == this, "list should be set for chunk");
|
||||
assert(tail() != NULL, "The tree list is embedded in the first chunk");
|
||||
// which means that the list can never be empty.
|
||||
assert(!verifyChunkInFreeLists(chunk), "Double entry");
|
||||
assert(!verify_chunk_in_free_list(chunk), "Double entry");
|
||||
assert(head() == NULL || head()->prev() == NULL, "list invariant");
|
||||
assert(tail() == NULL || tail()->next() == NULL, "list invariant");
|
||||
|
||||
Chunk* fc = tail();
|
||||
fc->linkAfter(chunk);
|
||||
fc->link_after(chunk);
|
||||
link_tail(chunk);
|
||||
|
||||
assert(!tail() || size() == tail()->size(), "Wrong sized chunk in list");
|
||||
FreeList<Chunk>::increment_count();
|
||||
debug_only(increment_returnedBytes_by(chunk->size()*sizeof(HeapWord));)
|
||||
debug_only(increment_returned_bytes_by(chunk->size()*sizeof(HeapWord));)
|
||||
assert(head() == NULL || head()->prev() == NULL, "list invariant");
|
||||
assert(tail() == NULL || tail()->next() == NULL, "list invariant");
|
||||
}
|
||||
@ -241,25 +241,25 @@ void TreeList<Chunk>::returnChunkAtTail(TreeChunk<Chunk>* chunk) {
|
||||
// because the TreeList<Chunk> is embedded in the first TreeChunk<Chunk> in the
|
||||
// list. See the definition of TreeChunk<Chunk>.
|
||||
template <class Chunk>
|
||||
void TreeList<Chunk>::returnChunkAtHead(TreeChunk<Chunk>* chunk) {
|
||||
void TreeList<Chunk>::return_chunk_at_head(TreeChunk<Chunk>* chunk) {
|
||||
assert(chunk->list() == this, "list should be set for chunk");
|
||||
assert(head() != NULL, "The tree list is embedded in the first chunk");
|
||||
assert(chunk != NULL, "returning NULL chunk");
|
||||
assert(!verifyChunkInFreeLists(chunk), "Double entry");
|
||||
assert(!verify_chunk_in_free_list(chunk), "Double entry");
|
||||
assert(head() == NULL || head()->prev() == NULL, "list invariant");
|
||||
assert(tail() == NULL || tail()->next() == NULL, "list invariant");
|
||||
|
||||
Chunk* fc = head()->next();
|
||||
if (fc != NULL) {
|
||||
chunk->linkAfter(fc);
|
||||
chunk->link_after(fc);
|
||||
} else {
|
||||
assert(tail() == NULL, "List is inconsistent");
|
||||
link_tail(chunk);
|
||||
}
|
||||
head()->linkAfter(chunk);
|
||||
head()->link_after(chunk);
|
||||
assert(!head() || size() == head()->size(), "Wrong sized chunk in list");
|
||||
FreeList<Chunk>::increment_count();
|
||||
debug_only(increment_returnedBytes_by(chunk->size()*sizeof(HeapWord));)
|
||||
debug_only(increment_returned_bytes_by(chunk->size()*sizeof(HeapWord));)
|
||||
assert(head() == NULL || head()->prev() == NULL, "list invariant");
|
||||
assert(tail() == NULL || tail()->next() == NULL, "list invariant");
|
||||
}
|
||||
@ -314,7 +314,7 @@ TreeChunk<Chunk>* TreeList<Chunk>::largest_address() {
|
||||
template <class Chunk>
|
||||
BinaryTreeDictionary<Chunk>::BinaryTreeDictionary(bool adaptive_freelists, bool splay) :
|
||||
_splay(splay), _adaptive_freelists(adaptive_freelists),
|
||||
_totalSize(0), _totalFreeBlocks(0), _root(0) {}
|
||||
_total_size(0), _total_free_blocks(0), _root(0) {}
|
||||
|
||||
template <class Chunk>
|
||||
BinaryTreeDictionary<Chunk>::BinaryTreeDictionary(MemRegion mr,
|
||||
@ -329,26 +329,26 @@ BinaryTreeDictionary<Chunk>::BinaryTreeDictionary(MemRegion mr,
|
||||
assert(root()->right() == NULL, "reset check failed");
|
||||
assert(root()->head()->next() == NULL, "reset check failed");
|
||||
assert(root()->head()->prev() == NULL, "reset check failed");
|
||||
assert(totalSize() == root()->size(), "reset check failed");
|
||||
assert(totalFreeBlocks() == 1, "reset check failed");
|
||||
assert(total_size() == root()->size(), "reset check failed");
|
||||
assert(total_free_blocks() == 1, "reset check failed");
|
||||
}
|
||||
|
||||
template <class Chunk>
|
||||
void BinaryTreeDictionary<Chunk>::inc_totalSize(size_t inc) {
|
||||
_totalSize = _totalSize + inc;
|
||||
void BinaryTreeDictionary<Chunk>::inc_total_size(size_t inc) {
|
||||
_total_size = _total_size + inc;
|
||||
}
|
||||
|
||||
template <class Chunk>
|
||||
void BinaryTreeDictionary<Chunk>::dec_totalSize(size_t dec) {
|
||||
_totalSize = _totalSize - dec;
|
||||
void BinaryTreeDictionary<Chunk>::dec_total_size(size_t dec) {
|
||||
_total_size = _total_size - dec;
|
||||
}
|
||||
|
||||
template <class Chunk>
|
||||
void BinaryTreeDictionary<Chunk>::reset(MemRegion mr) {
|
||||
assert(mr.word_size() >= BinaryTreeDictionary<Chunk>::min_tree_chunk_size, "minimum chunk size");
|
||||
set_root(TreeList<Chunk>::as_TreeList(mr.start(), mr.word_size()));
|
||||
set_totalSize(mr.word_size());
|
||||
set_totalFreeBlocks(1);
|
||||
set_total_size(mr.word_size());
|
||||
set_total_free_blocks(1);
|
||||
}
|
||||
|
||||
template <class Chunk>
|
||||
@ -360,8 +360,8 @@ void BinaryTreeDictionary<Chunk>::reset(HeapWord* addr, size_t byte_size) {
|
||||
template <class Chunk>
|
||||
void BinaryTreeDictionary<Chunk>::reset() {
|
||||
set_root(NULL);
|
||||
set_totalSize(0);
|
||||
set_totalFreeBlocks(0);
|
||||
set_total_size(0);
|
||||
set_total_free_blocks(0);
|
||||
}
|
||||
|
||||
// Get a free block of size at least size from tree, or NULL.
|
||||
@ -374,13 +374,13 @@ void BinaryTreeDictionary<Chunk>::reset() {
|
||||
// node is replaced in place by its tree successor.
|
||||
template <class Chunk>
|
||||
TreeChunk<Chunk>*
|
||||
BinaryTreeDictionary<Chunk>::getChunkFromTree(size_t size, enum FreeBlockDictionary<Chunk>::Dither dither, bool splay)
|
||||
BinaryTreeDictionary<Chunk>::get_chunk_from_tree(size_t size, enum FreeBlockDictionary<Chunk>::Dither dither, bool splay)
|
||||
{
|
||||
TreeList<Chunk> *curTL, *prevTL;
|
||||
TreeChunk<Chunk>* retTC = NULL;
|
||||
assert(size >= BinaryTreeDictionary<Chunk>::min_tree_chunk_size, "minimum chunk size");
|
||||
if (FLSVerifyDictionary) {
|
||||
verifyTree();
|
||||
verify_tree();
|
||||
}
|
||||
// starting at the root, work downwards trying to find match.
|
||||
// Remember the last node of size too great or too small.
|
||||
@ -421,7 +421,7 @@ BinaryTreeDictionary<Chunk>::getChunkFromTree(size_t size, enum FreeBlockDiction
|
||||
while (hintTL->hint() != 0) {
|
||||
assert(hintTL->hint() == 0 || hintTL->hint() > hintTL->size(),
|
||||
"hint points in the wrong direction");
|
||||
hintTL = findList(hintTL->hint());
|
||||
hintTL = find_list(hintTL->hint());
|
||||
assert(curTL != hintTL, "Infinite loop");
|
||||
if (hintTL == NULL ||
|
||||
hintTL == curTL /* Should not happen but protect against it */ ) {
|
||||
@ -448,15 +448,15 @@ BinaryTreeDictionary<Chunk>::getChunkFromTree(size_t size, enum FreeBlockDiction
|
||||
}
|
||||
// don't waste time splaying if chunk's singleton
|
||||
if (splay && curTL->head()->next() != NULL) {
|
||||
semiSplayStep(curTL);
|
||||
semi_splay_step(curTL);
|
||||
}
|
||||
retTC = curTL->first_available();
|
||||
assert((retTC != NULL) && (curTL->count() > 0),
|
||||
"A list in the binary tree should not be NULL");
|
||||
assert(retTC->size() >= size,
|
||||
"A chunk of the wrong size was found");
|
||||
removeChunkFromTree(retTC);
|
||||
assert(retTC->isFree(), "Header is not marked correctly");
|
||||
remove_chunk_from_tree(retTC);
|
||||
assert(retTC->is_free(), "Header is not marked correctly");
|
||||
}
|
||||
|
||||
if (FLSVerifyDictionary) {
|
||||
@ -466,7 +466,7 @@ BinaryTreeDictionary<Chunk>::getChunkFromTree(size_t size, enum FreeBlockDiction
|
||||
}
|
||||
|
||||
template <class Chunk>
|
||||
TreeList<Chunk>* BinaryTreeDictionary<Chunk>::findList(size_t size) const {
|
||||
TreeList<Chunk>* BinaryTreeDictionary<Chunk>::find_list(size_t size) const {
|
||||
TreeList<Chunk>* curTL;
|
||||
for (curTL = root(); curTL != NULL;) {
|
||||
if (curTL->size() == size) { // exact match
|
||||
@ -485,18 +485,18 @@ TreeList<Chunk>* BinaryTreeDictionary<Chunk>::findList(size_t size) const {
|
||||
|
||||
|
||||
template <class Chunk>
|
||||
bool BinaryTreeDictionary<Chunk>::verifyChunkInFreeLists(Chunk* tc) const {
|
||||
bool BinaryTreeDictionary<Chunk>::verify_chunk_in_free_list(Chunk* tc) const {
|
||||
size_t size = tc->size();
|
||||
TreeList<Chunk>* tl = findList(size);
|
||||
TreeList<Chunk>* tl = find_list(size);
|
||||
if (tl == NULL) {
|
||||
return false;
|
||||
} else {
|
||||
return tl->verifyChunkInFreeLists(tc);
|
||||
return tl->verify_chunk_in_free_list(tc);
|
||||
}
|
||||
}
|
||||
|
||||
template <class Chunk>
|
||||
Chunk* BinaryTreeDictionary<Chunk>::findLargestDict() const {
|
||||
Chunk* BinaryTreeDictionary<Chunk>::find_largest_dict() const {
|
||||
TreeList<Chunk> *curTL = root();
|
||||
if (curTL != NULL) {
|
||||
while(curTL->right() != NULL) curTL = curTL->right();
|
||||
@ -512,9 +512,9 @@ Chunk* BinaryTreeDictionary<Chunk>::findLargestDict() const {
|
||||
// remove the node and repair the tree.
|
||||
template <class Chunk>
|
||||
TreeChunk<Chunk>*
|
||||
BinaryTreeDictionary<Chunk>::removeChunkFromTree(TreeChunk<Chunk>* tc) {
|
||||
BinaryTreeDictionary<Chunk>::remove_chunk_from_tree(TreeChunk<Chunk>* tc) {
|
||||
assert(tc != NULL, "Should not call with a NULL chunk");
|
||||
assert(tc->isFree(), "Header is not marked correctly");
|
||||
assert(tc->is_free(), "Header is not marked correctly");
|
||||
|
||||
TreeList<Chunk> *newTL, *parentTL;
|
||||
TreeChunk<Chunk>* retTC;
|
||||
@ -534,13 +534,13 @@ BinaryTreeDictionary<Chunk>::removeChunkFromTree(TreeChunk<Chunk>* tc) {
|
||||
assert(tl->parent() == NULL || tl == tl->parent()->left() ||
|
||||
tl == tl->parent()->right(), "list is inconsistent");
|
||||
|
||||
bool complicatedSplice = false;
|
||||
bool complicated_splice = false;
|
||||
|
||||
retTC = tc;
|
||||
// Removing this chunk can have the side effect of changing the node
|
||||
// (TreeList<Chunk>*) in the tree. If the node is the root, update it.
|
||||
TreeList<Chunk>* replacementTL = tl->removeChunkReplaceIfNeeded(tc);
|
||||
assert(tc->isFree(), "Chunk should still be free");
|
||||
TreeList<Chunk>* replacementTL = tl->remove_chunk_replace_if_needed(tc);
|
||||
assert(tc->is_free(), "Chunk should still be free");
|
||||
assert(replacementTL->parent() == NULL ||
|
||||
replacementTL == replacementTL->parent()->left() ||
|
||||
replacementTL == replacementTL->parent()->right(),
|
||||
@ -570,15 +570,15 @@ BinaryTreeDictionary<Chunk>::removeChunkFromTree(TreeChunk<Chunk>* tc) {
|
||||
if (replacementTL->left() == NULL) {
|
||||
// left is NULL so pick right. right may also be NULL.
|
||||
newTL = replacementTL->right();
|
||||
debug_only(replacementTL->clearRight();)
|
||||
debug_only(replacementTL->clear_right();)
|
||||
} else if (replacementTL->right() == NULL) {
|
||||
// right is NULL
|
||||
newTL = replacementTL->left();
|
||||
debug_only(replacementTL->clearLeft();)
|
||||
} else { // we have both children, so, by patriarchal convention,
|
||||
// my replacement is least node in right sub-tree
|
||||
complicatedSplice = true;
|
||||
newTL = removeTreeMinimum(replacementTL->right());
|
||||
complicated_splice = true;
|
||||
newTL = remove_tree_minimum(replacementTL->right());
|
||||
assert(newTL != NULL && newTL->left() == NULL &&
|
||||
newTL->right() == NULL, "sub-tree minimum exists");
|
||||
}
|
||||
@ -586,7 +586,7 @@ BinaryTreeDictionary<Chunk>::removeChunkFromTree(TreeChunk<Chunk>* tc) {
|
||||
// newTL may be NULL.
|
||||
// should verify; we just cleanly excised our replacement
|
||||
if (FLSVerifyDictionary) {
|
||||
verifyTree();
|
||||
verify_tree();
|
||||
}
|
||||
// first make newTL my parent's child
|
||||
if ((parentTL = replacementTL->parent()) == NULL) {
|
||||
@ -594,35 +594,35 @@ BinaryTreeDictionary<Chunk>::removeChunkFromTree(TreeChunk<Chunk>* tc) {
|
||||
assert(tl == root(), "Incorrectly replacing root");
|
||||
set_root(newTL);
|
||||
if (newTL != NULL) {
|
||||
newTL->clearParent();
|
||||
newTL->clear_parent();
|
||||
}
|
||||
} else if (parentTL->right() == replacementTL) {
|
||||
// replacementTL is a right child
|
||||
parentTL->setRight(newTL);
|
||||
parentTL->set_right(newTL);
|
||||
} else { // replacementTL is a left child
|
||||
assert(parentTL->left() == replacementTL, "should be left child");
|
||||
parentTL->setLeft(newTL);
|
||||
parentTL->set_left(newTL);
|
||||
}
|
||||
debug_only(replacementTL->clearParent();)
|
||||
if (complicatedSplice) { // we need newTL to get replacementTL's
|
||||
debug_only(replacementTL->clear_parent();)
|
||||
if (complicated_splice) { // we need newTL to get replacementTL's
|
||||
// two children
|
||||
assert(newTL != NULL &&
|
||||
newTL->left() == NULL && newTL->right() == NULL,
|
||||
"newTL should not have encumbrances from the past");
|
||||
// we'd like to assert as below:
|
||||
// assert(replacementTL->left() != NULL && replacementTL->right() != NULL,
|
||||
// "else !complicatedSplice");
|
||||
// "else !complicated_splice");
|
||||
// ... however, the above assertion is too strong because we aren't
|
||||
// guaranteed that replacementTL->right() is still NULL.
|
||||
// Recall that we removed
|
||||
// the right sub-tree minimum from replacementTL.
|
||||
// That may well have been its right
|
||||
// child! So we'll just assert half of the above:
|
||||
assert(replacementTL->left() != NULL, "else !complicatedSplice");
|
||||
newTL->setLeft(replacementTL->left());
|
||||
newTL->setRight(replacementTL->right());
|
||||
assert(replacementTL->left() != NULL, "else !complicated_splice");
|
||||
newTL->set_left(replacementTL->left());
|
||||
newTL->set_right(replacementTL->right());
|
||||
debug_only(
|
||||
replacementTL->clearRight();
|
||||
replacementTL->clear_right();
|
||||
replacementTL->clearLeft();
|
||||
)
|
||||
}
|
||||
@ -632,16 +632,16 @@ BinaryTreeDictionary<Chunk>::removeChunkFromTree(TreeChunk<Chunk>* tc) {
|
||||
"delete without encumbrances");
|
||||
}
|
||||
|
||||
assert(totalSize() >= retTC->size(), "Incorrect total size");
|
||||
dec_totalSize(retTC->size()); // size book-keeping
|
||||
assert(totalFreeBlocks() > 0, "Incorrect total count");
|
||||
set_totalFreeBlocks(totalFreeBlocks() - 1);
|
||||
assert(total_size() >= retTC->size(), "Incorrect total size");
|
||||
dec_total_size(retTC->size()); // size book-keeping
|
||||
assert(total_free_blocks() > 0, "Incorrect total count");
|
||||
set_total_free_blocks(total_free_blocks() - 1);
|
||||
|
||||
assert(retTC != NULL, "null chunk?");
|
||||
assert(retTC->prev() == NULL && retTC->next() == NULL,
|
||||
"should return without encumbrances");
|
||||
if (FLSVerifyDictionary) {
|
||||
verifyTree();
|
||||
verify_tree();
|
||||
}
|
||||
assert(!removing_only_chunk || _root == NULL, "root should be NULL");
|
||||
return TreeChunk<Chunk>::as_TreeChunk(retTC);
|
||||
@ -651,7 +651,7 @@ BinaryTreeDictionary<Chunk>::removeChunkFromTree(TreeChunk<Chunk>* tc) {
|
||||
// If lm has a right child, link it to the left node of
|
||||
// the parent of lm.
|
||||
template <class Chunk>
|
||||
TreeList<Chunk>* BinaryTreeDictionary<Chunk>::removeTreeMinimum(TreeList<Chunk>* tl) {
|
||||
TreeList<Chunk>* BinaryTreeDictionary<Chunk>::remove_tree_minimum(TreeList<Chunk>* tl) {
|
||||
assert(tl != NULL && tl->parent() != NULL, "really need a proper sub-tree");
|
||||
// locate the subtree minimum by walking down left branches
|
||||
TreeList<Chunk>* curTL = tl;
|
||||
@ -660,12 +660,12 @@ TreeList<Chunk>* BinaryTreeDictionary<Chunk>::removeTreeMinimum(TreeList<Chunk>*
|
||||
if (curTL != root()) { // Should this test just be removed?
|
||||
TreeList<Chunk>* parentTL = curTL->parent();
|
||||
if (parentTL->left() == curTL) { // curTL is a left child
|
||||
parentTL->setLeft(curTL->right());
|
||||
parentTL->set_left(curTL->right());
|
||||
} else {
|
||||
// If the list tl has no left child, then curTL may be
|
||||
// the right child of parentTL.
|
||||
assert(parentTL->right() == curTL, "should be a right child");
|
||||
parentTL->setRight(curTL->right());
|
||||
parentTL->set_right(curTL->right());
|
||||
}
|
||||
} else {
|
||||
// The only use of this method would not pass the root of the
|
||||
@ -675,12 +675,12 @@ TreeList<Chunk>* BinaryTreeDictionary<Chunk>::removeTreeMinimum(TreeList<Chunk>*
|
||||
set_root(NULL);
|
||||
}
|
||||
debug_only(
|
||||
curTL->clearParent(); // Test if this needs to be cleared
|
||||
curTL->clearRight(); // recall, above, left child is already null
|
||||
curTL->clear_parent(); // Test if this needs to be cleared
|
||||
curTL->clear_right(); // recall, above, left child is already null
|
||||
)
|
||||
// we just excised a (non-root) node, we should still verify all tree invariants
|
||||
if (FLSVerifyDictionary) {
|
||||
verifyTree();
|
||||
verify_tree();
|
||||
}
|
||||
return curTL;
|
||||
}
|
||||
@ -694,7 +694,7 @@ TreeList<Chunk>* BinaryTreeDictionary<Chunk>::removeTreeMinimum(TreeList<Chunk>*
|
||||
// [Measurements will be needed to (in)validate this expectation.]
|
||||
|
||||
template <class Chunk>
|
||||
void BinaryTreeDictionary<Chunk>::semiSplayStep(TreeList<Chunk>* tc) {
|
||||
void BinaryTreeDictionary<Chunk>::semi_splay_step(TreeList<Chunk>* tc) {
|
||||
// apply a semi-splay step at the given node:
|
||||
// . if root, norting needs to be done
|
||||
// . if child of root, splay once
|
||||
@ -705,17 +705,17 @@ void BinaryTreeDictionary<Chunk>::semiSplayStep(TreeList<Chunk>* tc) {
|
||||
}
|
||||
|
||||
template <class Chunk>
|
||||
void BinaryTreeDictionary<Chunk>::insertChunkInTree(Chunk* fc) {
|
||||
void BinaryTreeDictionary<Chunk>::insert_chunk_in_tree(Chunk* fc) {
|
||||
TreeList<Chunk> *curTL, *prevTL;
|
||||
size_t size = fc->size();
|
||||
|
||||
assert(size >= BinaryTreeDictionary<Chunk>::min_tree_chunk_size, "too small to be a TreeList<Chunk>");
|
||||
if (FLSVerifyDictionary) {
|
||||
verifyTree();
|
||||
verify_tree();
|
||||
}
|
||||
|
||||
fc->clearNext();
|
||||
fc->linkPrev(NULL);
|
||||
fc->clear_next();
|
||||
fc->link_prev(NULL);
|
||||
|
||||
// work down from the _root, looking for insertion point
|
||||
for (prevTL = curTL = root(); curTL != NULL;) {
|
||||
@ -735,10 +735,10 @@ void BinaryTreeDictionary<Chunk>::insertChunkInTree(Chunk* fc) {
|
||||
tc->initialize();
|
||||
if (curTL != NULL) { // exact match
|
||||
tc->set_list(curTL);
|
||||
curTL->returnChunkAtTail(tc);
|
||||
curTL->return_chunk_at_tail(tc);
|
||||
} else { // need a new node in tree
|
||||
tc->clearNext();
|
||||
tc->linkPrev(NULL);
|
||||
tc->clear_next();
|
||||
tc->link_prev(NULL);
|
||||
TreeList<Chunk>* newTL = TreeList<Chunk>::as_TreeList(tc);
|
||||
assert(((TreeChunk<Chunk>*)tc)->list() == newTL,
|
||||
"List was not initialized correctly");
|
||||
@ -748,28 +748,28 @@ void BinaryTreeDictionary<Chunk>::insertChunkInTree(Chunk* fc) {
|
||||
} else { // insert under prevTL ...
|
||||
if (prevTL->size() < size) { // am right child
|
||||
assert(prevTL->right() == NULL, "control point invariant");
|
||||
prevTL->setRight(newTL);
|
||||
prevTL->set_right(newTL);
|
||||
} else { // am left child
|
||||
assert(prevTL->size() > size && prevTL->left() == NULL, "cpt pt inv");
|
||||
prevTL->setLeft(newTL);
|
||||
prevTL->set_left(newTL);
|
||||
}
|
||||
}
|
||||
}
|
||||
assert(tc->list() != NULL, "Tree list should be set");
|
||||
|
||||
inc_totalSize(size);
|
||||
// Method 'totalSizeInTree' walks through the every block in the
|
||||
inc_total_size(size);
|
||||
// Method 'total_size_in_tree' walks through the every block in the
|
||||
// tree, so it can cause significant performance loss if there are
|
||||
// many blocks in the tree
|
||||
assert(!FLSVerifyDictionary || totalSizeInTree(root()) == totalSize(), "_totalSize inconsistency");
|
||||
set_totalFreeBlocks(totalFreeBlocks() + 1);
|
||||
assert(!FLSVerifyDictionary || total_size_in_tree(root()) == total_size(), "_total_size inconsistency");
|
||||
set_total_free_blocks(total_free_blocks() + 1);
|
||||
if (FLSVerifyDictionary) {
|
||||
verifyTree();
|
||||
verify_tree();
|
||||
}
|
||||
}
|
||||
|
||||
template <class Chunk>
|
||||
size_t BinaryTreeDictionary<Chunk>::maxChunkSize() const {
|
||||
size_t BinaryTreeDictionary<Chunk>::max_chunk_size() const {
|
||||
FreeBlockDictionary<Chunk>::verify_par_locked();
|
||||
TreeList<Chunk>* tc = root();
|
||||
if (tc == NULL) return 0;
|
||||
@ -778,7 +778,7 @@ size_t BinaryTreeDictionary<Chunk>::maxChunkSize() const {
|
||||
}
|
||||
|
||||
template <class Chunk>
|
||||
size_t BinaryTreeDictionary<Chunk>::totalListLength(TreeList<Chunk>* tl) const {
|
||||
size_t BinaryTreeDictionary<Chunk>::total_list_length(TreeList<Chunk>* tl) const {
|
||||
size_t res;
|
||||
res = tl->count();
|
||||
#ifdef ASSERT
|
||||
@ -791,12 +791,12 @@ size_t BinaryTreeDictionary<Chunk>::totalListLength(TreeList<Chunk>* tl) const {
|
||||
}
|
||||
|
||||
template <class Chunk>
|
||||
size_t BinaryTreeDictionary<Chunk>::totalSizeInTree(TreeList<Chunk>* tl) const {
|
||||
size_t BinaryTreeDictionary<Chunk>::total_size_in_tree(TreeList<Chunk>* tl) const {
|
||||
if (tl == NULL)
|
||||
return 0;
|
||||
return (tl->size() * totalListLength(tl)) +
|
||||
totalSizeInTree(tl->left()) +
|
||||
totalSizeInTree(tl->right());
|
||||
return (tl->size() * total_list_length(tl)) +
|
||||
total_size_in_tree(tl->left()) +
|
||||
total_size_in_tree(tl->right());
|
||||
}
|
||||
|
||||
template <class Chunk>
|
||||
@ -805,73 +805,73 @@ double BinaryTreeDictionary<Chunk>::sum_of_squared_block_sizes(TreeList<Chunk>*
|
||||
return 0.0;
|
||||
}
|
||||
double size = (double)(tl->size());
|
||||
double curr = size * size * totalListLength(tl);
|
||||
double curr = size * size * total_list_length(tl);
|
||||
curr += sum_of_squared_block_sizes(tl->left());
|
||||
curr += sum_of_squared_block_sizes(tl->right());
|
||||
return curr;
|
||||
}
|
||||
|
||||
template <class Chunk>
|
||||
size_t BinaryTreeDictionary<Chunk>::totalFreeBlocksInTree(TreeList<Chunk>* tl) const {
|
||||
size_t BinaryTreeDictionary<Chunk>::total_free_blocks_in_tree(TreeList<Chunk>* tl) const {
|
||||
if (tl == NULL)
|
||||
return 0;
|
||||
return totalListLength(tl) +
|
||||
totalFreeBlocksInTree(tl->left()) +
|
||||
totalFreeBlocksInTree(tl->right());
|
||||
return total_list_length(tl) +
|
||||
total_free_blocks_in_tree(tl->left()) +
|
||||
total_free_blocks_in_tree(tl->right());
|
||||
}
|
||||
|
||||
template <class Chunk>
|
||||
size_t BinaryTreeDictionary<Chunk>::numFreeBlocks() const {
|
||||
assert(totalFreeBlocksInTree(root()) == totalFreeBlocks(),
|
||||
"_totalFreeBlocks inconsistency");
|
||||
return totalFreeBlocks();
|
||||
size_t BinaryTreeDictionary<Chunk>::num_free_blocks() const {
|
||||
assert(total_free_blocks_in_tree(root()) == total_free_blocks(),
|
||||
"_total_free_blocks inconsistency");
|
||||
return total_free_blocks();
|
||||
}
|
||||
|
||||
template <class Chunk>
|
||||
size_t BinaryTreeDictionary<Chunk>::treeHeightHelper(TreeList<Chunk>* tl) const {
|
||||
size_t BinaryTreeDictionary<Chunk>::tree_height_helper(TreeList<Chunk>* tl) const {
|
||||
if (tl == NULL)
|
||||
return 0;
|
||||
return 1 + MAX2(treeHeightHelper(tl->left()),
|
||||
treeHeightHelper(tl->right()));
|
||||
return 1 + MAX2(tree_height_helper(tl->left()),
|
||||
tree_height_helper(tl->right()));
|
||||
}
|
||||
|
||||
template <class Chunk>
|
||||
size_t BinaryTreeDictionary<Chunk>::treeHeight() const {
|
||||
return treeHeightHelper(root());
|
||||
return tree_height_helper(root());
|
||||
}
|
||||
|
||||
template <class Chunk>
|
||||
size_t BinaryTreeDictionary<Chunk>::totalNodesHelper(TreeList<Chunk>* tl) const {
|
||||
size_t BinaryTreeDictionary<Chunk>::total_nodes_helper(TreeList<Chunk>* tl) const {
|
||||
if (tl == NULL) {
|
||||
return 0;
|
||||
}
|
||||
return 1 + totalNodesHelper(tl->left()) +
|
||||
totalNodesHelper(tl->right());
|
||||
return 1 + total_nodes_helper(tl->left()) +
|
||||
total_nodes_helper(tl->right());
|
||||
}
|
||||
|
||||
template <class Chunk>
|
||||
size_t BinaryTreeDictionary<Chunk>::totalNodesInTree(TreeList<Chunk>* tl) const {
|
||||
return totalNodesHelper(root());
|
||||
size_t BinaryTreeDictionary<Chunk>::total_nodes_in_tree(TreeList<Chunk>* tl) const {
|
||||
return total_nodes_helper(root());
|
||||
}
|
||||
|
||||
template <class Chunk>
|
||||
void BinaryTreeDictionary<Chunk>::dictCensusUpdate(size_t size, bool split, bool birth){
|
||||
TreeList<Chunk>* nd = findList(size);
|
||||
void BinaryTreeDictionary<Chunk>::dict_census_udpate(size_t size, bool split, bool birth){
|
||||
TreeList<Chunk>* nd = find_list(size);
|
||||
if (nd) {
|
||||
if (split) {
|
||||
if (birth) {
|
||||
nd->increment_splitBirths();
|
||||
nd->increment_split_births();
|
||||
nd->increment_surplus();
|
||||
} else {
|
||||
nd->increment_splitDeaths();
|
||||
nd->increment_split_deaths();
|
||||
nd->decrement_surplus();
|
||||
}
|
||||
} else {
|
||||
if (birth) {
|
||||
nd->increment_coalBirths();
|
||||
nd->increment_coal_births();
|
||||
nd->increment_surplus();
|
||||
} else {
|
||||
nd->increment_coalDeaths();
|
||||
nd->increment_coal_deaths();
|
||||
nd->decrement_surplus();
|
||||
}
|
||||
}
|
||||
@ -884,13 +884,13 @@ void BinaryTreeDictionary<Chunk>::dictCensusUpdate(size_t size, bool split, bool
|
||||
}
|
||||
|
||||
template <class Chunk>
|
||||
bool BinaryTreeDictionary<Chunk>::coalDictOverPopulated(size_t size) {
|
||||
bool BinaryTreeDictionary<Chunk>::coal_dict_over_populated(size_t size) {
|
||||
if (FLSAlwaysCoalesceLarge) return true;
|
||||
|
||||
TreeList<Chunk>* list_of_size = findList(size);
|
||||
TreeList<Chunk>* list_of_size = find_list(size);
|
||||
// None of requested size implies overpopulated.
|
||||
return list_of_size == NULL || list_of_size->coalDesired() <= 0 ||
|
||||
list_of_size->count() > list_of_size->coalDesired();
|
||||
return list_of_size == NULL || list_of_size->coal_desired() <= 0 ||
|
||||
list_of_size->count() > list_of_size->coal_desired();
|
||||
}
|
||||
|
||||
// Closures for walking the binary tree.
|
||||
@ -952,9 +952,9 @@ class BeginSweepClosure : public AscendTreeCensusClosure<Chunk> {
|
||||
void do_list(FreeList<Chunk>* fl) {
|
||||
double coalSurplusPercent = _percentage;
|
||||
fl->compute_desired(_inter_sweep_current, _inter_sweep_estimate, _intra_sweep_estimate);
|
||||
fl->set_coalDesired((ssize_t)((double)fl->desired() * coalSurplusPercent));
|
||||
fl->set_beforeSweep(fl->count());
|
||||
fl->set_bfrSurp(fl->surplus());
|
||||
fl->set_coal_desired((ssize_t)((double)fl->desired() * coalSurplusPercent));
|
||||
fl->set_before_sweep(fl->count());
|
||||
fl->set_bfr_surp(fl->surplus());
|
||||
}
|
||||
};
|
||||
|
||||
@ -1031,7 +1031,7 @@ Chunk* BinaryTreeDictionary<Chunk>::find_chunk_ends_at(HeapWord* target) const {
|
||||
}
|
||||
|
||||
template <class Chunk>
|
||||
void BinaryTreeDictionary<Chunk>::beginSweepDictCensus(double coalSurplusPercent,
|
||||
void BinaryTreeDictionary<Chunk>::begin_sweep_dict_census(double coalSurplusPercent,
|
||||
float inter_sweep_current, float inter_sweep_estimate, float intra_sweep_estimate) {
|
||||
BeginSweepClosure<Chunk> bsc(coalSurplusPercent, inter_sweep_current,
|
||||
inter_sweep_estimate,
|
||||
@ -1046,33 +1046,33 @@ template <class Chunk>
|
||||
class InitializeDictReturnedBytesClosure : public AscendTreeCensusClosure<Chunk> {
|
||||
public:
|
||||
void do_list(FreeList<Chunk>* fl) {
|
||||
fl->set_returnedBytes(0);
|
||||
fl->set_returned_bytes(0);
|
||||
}
|
||||
};
|
||||
|
||||
template <class Chunk>
|
||||
void BinaryTreeDictionary<Chunk>::initializeDictReturnedBytes() {
|
||||
void BinaryTreeDictionary<Chunk>::initialize_dict_returned_bytes() {
|
||||
InitializeDictReturnedBytesClosure<Chunk> idrb;
|
||||
idrb.do_tree(root());
|
||||
}
|
||||
|
||||
template <class Chunk>
|
||||
class ReturnedBytesClosure : public AscendTreeCensusClosure<Chunk> {
|
||||
size_t _dictReturnedBytes;
|
||||
size_t _dict_returned_bytes;
|
||||
public:
|
||||
ReturnedBytesClosure() { _dictReturnedBytes = 0; }
|
||||
ReturnedBytesClosure() { _dict_returned_bytes = 0; }
|
||||
void do_list(FreeList<Chunk>* fl) {
|
||||
_dictReturnedBytes += fl->returnedBytes();
|
||||
_dict_returned_bytes += fl->returned_bytes();
|
||||
}
|
||||
size_t dictReturnedBytes() { return _dictReturnedBytes; }
|
||||
size_t dict_returned_bytes() { return _dict_returned_bytes; }
|
||||
};
|
||||
|
||||
template <class Chunk>
|
||||
size_t BinaryTreeDictionary<Chunk>::sumDictReturnedBytes() {
|
||||
size_t BinaryTreeDictionary<Chunk>::sum_dict_returned_bytes() {
|
||||
ReturnedBytesClosure<Chunk> rbc;
|
||||
rbc.do_tree(root());
|
||||
|
||||
return rbc.dictReturnedBytes();
|
||||
return rbc.dict_returned_bytes();
|
||||
}
|
||||
|
||||
// Count the number of entries in the tree.
|
||||
@ -1087,7 +1087,7 @@ class treeCountClosure : public DescendTreeCensusClosure<Chunk> {
|
||||
};
|
||||
|
||||
template <class Chunk>
|
||||
size_t BinaryTreeDictionary<Chunk>::totalCount() {
|
||||
size_t BinaryTreeDictionary<Chunk>::total_count() {
|
||||
treeCountClosure<Chunk> ctc(0);
|
||||
ctc.do_tree(root());
|
||||
return ctc.count;
|
||||
@ -1108,7 +1108,7 @@ class setTreeSurplusClosure : public AscendTreeCensusClosure<Chunk> {
|
||||
};
|
||||
|
||||
template <class Chunk>
|
||||
void BinaryTreeDictionary<Chunk>::setTreeSurplus(double splitSurplusPercent) {
|
||||
void BinaryTreeDictionary<Chunk>::set_tree_surplus(double splitSurplusPercent) {
|
||||
setTreeSurplusClosure<Chunk> sts(splitSurplusPercent);
|
||||
sts.do_tree(root());
|
||||
}
|
||||
@ -1130,7 +1130,7 @@ class setTreeHintsClosure : public DescendTreeCensusClosure<Chunk> {
|
||||
};
|
||||
|
||||
template <class Chunk>
|
||||
void BinaryTreeDictionary<Chunk>::setTreeHints(void) {
|
||||
void BinaryTreeDictionary<Chunk>::set_tree_hints(void) {
|
||||
setTreeHintsClosure<Chunk> sth(0);
|
||||
sth.do_tree(root());
|
||||
}
|
||||
@ -1139,45 +1139,45 @@ void BinaryTreeDictionary<Chunk>::setTreeHints(void) {
|
||||
template <class Chunk>
|
||||
class clearTreeCensusClosure : public AscendTreeCensusClosure<Chunk> {
|
||||
void do_list(FreeList<Chunk>* fl) {
|
||||
fl->set_prevSweep(fl->count());
|
||||
fl->set_coalBirths(0);
|
||||
fl->set_coalDeaths(0);
|
||||
fl->set_splitBirths(0);
|
||||
fl->set_splitDeaths(0);
|
||||
fl->set_prev_sweep(fl->count());
|
||||
fl->set_coal_births(0);
|
||||
fl->set_coal_deaths(0);
|
||||
fl->set_split_births(0);
|
||||
fl->set_split_deaths(0);
|
||||
}
|
||||
};
|
||||
|
||||
template <class Chunk>
|
||||
void BinaryTreeDictionary<Chunk>::clearTreeCensus(void) {
|
||||
void BinaryTreeDictionary<Chunk>::clear_tree_census(void) {
|
||||
clearTreeCensusClosure<Chunk> ctc;
|
||||
ctc.do_tree(root());
|
||||
}
|
||||
|
||||
// Do reporting and post sweep clean up.
|
||||
template <class Chunk>
|
||||
void BinaryTreeDictionary<Chunk>::endSweepDictCensus(double splitSurplusPercent) {
|
||||
void BinaryTreeDictionary<Chunk>::end_sweep_dict_census(double splitSurplusPercent) {
|
||||
// Does walking the tree 3 times hurt?
|
||||
setTreeSurplus(splitSurplusPercent);
|
||||
setTreeHints();
|
||||
set_tree_surplus(splitSurplusPercent);
|
||||
set_tree_hints();
|
||||
if (PrintGC && Verbose) {
|
||||
reportStatistics();
|
||||
report_statistics();
|
||||
}
|
||||
clearTreeCensus();
|
||||
clear_tree_census();
|
||||
}
|
||||
|
||||
// Print summary statistics
|
||||
template <class Chunk>
|
||||
void BinaryTreeDictionary<Chunk>::reportStatistics() const {
|
||||
void BinaryTreeDictionary<Chunk>::report_statistics() const {
|
||||
FreeBlockDictionary<Chunk>::verify_par_locked();
|
||||
gclog_or_tty->print("Statistics for BinaryTreeDictionary:\n"
|
||||
"------------------------------------\n");
|
||||
size_t totalSize = totalChunkSize(debug_only(NULL));
|
||||
size_t freeBlocks = numFreeBlocks();
|
||||
gclog_or_tty->print("Total Free Space: %d\n", totalSize);
|
||||
gclog_or_tty->print("Max Chunk Size: %d\n", maxChunkSize());
|
||||
gclog_or_tty->print("Number of Blocks: %d\n", freeBlocks);
|
||||
if (freeBlocks > 0) {
|
||||
gclog_or_tty->print("Av. Block Size: %d\n", totalSize/freeBlocks);
|
||||
size_t total_size = total_chunk_size(debug_only(NULL));
|
||||
size_t free_blocks = num_free_blocks();
|
||||
gclog_or_tty->print("Total Free Space: %d\n", total_size);
|
||||
gclog_or_tty->print("Max Chunk Size: %d\n", max_chunk_size());
|
||||
gclog_or_tty->print("Number of Blocks: %d\n", free_blocks);
|
||||
if (free_blocks > 0) {
|
||||
gclog_or_tty->print("Av. Block Size: %d\n", total_size/free_blocks);
|
||||
}
|
||||
gclog_or_tty->print("Tree Height: %d\n", treeHeight());
|
||||
}
|
||||
@ -1188,38 +1188,38 @@ void BinaryTreeDictionary<Chunk>::reportStatistics() const {
|
||||
template <class Chunk>
|
||||
class PrintTreeCensusClosure : public AscendTreeCensusClosure<Chunk> {
|
||||
int _print_line;
|
||||
size_t _totalFree;
|
||||
size_t _total_free;
|
||||
FreeList<Chunk> _total;
|
||||
|
||||
public:
|
||||
PrintTreeCensusClosure() {
|
||||
_print_line = 0;
|
||||
_totalFree = 0;
|
||||
_total_free = 0;
|
||||
}
|
||||
FreeList<Chunk>* total() { return &_total; }
|
||||
size_t totalFree() { return _totalFree; }
|
||||
size_t total_free() { return _total_free; }
|
||||
void do_list(FreeList<Chunk>* fl) {
|
||||
if (++_print_line >= 40) {
|
||||
FreeList<Chunk>::print_labels_on(gclog_or_tty, "size");
|
||||
_print_line = 0;
|
||||
}
|
||||
fl->print_on(gclog_or_tty);
|
||||
_totalFree += fl->count() * fl->size() ;
|
||||
_total_free += fl->count() * fl->size() ;
|
||||
total()->set_count( total()->count() + fl->count() );
|
||||
total()->set_bfrSurp( total()->bfrSurp() + fl->bfrSurp() );
|
||||
total()->set_surplus( total()->splitDeaths() + fl->surplus() );
|
||||
total()->set_bfr_surp( total()->bfr_surp() + fl->bfr_surp() );
|
||||
total()->set_surplus( total()->split_deaths() + fl->surplus() );
|
||||
total()->set_desired( total()->desired() + fl->desired() );
|
||||
total()->set_prevSweep( total()->prevSweep() + fl->prevSweep() );
|
||||
total()->set_beforeSweep(total()->beforeSweep() + fl->beforeSweep());
|
||||
total()->set_coalBirths( total()->coalBirths() + fl->coalBirths() );
|
||||
total()->set_coalDeaths( total()->coalDeaths() + fl->coalDeaths() );
|
||||
total()->set_splitBirths(total()->splitBirths() + fl->splitBirths());
|
||||
total()->set_splitDeaths(total()->splitDeaths() + fl->splitDeaths());
|
||||
total()->set_prev_sweep( total()->prev_sweep() + fl->prev_sweep() );
|
||||
total()->set_before_sweep(total()->before_sweep() + fl->before_sweep());
|
||||
total()->set_coal_births( total()->coal_births() + fl->coal_births() );
|
||||
total()->set_coal_deaths( total()->coal_deaths() + fl->coal_deaths() );
|
||||
total()->set_split_births(total()->split_births() + fl->split_births());
|
||||
total()->set_split_deaths(total()->split_deaths() + fl->split_deaths());
|
||||
}
|
||||
};
|
||||
|
||||
template <class Chunk>
|
||||
void BinaryTreeDictionary<Chunk>::printDictCensus(void) const {
|
||||
void BinaryTreeDictionary<Chunk>::print_dict_census(void) const {
|
||||
|
||||
gclog_or_tty->print("\nBinaryTree\n");
|
||||
FreeList<Chunk>::print_labels_on(gclog_or_tty, "size");
|
||||
@ -1230,12 +1230,12 @@ void BinaryTreeDictionary<Chunk>::printDictCensus(void) const {
|
||||
FreeList<Chunk>::print_labels_on(gclog_or_tty, " ");
|
||||
total->print_on(gclog_or_tty, "TOTAL\t");
|
||||
gclog_or_tty->print(
|
||||
"totalFree(words): " SIZE_FORMAT_W(16)
|
||||
"total_free(words): " SIZE_FORMAT_W(16)
|
||||
" growth: %8.5f deficit: %8.5f\n",
|
||||
ptc.totalFree(),
|
||||
(double)(total->splitBirths() + total->coalBirths()
|
||||
- total->splitDeaths() - total->coalDeaths())
|
||||
/(total->prevSweep() != 0 ? (double)total->prevSweep() : 1.0),
|
||||
ptc.total_free(),
|
||||
(double)(total->split_births() + total->coal_births()
|
||||
- total->split_deaths() - total->coal_deaths())
|
||||
/(total->prev_sweep() != 0 ? (double)total->prev_sweep() : 1.0),
|
||||
(double)(total->desired() - total->count())
|
||||
/(total->desired() != 0 ? (double)total->desired() : 1.0));
|
||||
}
|
||||
@ -1279,19 +1279,19 @@ void BinaryTreeDictionary<Chunk>::print_free_lists(outputStream* st) const {
|
||||
// . parent and child point to each other
|
||||
// . each node's key correctly related to that of its child(ren)
|
||||
template <class Chunk>
|
||||
void BinaryTreeDictionary<Chunk>::verifyTree() const {
|
||||
guarantee(root() == NULL || totalFreeBlocks() == 0 ||
|
||||
totalSize() != 0, "_totalSize should't be 0?");
|
||||
void BinaryTreeDictionary<Chunk>::verify_tree() const {
|
||||
guarantee(root() == NULL || total_free_blocks() == 0 ||
|
||||
total_size() != 0, "_total_size should't be 0?");
|
||||
guarantee(root() == NULL || root()->parent() == NULL, "_root shouldn't have parent");
|
||||
verifyTreeHelper(root());
|
||||
verify_tree_helper(root());
|
||||
}
|
||||
|
||||
template <class Chunk>
|
||||
size_t BinaryTreeDictionary<Chunk>::verifyPrevFreePtrs(TreeList<Chunk>* tl) {
|
||||
size_t BinaryTreeDictionary<Chunk>::verify_prev_free_ptrs(TreeList<Chunk>* tl) {
|
||||
size_t ct = 0;
|
||||
for (Chunk* curFC = tl->head(); curFC != NULL; curFC = curFC->next()) {
|
||||
ct++;
|
||||
assert(curFC->prev() == NULL || curFC->prev()->isFree(),
|
||||
assert(curFC->prev() == NULL || curFC->prev()->is_free(),
|
||||
"Chunk should be free");
|
||||
}
|
||||
return ct;
|
||||
@ -1301,7 +1301,7 @@ size_t BinaryTreeDictionary<Chunk>::verifyPrevFreePtrs(TreeList<Chunk>* tl) {
|
||||
// caution on very deep trees; and watch out for stack overflow errors;
|
||||
// In general, to be used only for debugging.
|
||||
template <class Chunk>
|
||||
void BinaryTreeDictionary<Chunk>::verifyTreeHelper(TreeList<Chunk>* tl) const {
|
||||
void BinaryTreeDictionary<Chunk>::verify_tree_helper(TreeList<Chunk>* tl) const {
|
||||
if (tl == NULL)
|
||||
return;
|
||||
guarantee(tl->size() != 0, "A list must has a size");
|
||||
@ -1313,26 +1313,26 @@ void BinaryTreeDictionary<Chunk>::verifyTreeHelper(TreeList<Chunk>* tl) const {
|
||||
"parent !> left");
|
||||
guarantee(tl->right() == NULL || tl->right()->size() > tl->size(),
|
||||
"parent !< left");
|
||||
guarantee(tl->head() == NULL || tl->head()->isFree(), "!Free");
|
||||
guarantee(tl->head() == NULL || tl->head()->is_free(), "!Free");
|
||||
guarantee(tl->head() == NULL || tl->head_as_TreeChunk()->list() == tl,
|
||||
"list inconsistency");
|
||||
guarantee(tl->count() > 0 || (tl->head() == NULL && tl->tail() == NULL),
|
||||
"list count is inconsistent");
|
||||
guarantee(tl->count() > 1 || tl->head() == tl->tail(),
|
||||
"list is incorrectly constructed");
|
||||
size_t count = verifyPrevFreePtrs(tl);
|
||||
size_t count = verify_prev_free_ptrs(tl);
|
||||
guarantee(count == (size_t)tl->count(), "Node count is incorrect");
|
||||
if (tl->head() != NULL) {
|
||||
tl->head_as_TreeChunk()->verifyTreeChunkList();
|
||||
tl->head_as_TreeChunk()->verify_tree_chunk_list();
|
||||
}
|
||||
verifyTreeHelper(tl->left());
|
||||
verifyTreeHelper(tl->right());
|
||||
verify_tree_helper(tl->left());
|
||||
verify_tree_helper(tl->right());
|
||||
}
|
||||
|
||||
template <class Chunk>
|
||||
void BinaryTreeDictionary<Chunk>::verify() const {
|
||||
verifyTree();
|
||||
guarantee(totalSize() == totalSizeInTree(root()), "Total Size inconsistency");
|
||||
verify_tree();
|
||||
guarantee(total_size() == total_size_in_tree(root()), "Total Size inconsistency");
|
||||
}
|
||||
|
||||
#ifndef SERIALGC
|
||||
|
@ -70,22 +70,22 @@ class TreeList: public FreeList<Chunk> {
|
||||
|
||||
// Accessors for links in tree.
|
||||
|
||||
void setLeft(TreeList<Chunk>* tl) {
|
||||
void set_left(TreeList<Chunk>* tl) {
|
||||
_left = tl;
|
||||
if (tl != NULL)
|
||||
tl->setParent(this);
|
||||
tl->set_parent(this);
|
||||
}
|
||||
void setRight(TreeList<Chunk>* tl) {
|
||||
void set_right(TreeList<Chunk>* tl) {
|
||||
_right = tl;
|
||||
if (tl != NULL)
|
||||
tl->setParent(this);
|
||||
tl->set_parent(this);
|
||||
}
|
||||
void setParent(TreeList<Chunk>* tl) { _parent = tl; }
|
||||
void set_parent(TreeList<Chunk>* tl) { _parent = tl; }
|
||||
|
||||
void clearLeft() { _left = NULL; }
|
||||
void clearRight() { _right = NULL; }
|
||||
void clearParent() { _parent = NULL; }
|
||||
void initialize() { clearLeft(); clearRight(), clearParent(); }
|
||||
void clear_right() { _right = NULL; }
|
||||
void clear_parent() { _parent = NULL; }
|
||||
void initialize() { clearLeft(); clear_right(), clear_parent(); }
|
||||
|
||||
// For constructing a TreeList from a Tree chunk or
|
||||
// address and size.
|
||||
@ -104,16 +104,16 @@ class TreeList: public FreeList<Chunk> {
|
||||
// use with caution!
|
||||
TreeChunk<Chunk>* largest_address();
|
||||
|
||||
// removeChunkReplaceIfNeeded() removes the given "tc" from the TreeList.
|
||||
// remove_chunk_replace_if_needed() removes the given "tc" from the TreeList.
|
||||
// If "tc" is the first chunk in the list, it is also the
|
||||
// TreeList that is the node in the tree. removeChunkReplaceIfNeeded()
|
||||
// TreeList that is the node in the tree. remove_chunk_replace_if_needed()
|
||||
// returns the possibly replaced TreeList* for the node in
|
||||
// the tree. It also updates the parent of the original
|
||||
// node to point to the new node.
|
||||
TreeList<Chunk>* removeChunkReplaceIfNeeded(TreeChunk<Chunk>* tc);
|
||||
TreeList<Chunk>* remove_chunk_replace_if_needed(TreeChunk<Chunk>* tc);
|
||||
// See FreeList.
|
||||
void returnChunkAtHead(TreeChunk<Chunk>* tc);
|
||||
void returnChunkAtTail(TreeChunk<Chunk>* tc);
|
||||
void return_chunk_at_head(TreeChunk<Chunk>* tc);
|
||||
void return_chunk_at_tail(TreeChunk<Chunk>* tc);
|
||||
};
|
||||
|
||||
// A TreeChunk is a subclass of a Chunk that additionally
|
||||
@ -151,7 +151,7 @@ class TreeChunk : public Chunk {
|
||||
size_t size() const volatile { return Chunk::size(); }
|
||||
|
||||
// debugging
|
||||
void verifyTreeChunkList() const;
|
||||
void verify_tree_chunk_list() const;
|
||||
};
|
||||
|
||||
|
||||
@ -159,19 +159,19 @@ template <class Chunk>
|
||||
class BinaryTreeDictionary: public FreeBlockDictionary<Chunk> {
|
||||
friend class VMStructs;
|
||||
bool _splay;
|
||||
size_t _totalSize;
|
||||
size_t _totalFreeBlocks;
|
||||
size_t _total_size;
|
||||
size_t _total_free_blocks;
|
||||
TreeList<Chunk>* _root;
|
||||
bool _adaptive_freelists;
|
||||
|
||||
// private accessors
|
||||
bool splay() const { return _splay; }
|
||||
void set_splay(bool v) { _splay = v; }
|
||||
void set_totalSize(size_t v) { _totalSize = v; }
|
||||
virtual void inc_totalSize(size_t v);
|
||||
virtual void dec_totalSize(size_t v);
|
||||
size_t totalFreeBlocks() const { return _totalFreeBlocks; }
|
||||
void set_totalFreeBlocks(size_t v) { _totalFreeBlocks = v; }
|
||||
void set_total_size(size_t v) { _total_size = v; }
|
||||
virtual void inc_total_size(size_t v);
|
||||
virtual void dec_total_size(size_t v);
|
||||
size_t total_free_blocks() const { return _total_free_blocks; }
|
||||
void set_total_free_blocks(size_t v) { _total_free_blocks = v; }
|
||||
TreeList<Chunk>* root() const { return _root; }
|
||||
void set_root(TreeList<Chunk>* v) { _root = v; }
|
||||
bool adaptive_freelists() { return _adaptive_freelists; }
|
||||
@ -186,46 +186,46 @@ class BinaryTreeDictionary: public FreeBlockDictionary<Chunk> {
|
||||
// return it. If the chunk
|
||||
// is the last chunk of that size, remove the node for that size
|
||||
// from the tree.
|
||||
TreeChunk<Chunk>* getChunkFromTree(size_t size, enum FreeBlockDictionary<Chunk>::Dither dither, bool splay);
|
||||
TreeChunk<Chunk>* get_chunk_from_tree(size_t size, enum FreeBlockDictionary<Chunk>::Dither dither, bool splay);
|
||||
// Return a list of the specified size or NULL from the tree.
|
||||
// The list is not removed from the tree.
|
||||
TreeList<Chunk>* findList (size_t size) const;
|
||||
TreeList<Chunk>* find_list (size_t size) const;
|
||||
// Remove this chunk from the tree. If the removal results
|
||||
// in an empty list in the tree, remove the empty list.
|
||||
TreeChunk<Chunk>* removeChunkFromTree(TreeChunk<Chunk>* tc);
|
||||
TreeChunk<Chunk>* remove_chunk_from_tree(TreeChunk<Chunk>* tc);
|
||||
// Remove the node in the trees starting at tl that has the
|
||||
// minimum value and return it. Repair the tree as needed.
|
||||
TreeList<Chunk>* removeTreeMinimum(TreeList<Chunk>* tl);
|
||||
void semiSplayStep(TreeList<Chunk>* tl);
|
||||
TreeList<Chunk>* remove_tree_minimum(TreeList<Chunk>* tl);
|
||||
void semi_splay_step(TreeList<Chunk>* tl);
|
||||
// Add this free chunk to the tree.
|
||||
void insertChunkInTree(Chunk* freeChunk);
|
||||
void insert_chunk_in_tree(Chunk* freeChunk);
|
||||
public:
|
||||
|
||||
static const size_t min_tree_chunk_size = sizeof(TreeChunk<Chunk>)/HeapWordSize;
|
||||
|
||||
void verifyTree() const;
|
||||
void verify_tree() const;
|
||||
// verify that the given chunk is in the tree.
|
||||
bool verifyChunkInFreeLists(Chunk* tc) const;
|
||||
bool verify_chunk_in_free_list(Chunk* tc) const;
|
||||
private:
|
||||
void verifyTreeHelper(TreeList<Chunk>* tl) const;
|
||||
static size_t verifyPrevFreePtrs(TreeList<Chunk>* tl);
|
||||
void verify_tree_helper(TreeList<Chunk>* tl) const;
|
||||
static size_t verify_prev_free_ptrs(TreeList<Chunk>* tl);
|
||||
|
||||
// Returns the total number of chunks in the list.
|
||||
size_t totalListLength(TreeList<Chunk>* tl) const;
|
||||
size_t total_list_length(TreeList<Chunk>* tl) const;
|
||||
// Returns the total number of words in the chunks in the tree
|
||||
// starting at "tl".
|
||||
size_t totalSizeInTree(TreeList<Chunk>* tl) const;
|
||||
size_t total_size_in_tree(TreeList<Chunk>* tl) const;
|
||||
// Returns the sum of the square of the size of each block
|
||||
// in the tree starting at "tl".
|
||||
double sum_of_squared_block_sizes(TreeList<Chunk>* const tl) const;
|
||||
// Returns the total number of free blocks in the tree starting
|
||||
// at "tl".
|
||||
size_t totalFreeBlocksInTree(TreeList<Chunk>* tl) const;
|
||||
size_t numFreeBlocks() const;
|
||||
size_t total_free_blocks_in_tree(TreeList<Chunk>* tl) const;
|
||||
size_t num_free_blocks() const;
|
||||
size_t treeHeight() const;
|
||||
size_t treeHeightHelper(TreeList<Chunk>* tl) const;
|
||||
size_t totalNodesInTree(TreeList<Chunk>* tl) const;
|
||||
size_t totalNodesHelper(TreeList<Chunk>* tl) const;
|
||||
size_t tree_height_helper(TreeList<Chunk>* tl) const;
|
||||
size_t total_nodes_in_tree(TreeList<Chunk>* tl) const;
|
||||
size_t total_nodes_helper(TreeList<Chunk>* tl) const;
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
@ -233,7 +233,7 @@ class BinaryTreeDictionary: public FreeBlockDictionary<Chunk> {
|
||||
BinaryTreeDictionary(MemRegion mr, bool adaptive_freelists, bool splay = false);
|
||||
|
||||
// Public accessors
|
||||
size_t totalSize() const { return _totalSize; }
|
||||
size_t total_size() const { return _total_size; }
|
||||
|
||||
// Reset the dictionary to the initial conditions with
|
||||
// a single free chunk.
|
||||
@ -245,37 +245,37 @@ class BinaryTreeDictionary: public FreeBlockDictionary<Chunk> {
|
||||
// Return a chunk of size "size" or greater from
|
||||
// the tree.
|
||||
// want a better dynamic splay strategy for the future.
|
||||
Chunk* getChunk(size_t size, enum FreeBlockDictionary<Chunk>::Dither dither) {
|
||||
Chunk* get_chunk(size_t size, enum FreeBlockDictionary<Chunk>::Dither dither) {
|
||||
FreeBlockDictionary<Chunk>::verify_par_locked();
|
||||
Chunk* res = getChunkFromTree(size, dither, splay());
|
||||
assert(res == NULL || res->isFree(),
|
||||
Chunk* res = get_chunk_from_tree(size, dither, splay());
|
||||
assert(res == NULL || res->is_free(),
|
||||
"Should be returning a free chunk");
|
||||
return res;
|
||||
}
|
||||
|
||||
void returnChunk(Chunk* chunk) {
|
||||
void return_chunk(Chunk* chunk) {
|
||||
FreeBlockDictionary<Chunk>::verify_par_locked();
|
||||
insertChunkInTree(chunk);
|
||||
insert_chunk_in_tree(chunk);
|
||||
}
|
||||
|
||||
void removeChunk(Chunk* chunk) {
|
||||
void remove_chunk(Chunk* chunk) {
|
||||
FreeBlockDictionary<Chunk>::verify_par_locked();
|
||||
removeChunkFromTree((TreeChunk<Chunk>*)chunk);
|
||||
assert(chunk->isFree(), "Should still be a free chunk");
|
||||
remove_chunk_from_tree((TreeChunk<Chunk>*)chunk);
|
||||
assert(chunk->is_free(), "Should still be a free chunk");
|
||||
}
|
||||
|
||||
size_t maxChunkSize() const;
|
||||
size_t totalChunkSize(debug_only(const Mutex* lock)) const {
|
||||
size_t max_chunk_size() const;
|
||||
size_t total_chunk_size(debug_only(const Mutex* lock)) const {
|
||||
debug_only(
|
||||
if (lock != NULL && lock->owned_by_self()) {
|
||||
assert(totalSizeInTree(root()) == totalSize(),
|
||||
"_totalSize inconsistency");
|
||||
assert(total_size_in_tree(root()) == total_size(),
|
||||
"_total_size inconsistency");
|
||||
}
|
||||
)
|
||||
return totalSize();
|
||||
return total_size();
|
||||
}
|
||||
|
||||
size_t minSize() const {
|
||||
size_t min_size() const {
|
||||
return min_tree_chunk_size;
|
||||
}
|
||||
|
||||
@ -288,40 +288,40 @@ class BinaryTreeDictionary: public FreeBlockDictionary<Chunk> {
|
||||
// Find the list with size "size" in the binary tree and update
|
||||
// the statistics in the list according to "split" (chunk was
|
||||
// split or coalesce) and "birth" (chunk was added or removed).
|
||||
void dictCensusUpdate(size_t size, bool split, bool birth);
|
||||
void dict_census_udpate(size_t size, bool split, bool birth);
|
||||
// Return true if the dictionary is overpopulated (more chunks of
|
||||
// this size than desired) for size "size".
|
||||
bool coalDictOverPopulated(size_t size);
|
||||
bool coal_dict_over_populated(size_t size);
|
||||
// Methods called at the beginning of a sweep to prepare the
|
||||
// statistics for the sweep.
|
||||
void beginSweepDictCensus(double coalSurplusPercent,
|
||||
void begin_sweep_dict_census(double coalSurplusPercent,
|
||||
float inter_sweep_current,
|
||||
float inter_sweep_estimate,
|
||||
float intra_sweep_estimate);
|
||||
// Methods called after the end of a sweep to modify the
|
||||
// statistics for the sweep.
|
||||
void endSweepDictCensus(double splitSurplusPercent);
|
||||
void end_sweep_dict_census(double splitSurplusPercent);
|
||||
// Return the largest free chunk in the tree.
|
||||
Chunk* findLargestDict() const;
|
||||
Chunk* find_largest_dict() const;
|
||||
// Accessors for statistics
|
||||
void setTreeSurplus(double splitSurplusPercent);
|
||||
void setTreeHints(void);
|
||||
void set_tree_surplus(double splitSurplusPercent);
|
||||
void set_tree_hints(void);
|
||||
// Reset statistics for all the lists in the tree.
|
||||
void clearTreeCensus(void);
|
||||
void clear_tree_census(void);
|
||||
// Print the statistcis for all the lists in the tree. Also may
|
||||
// print out summaries.
|
||||
void printDictCensus(void) const;
|
||||
void print_dict_census(void) const;
|
||||
void print_free_lists(outputStream* st) const;
|
||||
|
||||
// For debugging. Returns the sum of the _returnedBytes for
|
||||
// For debugging. Returns the sum of the _returned_bytes for
|
||||
// all lists in the tree.
|
||||
size_t sumDictReturnedBytes() PRODUCT_RETURN0;
|
||||
// Sets the _returnedBytes for all the lists in the tree to zero.
|
||||
void initializeDictReturnedBytes() PRODUCT_RETURN;
|
||||
size_t sum_dict_returned_bytes() PRODUCT_RETURN0;
|
||||
// Sets the _returned_bytes for all the lists in the tree to zero.
|
||||
void initialize_dict_returned_bytes() PRODUCT_RETURN;
|
||||
// For debugging. Return the total number of chunks in the dictionary.
|
||||
size_t totalCount() PRODUCT_RETURN0;
|
||||
size_t total_count() PRODUCT_RETURN0;
|
||||
|
||||
void reportStatistics() const;
|
||||
void report_statistics() const;
|
||||
|
||||
void verify() const;
|
||||
};
|
||||
|
@ -52,8 +52,8 @@ template <class Chunk> void FreeBlockDictionary<Chunk>::set_par_lock(Mutex* lock
|
||||
template <class Chunk> void FreeBlockDictionary<Chunk>::verify_par_locked() const {
|
||||
#ifdef ASSERT
|
||||
if (ParallelGCThreads > 0) {
|
||||
Thread* myThread = Thread::current();
|
||||
if (myThread->is_GC_task_thread()) {
|
||||
Thread* my_thread = Thread::current();
|
||||
if (my_thread->is_GC_task_thread()) {
|
||||
assert(par_lock() != NULL, "Should be using locking?");
|
||||
assert_lock_strong(par_lock());
|
||||
}
|
||||
|
@ -51,45 +51,45 @@ class FreeBlockDictionary: public CHeapObj {
|
||||
NOT_PRODUCT(Mutex* _lock;)
|
||||
|
||||
public:
|
||||
virtual void removeChunk(Chunk* fc) = 0;
|
||||
virtual Chunk* getChunk(size_t size, Dither dither = atLeast) = 0;
|
||||
virtual void returnChunk(Chunk* chunk) = 0;
|
||||
virtual size_t totalChunkSize(debug_only(const Mutex* lock)) const = 0;
|
||||
virtual size_t maxChunkSize() const = 0;
|
||||
virtual size_t minSize() const = 0;
|
||||
virtual void remove_chunk(Chunk* fc) = 0;
|
||||
virtual Chunk* get_chunk(size_t size, Dither dither = atLeast) = 0;
|
||||
virtual void return_chunk(Chunk* chunk) = 0;
|
||||
virtual size_t total_chunk_size(debug_only(const Mutex* lock)) const = 0;
|
||||
virtual size_t max_chunk_size() const = 0;
|
||||
virtual size_t min_size() const = 0;
|
||||
// Reset the dictionary to the initial conditions for a single
|
||||
// block.
|
||||
virtual void reset(HeapWord* addr, size_t size) = 0;
|
||||
virtual void reset() = 0;
|
||||
|
||||
virtual void dictCensusUpdate(size_t size, bool split, bool birth) = 0;
|
||||
virtual bool coalDictOverPopulated(size_t size) = 0;
|
||||
virtual void beginSweepDictCensus(double coalSurplusPercent,
|
||||
virtual void dict_census_udpate(size_t size, bool split, bool birth) = 0;
|
||||
virtual bool coal_dict_over_populated(size_t size) = 0;
|
||||
virtual void begin_sweep_dict_census(double coalSurplusPercent,
|
||||
float inter_sweep_current, float inter_sweep_estimate,
|
||||
float intra__sweep_current) = 0;
|
||||
virtual void endSweepDictCensus(double splitSurplusPercent) = 0;
|
||||
virtual Chunk* findLargestDict() const = 0;
|
||||
virtual void end_sweep_dict_census(double splitSurplusPercent) = 0;
|
||||
virtual Chunk* find_largest_dict() const = 0;
|
||||
// verify that the given chunk is in the dictionary.
|
||||
virtual bool verifyChunkInFreeLists(Chunk* tc) const = 0;
|
||||
virtual bool verify_chunk_in_free_list(Chunk* tc) const = 0;
|
||||
|
||||
// Sigma_{all_free_blocks} (block_size^2)
|
||||
virtual double sum_of_squared_block_sizes() const = 0;
|
||||
|
||||
virtual Chunk* find_chunk_ends_at(HeapWord* target) const = 0;
|
||||
virtual void inc_totalSize(size_t v) = 0;
|
||||
virtual void dec_totalSize(size_t v) = 0;
|
||||
virtual void inc_total_size(size_t v) = 0;
|
||||
virtual void dec_total_size(size_t v) = 0;
|
||||
|
||||
NOT_PRODUCT (
|
||||
virtual size_t sumDictReturnedBytes() = 0;
|
||||
virtual void initializeDictReturnedBytes() = 0;
|
||||
virtual size_t totalCount() = 0;
|
||||
virtual size_t sum_dict_returned_bytes() = 0;
|
||||
virtual void initialize_dict_returned_bytes() = 0;
|
||||
virtual size_t total_count() = 0;
|
||||
)
|
||||
|
||||
virtual void reportStatistics() const {
|
||||
virtual void report_statistics() const {
|
||||
gclog_or_tty->print("No statistics available");
|
||||
}
|
||||
|
||||
virtual void printDictCensus() const = 0;
|
||||
virtual void print_dict_census() const = 0;
|
||||
virtual void print_free_lists(outputStream* st) const = 0;
|
||||
|
||||
virtual void verify() const = 0;
|
||||
|
@ -65,7 +65,7 @@ FreeList<Chunk>::FreeList(Chunk* fc) :
|
||||
_hint = 0;
|
||||
init_statistics();
|
||||
#ifndef PRODUCT
|
||||
_allocation_stats.set_returnedBytes(size() * HeapWordSize);
|
||||
_allocation_stats.set_returned_bytes(size() * HeapWordSize);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ void FreeList<Chunk>::init_statistics(bool split_birth) {
|
||||
}
|
||||
|
||||
template <class Chunk>
|
||||
Chunk* FreeList<Chunk>::getChunkAtHead() {
|
||||
Chunk* FreeList<Chunk>::get_chunk_at_head() {
|
||||
assert_proper_lock_protection();
|
||||
assert(head() == NULL || head()->prev() == NULL, "list invariant");
|
||||
assert(tail() == NULL || tail()->next() == NULL, "list invariant");
|
||||
@ -93,7 +93,7 @@ Chunk* FreeList<Chunk>::getChunkAtHead() {
|
||||
if (nextFC != NULL) {
|
||||
// The chunk fc being removed has a "next". Set the "next" to the
|
||||
// "prev" of fc.
|
||||
nextFC->linkPrev(NULL);
|
||||
nextFC->link_prev(NULL);
|
||||
} else { // removed tail of list
|
||||
link_tail(NULL);
|
||||
}
|
||||
@ -126,10 +126,10 @@ void FreeList<Chunk>::getFirstNChunksFromList(size_t n, FreeList<Chunk>* fl) {
|
||||
if (new_head == NULL) {
|
||||
set_tail(NULL);
|
||||
} else {
|
||||
new_head->linkPrev(NULL);
|
||||
new_head->link_prev(NULL);
|
||||
}
|
||||
// Now we can fix up the tail.
|
||||
tl->linkNext(NULL);
|
||||
tl->link_next(NULL);
|
||||
// And return the result.
|
||||
fl->set_tail(tl);
|
||||
fl->set_count(k);
|
||||
@ -138,7 +138,7 @@ void FreeList<Chunk>::getFirstNChunksFromList(size_t n, FreeList<Chunk>* fl) {
|
||||
|
||||
// Remove this chunk from the list
|
||||
template <class Chunk>
|
||||
void FreeList<Chunk>::removeChunk(Chunk*fc) {
|
||||
void FreeList<Chunk>::remove_chunk(Chunk*fc) {
|
||||
assert_proper_lock_protection();
|
||||
assert(head() != NULL, "Remove from empty list");
|
||||
assert(fc != NULL, "Remove a NULL chunk");
|
||||
@ -151,7 +151,7 @@ void FreeList<Chunk>::removeChunk(Chunk*fc) {
|
||||
if (nextFC != NULL) {
|
||||
// The chunk fc being removed has a "next". Set the "next" to the
|
||||
// "prev" of fc.
|
||||
nextFC->linkPrev(prevFC);
|
||||
nextFC->link_prev(prevFC);
|
||||
} else { // removed tail of list
|
||||
link_tail(prevFC);
|
||||
}
|
||||
@ -160,7 +160,7 @@ void FreeList<Chunk>::removeChunk(Chunk*fc) {
|
||||
assert(nextFC == NULL || nextFC->prev() == NULL,
|
||||
"Prev of head should be NULL");
|
||||
} else {
|
||||
prevFC->linkNext(nextFC);
|
||||
prevFC->link_next(nextFC);
|
||||
assert(tail() != prevFC || prevFC->next() == NULL,
|
||||
"Next of tail should be NULL");
|
||||
}
|
||||
@ -169,10 +169,10 @@ void FreeList<Chunk>::removeChunk(Chunk*fc) {
|
||||
"H/T/C Inconsistency");
|
||||
// clear next and prev fields of fc, debug only
|
||||
NOT_PRODUCT(
|
||||
fc->linkPrev(NULL);
|
||||
fc->linkNext(NULL);
|
||||
fc->link_prev(NULL);
|
||||
fc->link_next(NULL);
|
||||
)
|
||||
assert(fc->isFree(), "Should still be a free chunk");
|
||||
assert(fc->is_free(), "Should still be a free chunk");
|
||||
assert(head() == NULL || head()->prev() == NULL, "list invariant");
|
||||
assert(tail() == NULL || tail()->next() == NULL, "list invariant");
|
||||
assert(head() == NULL || head()->size() == size(), "wrong item on list");
|
||||
@ -181,7 +181,7 @@ void FreeList<Chunk>::removeChunk(Chunk*fc) {
|
||||
|
||||
// Add this chunk at the head of the list.
|
||||
template <class Chunk>
|
||||
void FreeList<Chunk>::returnChunkAtHead(Chunk* chunk, bool record_return) {
|
||||
void FreeList<Chunk>::return_chunk_at_head(Chunk* chunk, bool record_return) {
|
||||
assert_proper_lock_protection();
|
||||
assert(chunk != NULL, "insert a NULL chunk");
|
||||
assert(size() == chunk->size(), "Wrong size");
|
||||
@ -190,7 +190,7 @@ void FreeList<Chunk>::returnChunkAtHead(Chunk* chunk, bool record_return) {
|
||||
|
||||
Chunk* oldHead = head();
|
||||
assert(chunk != oldHead, "double insertion");
|
||||
chunk->linkAfter(oldHead);
|
||||
chunk->link_after(oldHead);
|
||||
link_head(chunk);
|
||||
if (oldHead == NULL) { // only chunk in list
|
||||
assert(tail() == NULL, "inconsistent FreeList");
|
||||
@ -199,7 +199,7 @@ void FreeList<Chunk>::returnChunkAtHead(Chunk* chunk, bool record_return) {
|
||||
increment_count(); // of # of chunks in list
|
||||
DEBUG_ONLY(
|
||||
if (record_return) {
|
||||
increment_returnedBytes_by(size()*HeapWordSize);
|
||||
increment_returned_bytes_by(size()*HeapWordSize);
|
||||
}
|
||||
)
|
||||
assert(head() == NULL || head()->prev() == NULL, "list invariant");
|
||||
@ -209,14 +209,14 @@ void FreeList<Chunk>::returnChunkAtHead(Chunk* chunk, bool record_return) {
|
||||
}
|
||||
|
||||
template <class Chunk>
|
||||
void FreeList<Chunk>::returnChunkAtHead(Chunk* chunk) {
|
||||
void FreeList<Chunk>::return_chunk_at_head(Chunk* chunk) {
|
||||
assert_proper_lock_protection();
|
||||
returnChunkAtHead(chunk, true);
|
||||
return_chunk_at_head(chunk, true);
|
||||
}
|
||||
|
||||
// Add this chunk at the tail of the list.
|
||||
template <class Chunk>
|
||||
void FreeList<Chunk>::returnChunkAtTail(Chunk* chunk, bool record_return) {
|
||||
void FreeList<Chunk>::return_chunk_at_tail(Chunk* chunk, bool record_return) {
|
||||
assert_proper_lock_protection();
|
||||
assert(head() == NULL || head()->prev() == NULL, "list invariant");
|
||||
assert(tail() == NULL || tail()->next() == NULL, "list invariant");
|
||||
@ -226,7 +226,7 @@ void FreeList<Chunk>::returnChunkAtTail(Chunk* chunk, bool record_return) {
|
||||
Chunk* oldTail = tail();
|
||||
assert(chunk != oldTail, "double insertion");
|
||||
if (oldTail != NULL) {
|
||||
oldTail->linkAfter(chunk);
|
||||
oldTail->link_after(chunk);
|
||||
} else { // only chunk in list
|
||||
assert(head() == NULL, "inconsistent FreeList");
|
||||
link_head(chunk);
|
||||
@ -235,7 +235,7 @@ void FreeList<Chunk>::returnChunkAtTail(Chunk* chunk, bool record_return) {
|
||||
increment_count(); // of # of chunks in list
|
||||
DEBUG_ONLY(
|
||||
if (record_return) {
|
||||
increment_returnedBytes_by(size()*HeapWordSize);
|
||||
increment_returned_bytes_by(size()*HeapWordSize);
|
||||
}
|
||||
)
|
||||
assert(head() == NULL || head()->prev() == NULL, "list invariant");
|
||||
@ -245,8 +245,8 @@ void FreeList<Chunk>::returnChunkAtTail(Chunk* chunk, bool record_return) {
|
||||
}
|
||||
|
||||
template <class Chunk>
|
||||
void FreeList<Chunk>::returnChunkAtTail(Chunk* chunk) {
|
||||
returnChunkAtTail(chunk, true);
|
||||
void FreeList<Chunk>::return_chunk_at_tail(Chunk* chunk) {
|
||||
return_chunk_at_tail(chunk, true);
|
||||
}
|
||||
|
||||
template <class Chunk>
|
||||
@ -262,8 +262,8 @@ void FreeList<Chunk>::prepend(FreeList<Chunk>* fl) {
|
||||
Chunk* fl_tail = fl->tail();
|
||||
Chunk* this_head = head();
|
||||
assert(fl_tail->next() == NULL, "Well-formedness of fl");
|
||||
fl_tail->linkNext(this_head);
|
||||
this_head->linkPrev(fl_tail);
|
||||
fl_tail->link_next(this_head);
|
||||
this_head->link_prev(fl_tail);
|
||||
set_head(fl->head());
|
||||
set_count(count() + fl->count());
|
||||
}
|
||||
@ -273,10 +273,10 @@ void FreeList<Chunk>::prepend(FreeList<Chunk>* fl) {
|
||||
}
|
||||
}
|
||||
|
||||
// verifyChunkInFreeLists() is used to verify that an item is in this free list.
|
||||
// verify_chunk_in_free_list() is used to verify that an item is in this free list.
|
||||
// It is used as a debugging aid.
|
||||
template <class Chunk>
|
||||
bool FreeList<Chunk>::verifyChunkInFreeLists(Chunk* fc) const {
|
||||
bool FreeList<Chunk>::verify_chunk_in_free_list(Chunk* fc) const {
|
||||
// This is an internal consistency check, not part of the check that the
|
||||
// chunk is in the free lists.
|
||||
guarantee(fc->size() == size(), "Wrong list is being searched");
|
||||
@ -302,21 +302,21 @@ void FreeList<Chunk>::verify_stats() const {
|
||||
// dictionary for example, this might be the first block and
|
||||
// in that case there would be no place that we could record
|
||||
// the stats (which are kept in the block itself).
|
||||
assert((_allocation_stats.prevSweep() + _allocation_stats.splitBirths()
|
||||
+ _allocation_stats.coalBirths() + 1) // Total Production Stock + 1
|
||||
>= (_allocation_stats.splitDeaths() + _allocation_stats.coalDeaths()
|
||||
assert((_allocation_stats.prev_sweep() + _allocation_stats.split_births()
|
||||
+ _allocation_stats.coal_births() + 1) // Total Production Stock + 1
|
||||
>= (_allocation_stats.split_deaths() + _allocation_stats.coal_deaths()
|
||||
+ (ssize_t)count()), // Total Current Stock + depletion
|
||||
err_msg("FreeList " PTR_FORMAT " of size " SIZE_FORMAT
|
||||
" violates Conservation Principle: "
|
||||
"prevSweep(" SIZE_FORMAT ")"
|
||||
" + splitBirths(" SIZE_FORMAT ")"
|
||||
" + coalBirths(" SIZE_FORMAT ") + 1 >= "
|
||||
" splitDeaths(" SIZE_FORMAT ")"
|
||||
" coalDeaths(" SIZE_FORMAT ")"
|
||||
"prev_sweep(" SIZE_FORMAT ")"
|
||||
" + split_births(" SIZE_FORMAT ")"
|
||||
" + coal_births(" SIZE_FORMAT ") + 1 >= "
|
||||
" split_deaths(" SIZE_FORMAT ")"
|
||||
" coal_deaths(" SIZE_FORMAT ")"
|
||||
" + count(" SSIZE_FORMAT ")",
|
||||
this, _size, _allocation_stats.prevSweep(), _allocation_stats.splitBirths(),
|
||||
_allocation_stats.splitBirths(), _allocation_stats.splitDeaths(),
|
||||
_allocation_stats.coalDeaths(), count()));
|
||||
this, _size, _allocation_stats.prev_sweep(), _allocation_stats.split_births(),
|
||||
_allocation_stats.split_births(), _allocation_stats.split_deaths(),
|
||||
_allocation_stats.coal_deaths(), count()));
|
||||
}
|
||||
|
||||
template <class Chunk>
|
||||
@ -360,8 +360,8 @@ void FreeList<Chunk>::print_on(outputStream* st, const char* c) const {
|
||||
st->print("\t"
|
||||
SSIZE_FORMAT_W(14) "\t" SSIZE_FORMAT_W(14) "\t" SSIZE_FORMAT_W(14) "\t" SSIZE_FORMAT_W(14) "\t" SSIZE_FORMAT_W(14) "\t"
|
||||
SSIZE_FORMAT_W(14) "\t" SSIZE_FORMAT_W(14) "\t" SSIZE_FORMAT_W(14) "\t" SSIZE_FORMAT_W(14) "\t" SSIZE_FORMAT_W(14) "\n",
|
||||
bfrSurp(), surplus(), desired(), prevSweep(), beforeSweep(),
|
||||
count(), coalBirths(), coalDeaths(), splitBirths(), splitDeaths());
|
||||
bfr_surp(), surplus(), desired(), prev_sweep(), before_sweep(),
|
||||
count(), coal_births(), coal_deaths(), split_births(), split_deaths());
|
||||
}
|
||||
|
||||
#ifndef SERIALGC
|
||||
|
@ -119,7 +119,7 @@ class FreeList VALUE_OBJ_CLASS_SPEC {
|
||||
// If this method is not used (just set the head instead),
|
||||
// this check can be avoided.
|
||||
if (v != NULL) {
|
||||
v->linkPrev(NULL);
|
||||
v->link_prev(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@ -138,7 +138,7 @@ class FreeList VALUE_OBJ_CLASS_SPEC {
|
||||
assert_proper_lock_protection();
|
||||
set_tail(v);
|
||||
if (v != NULL) {
|
||||
v->clearNext();
|
||||
v->clear_next();
|
||||
}
|
||||
}
|
||||
|
||||
@ -185,12 +185,12 @@ class FreeList VALUE_OBJ_CLASS_SPEC {
|
||||
inter_sweep_estimate,
|
||||
intra_sweep_estimate);
|
||||
}
|
||||
ssize_t coalDesired() const {
|
||||
return _allocation_stats.coalDesired();
|
||||
ssize_t coal_desired() const {
|
||||
return _allocation_stats.coal_desired();
|
||||
}
|
||||
void set_coalDesired(ssize_t v) {
|
||||
void set_coal_desired(ssize_t v) {
|
||||
assert_proper_lock_protection();
|
||||
_allocation_stats.set_coalDesired(v);
|
||||
_allocation_stats.set_coal_desired(v);
|
||||
}
|
||||
|
||||
ssize_t surplus() const {
|
||||
@ -209,106 +209,106 @@ class FreeList VALUE_OBJ_CLASS_SPEC {
|
||||
_allocation_stats.decrement_surplus();
|
||||
}
|
||||
|
||||
ssize_t bfrSurp() const {
|
||||
return _allocation_stats.bfrSurp();
|
||||
ssize_t bfr_surp() const {
|
||||
return _allocation_stats.bfr_surp();
|
||||
}
|
||||
void set_bfrSurp(ssize_t v) {
|
||||
void set_bfr_surp(ssize_t v) {
|
||||
assert_proper_lock_protection();
|
||||
_allocation_stats.set_bfrSurp(v);
|
||||
_allocation_stats.set_bfr_surp(v);
|
||||
}
|
||||
ssize_t prevSweep() const {
|
||||
return _allocation_stats.prevSweep();
|
||||
ssize_t prev_sweep() const {
|
||||
return _allocation_stats.prev_sweep();
|
||||
}
|
||||
void set_prevSweep(ssize_t v) {
|
||||
void set_prev_sweep(ssize_t v) {
|
||||
assert_proper_lock_protection();
|
||||
_allocation_stats.set_prevSweep(v);
|
||||
_allocation_stats.set_prev_sweep(v);
|
||||
}
|
||||
ssize_t beforeSweep() const {
|
||||
return _allocation_stats.beforeSweep();
|
||||
ssize_t before_sweep() const {
|
||||
return _allocation_stats.before_sweep();
|
||||
}
|
||||
void set_beforeSweep(ssize_t v) {
|
||||
void set_before_sweep(ssize_t v) {
|
||||
assert_proper_lock_protection();
|
||||
_allocation_stats.set_beforeSweep(v);
|
||||
_allocation_stats.set_before_sweep(v);
|
||||
}
|
||||
|
||||
ssize_t coalBirths() const {
|
||||
return _allocation_stats.coalBirths();
|
||||
ssize_t coal_births() const {
|
||||
return _allocation_stats.coal_births();
|
||||
}
|
||||
void set_coalBirths(ssize_t v) {
|
||||
void set_coal_births(ssize_t v) {
|
||||
assert_proper_lock_protection();
|
||||
_allocation_stats.set_coalBirths(v);
|
||||
_allocation_stats.set_coal_births(v);
|
||||
}
|
||||
void increment_coalBirths() {
|
||||
void increment_coal_births() {
|
||||
assert_proper_lock_protection();
|
||||
_allocation_stats.increment_coalBirths();
|
||||
_allocation_stats.increment_coal_births();
|
||||
}
|
||||
|
||||
ssize_t coalDeaths() const {
|
||||
return _allocation_stats.coalDeaths();
|
||||
ssize_t coal_deaths() const {
|
||||
return _allocation_stats.coal_deaths();
|
||||
}
|
||||
void set_coalDeaths(ssize_t v) {
|
||||
void set_coal_deaths(ssize_t v) {
|
||||
assert_proper_lock_protection();
|
||||
_allocation_stats.set_coalDeaths(v);
|
||||
_allocation_stats.set_coal_deaths(v);
|
||||
}
|
||||
void increment_coalDeaths() {
|
||||
void increment_coal_deaths() {
|
||||
assert_proper_lock_protection();
|
||||
_allocation_stats.increment_coalDeaths();
|
||||
_allocation_stats.increment_coal_deaths();
|
||||
}
|
||||
|
||||
ssize_t splitBirths() const {
|
||||
return _allocation_stats.splitBirths();
|
||||
ssize_t split_births() const {
|
||||
return _allocation_stats.split_births();
|
||||
}
|
||||
void set_splitBirths(ssize_t v) {
|
||||
void set_split_births(ssize_t v) {
|
||||
assert_proper_lock_protection();
|
||||
_allocation_stats.set_splitBirths(v);
|
||||
_allocation_stats.set_split_births(v);
|
||||
}
|
||||
void increment_splitBirths() {
|
||||
void increment_split_births() {
|
||||
assert_proper_lock_protection();
|
||||
_allocation_stats.increment_splitBirths();
|
||||
_allocation_stats.increment_split_births();
|
||||
}
|
||||
|
||||
ssize_t splitDeaths() const {
|
||||
return _allocation_stats.splitDeaths();
|
||||
ssize_t split_deaths() const {
|
||||
return _allocation_stats.split_deaths();
|
||||
}
|
||||
void set_splitDeaths(ssize_t v) {
|
||||
void set_split_deaths(ssize_t v) {
|
||||
assert_proper_lock_protection();
|
||||
_allocation_stats.set_splitDeaths(v);
|
||||
_allocation_stats.set_split_deaths(v);
|
||||
}
|
||||
void increment_splitDeaths() {
|
||||
void increment_split_deaths() {
|
||||
assert_proper_lock_protection();
|
||||
_allocation_stats.increment_splitDeaths();
|
||||
_allocation_stats.increment_split_deaths();
|
||||
}
|
||||
|
||||
NOT_PRODUCT(
|
||||
// For debugging. The "_returnedBytes" in all the lists are summed
|
||||
// For debugging. The "_returned_bytes" in all the lists are summed
|
||||
// and compared with the total number of bytes swept during a
|
||||
// collection.
|
||||
size_t returnedBytes() const { return _allocation_stats.returnedBytes(); }
|
||||
void set_returnedBytes(size_t v) { _allocation_stats.set_returnedBytes(v); }
|
||||
void increment_returnedBytes_by(size_t v) {
|
||||
_allocation_stats.set_returnedBytes(_allocation_stats.returnedBytes() + v);
|
||||
size_t returned_bytes() const { return _allocation_stats.returned_bytes(); }
|
||||
void set_returned_bytes(size_t v) { _allocation_stats.set_returned_bytes(v); }
|
||||
void increment_returned_bytes_by(size_t v) {
|
||||
_allocation_stats.set_returned_bytes(_allocation_stats.returned_bytes() + v);
|
||||
}
|
||||
)
|
||||
|
||||
// Unlink head of list and return it. Returns NULL if
|
||||
// the list is empty.
|
||||
Chunk* getChunkAtHead();
|
||||
Chunk* get_chunk_at_head();
|
||||
|
||||
// Remove the first "n" or "count", whichever is smaller, chunks from the
|
||||
// list, setting "fl", which is required to be empty, to point to them.
|
||||
void getFirstNChunksFromList(size_t n, FreeList<Chunk>* fl);
|
||||
|
||||
// Unlink this chunk from it's free list
|
||||
void removeChunk(Chunk* fc);
|
||||
void remove_chunk(Chunk* fc);
|
||||
|
||||
// Add this chunk to this free list.
|
||||
void returnChunkAtHead(Chunk* fc);
|
||||
void returnChunkAtTail(Chunk* fc);
|
||||
void return_chunk_at_head(Chunk* fc);
|
||||
void return_chunk_at_tail(Chunk* fc);
|
||||
|
||||
// Similar to returnChunk* but also records some diagnostic
|
||||
// information.
|
||||
void returnChunkAtHead(Chunk* fc, bool record_return);
|
||||
void returnChunkAtTail(Chunk* fc, bool record_return);
|
||||
void return_chunk_at_head(Chunk* fc, bool record_return);
|
||||
void return_chunk_at_tail(Chunk* fc, bool record_return);
|
||||
|
||||
// Prepend "fl" (whose size is required to be the same as that of "this")
|
||||
// to the front of "this" list.
|
||||
@ -316,7 +316,7 @@ class FreeList VALUE_OBJ_CLASS_SPEC {
|
||||
|
||||
// Verify that the chunk is in the list.
|
||||
// found. Return NULL if "fc" is not found.
|
||||
bool verifyChunkInFreeLists(Chunk* fc) const;
|
||||
bool verify_chunk_in_free_list(Chunk* fc) const;
|
||||
|
||||
// Stats verification
|
||||
void verify_stats() const PRODUCT_RETURN;
|
||||
|
Loading…
x
Reference in New Issue
Block a user