comparison src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp @ 12112:1bb10d3170fa

8022817: CMS should not shrink if compaction was not done Reviewed-by: ysr, mgerdin
author jmasa
date Fri, 16 Aug 2013 06:12:46 -0700
parents cb9da55b1990
children 7944aba7ba41
comparison
equal deleted inserted replaced
12088:cb9da55b1990 12112:1bb10d3170fa
3458 } 3458 }
3459 3459
3460 void ConcurrentMarkSweepGeneration::shrink(size_t bytes) { 3460 void ConcurrentMarkSweepGeneration::shrink(size_t bytes) {
3461 assert_locked_or_safepoint(Heap_lock); 3461 assert_locked_or_safepoint(Heap_lock);
3462 size_t size = ReservedSpace::page_align_size_down(bytes); 3462 size_t size = ReservedSpace::page_align_size_down(bytes);
3463 if (size > 0) { 3463 // Only shrink if a compaction was done so that all the free space
3464 // in the generation is in a contiguous block at the end.
3465 if (size > 0 && did_compact()) {
3464 shrink_by(size); 3466 shrink_by(size);
3465 } 3467 }
3466 } 3468 }
3467 3469
3468 bool ConcurrentMarkSweepGeneration::grow_by(size_t bytes) { 3470 bool ConcurrentMarkSweepGeneration::grow_by(size_t bytes) {
8694 // for the sweeper to step over and examine. 8696 // for the sweeper to step over and examine.
8695 void SweepClosure::lookahead_and_flush(FreeChunk* fc, size_t chunk_size) { 8697 void SweepClosure::lookahead_and_flush(FreeChunk* fc, size_t chunk_size) {
8696 assert(inFreeRange(), "Should only be called if currently in a free range."); 8698 assert(inFreeRange(), "Should only be called if currently in a free range.");
8697 HeapWord* const eob = ((HeapWord*)fc) + chunk_size; 8699 HeapWord* const eob = ((HeapWord*)fc) + chunk_size;
8698 assert(_sp->used_region().contains(eob - 1), 8700 assert(_sp->used_region().contains(eob - 1),
8699 err_msg("eob = " PTR_FORMAT " out of bounds wrt _sp = [" PTR_FORMAT "," PTR_FORMAT ")" 8701 err_msg("eob = " PTR_FORMAT " eob-1 = " PTR_FORMAT " _limit = " PTR_FORMAT
8702 " out of bounds wrt _sp = [" PTR_FORMAT "," PTR_FORMAT ")"
8700 " when examining fc = " PTR_FORMAT "(" SIZE_FORMAT ")", 8703 " when examining fc = " PTR_FORMAT "(" SIZE_FORMAT ")",
8701 _limit, _sp->bottom(), _sp->end(), fc, chunk_size)); 8704 eob, eob-1, _limit, _sp->bottom(), _sp->end(), fc, chunk_size));
8702 if (eob >= _limit) { 8705 if (eob >= _limit) {
8703 assert(eob == _limit || fc->is_free(), "Only a free chunk should allow us to cross over the limit"); 8706 assert(eob == _limit || fc->is_free(), "Only a free chunk should allow us to cross over the limit");
8704 if (CMSTraceSweeper) { 8707 if (CMSTraceSweeper) {
8705 gclog_or_tty->print_cr("_limit " PTR_FORMAT " reached or crossed by block " 8708 gclog_or_tty->print_cr("_limit " PTR_FORMAT " reached or crossed by block "
8706 "[" PTR_FORMAT "," PTR_FORMAT ") in space " 8709 "[" PTR_FORMAT "," PTR_FORMAT ") in space "