3364 if (Verbose && PrintGC) {
3365 size_t new_mem_size = _virtual_space.committed_size();
3366 size_t old_mem_size = new_mem_size + bytes;
3367 gclog_or_tty->print_cr("Shrinking %s from " SIZE_FORMAT "K to " SIZE_FORMAT "K",
3368 name(), old_mem_size/K, new_mem_size/K);
3369 }
3370 }
3371
3372 void ConcurrentMarkSweepGeneration::shrink(size_t bytes) {
3373 assert_locked_or_safepoint(Heap_lock);
3374 size_t size = ReservedSpace::page_align_size_down(bytes);
3375 if (size > 0) {
3376 shrink_by(size);
3377 }
3378 }
3379
3380 bool ConcurrentMarkSweepGeneration::grow_by(size_t bytes) {
3381 assert_locked_or_safepoint(Heap_lock);
3382 bool result = _virtual_space.expand_by(bytes);
3383 if (result) {
3384 HeapWord* old_end = _cmsSpace->end();
3385 size_t new_word_size =
3386 heap_word_size(_virtual_space.committed_size());
3387 MemRegion mr(_cmsSpace->bottom(), new_word_size);
3388 _bts->resize(new_word_size); // resize the block offset shared array
3389 Universe::heap()->barrier_set()->resize_covered_region(mr);
3390 // Hmmmm... why doesn't CFLS::set_end verify locking?
3391 // This is quite ugly; FIX ME XXX
3392 _cmsSpace->assert_locked(freelistLock());
3393 _cmsSpace->set_end((HeapWord*)_virtual_space.high());
3394
3395 // update the space and generation capacity counters
3396 if (UsePerfData) {
3397 _space_counters->update_capacity();
3398 _gen_counters->update_all();
3399 }
3400
3401 if (Verbose && PrintGC) {
3402 size_t new_mem_size = _virtual_space.committed_size();
3403 size_t old_mem_size = new_mem_size - bytes;
3404 gclog_or_tty->print_cr("Expanding %s from " SIZE_FORMAT "K by " SIZE_FORMAT "K to " SIZE_FORMAT "K",
|
3364 if (Verbose && PrintGC) {
3365 size_t new_mem_size = _virtual_space.committed_size();
3366 size_t old_mem_size = new_mem_size + bytes;
3367 gclog_or_tty->print_cr("Shrinking %s from " SIZE_FORMAT "K to " SIZE_FORMAT "K",
3368 name(), old_mem_size/K, new_mem_size/K);
3369 }
3370 }
3371
3372 void ConcurrentMarkSweepGeneration::shrink(size_t bytes) {
3373 assert_locked_or_safepoint(Heap_lock);
3374 size_t size = ReservedSpace::page_align_size_down(bytes);
3375 if (size > 0) {
3376 shrink_by(size);
3377 }
3378 }
3379
3380 bool ConcurrentMarkSweepGeneration::grow_by(size_t bytes) {
3381 assert_locked_or_safepoint(Heap_lock);
3382 bool result = _virtual_space.expand_by(bytes);
3383 if (result) {
3384 size_t new_word_size =
3385 heap_word_size(_virtual_space.committed_size());
3386 MemRegion mr(_cmsSpace->bottom(), new_word_size);
3387 _bts->resize(new_word_size); // resize the block offset shared array
3388 Universe::heap()->barrier_set()->resize_covered_region(mr);
3389 // Hmmmm... why doesn't CFLS::set_end verify locking?
3390 // This is quite ugly; FIX ME XXX
3391 _cmsSpace->assert_locked(freelistLock());
3392 _cmsSpace->set_end((HeapWord*)_virtual_space.high());
3393
3394 // update the space and generation capacity counters
3395 if (UsePerfData) {
3396 _space_counters->update_capacity();
3397 _gen_counters->update_all();
3398 }
3399
3400 if (Verbose && PrintGC) {
3401 size_t new_mem_size = _virtual_space.committed_size();
3402 size_t old_mem_size = new_mem_size - bytes;
3403 gclog_or_tty->print_cr("Expanding %s from " SIZE_FORMAT "K by " SIZE_FORMAT "K to " SIZE_FORMAT "K",
|