< prev index next >
src/share/vm/gc/parallel/psOldGen.cpp
Print this page
*** 28,37 ****
--- 28,38 ----
#include "gc/parallel/psMarkSweepDecorator.hpp"
#include "gc/parallel/psOldGen.hpp"
#include "gc/shared/cardTableModRefBS.hpp"
#include "gc/shared/gcLocker.inline.hpp"
#include "gc/shared/spaceDecorator.hpp"
+ #include "logging/log.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/java.hpp"
inline const char* PSOldGen::select_name() {
return UseParallelOldGC ? "ParOldGen" : "PSOldGen";
*** 254,267 ****
}
if (!success) {
success = expand_to_reserved();
}
- if (PrintGC && Verbose) {
if (success && GC_locker::is_active_and_needs_gc()) {
! gclog_or_tty->print_cr("Garbage collection disabled, expanded heap instead");
! }
}
}
bool PSOldGen::expand_by(size_t bytes) {
assert_lock_strong(ExpandHeap_lock);
--- 255,266 ----
}
if (!success) {
success = expand_to_reserved();
}
if (success && GC_locker::is_active_and_needs_gc()) {
! log_debug(gc)("Garbage collection disabled, expanded heap instead");
}
}
bool PSOldGen::expand_by(size_t bytes) {
assert_lock_strong(ExpandHeap_lock);
*** 289,304 ****
_space_counters->update_capacity();
_gen_counters->update_all();
}
}
! if (result && Verbose && PrintGC) {
size_t new_mem_size = virtual_space()->committed_size();
size_t old_mem_size = new_mem_size - bytes;
! gclog_or_tty->print_cr("Expanding %s from " SIZE_FORMAT "K by "
! SIZE_FORMAT "K to "
! SIZE_FORMAT "K",
name(), old_mem_size/K, bytes/K, new_mem_size/K);
}
return result;
}
--- 288,301 ----
_space_counters->update_capacity();
_gen_counters->update_all();
}
}
! if (result) {
size_t new_mem_size = virtual_space()->committed_size();
size_t old_mem_size = new_mem_size - bytes;
! log_debug(gc)("Expanding %s from " SIZE_FORMAT "K by " SIZE_FORMAT "K to " SIZE_FORMAT "K",
name(), old_mem_size/K, bytes/K, new_mem_size/K);
}
return result;
}
*** 324,342 ****
if (size > 0) {
assert_lock_strong(ExpandHeap_lock);
virtual_space()->shrink_by(bytes);
post_resize();
- if (Verbose && PrintGC) {
size_t new_mem_size = virtual_space()->committed_size();
size_t old_mem_size = new_mem_size + bytes;
! gclog_or_tty->print_cr("Shrinking %s from " SIZE_FORMAT "K by "
! SIZE_FORMAT "K to "
! SIZE_FORMAT "K",
name(), old_mem_size/K, bytes/K, new_mem_size/K);
}
- }
}
void PSOldGen::resize(size_t desired_free_space) {
const size_t alignment = virtual_space()->alignment();
const size_t size_before = virtual_space()->committed_size();
--- 321,335 ----
if (size > 0) {
assert_lock_strong(ExpandHeap_lock);
virtual_space()->shrink_by(bytes);
post_resize();
size_t new_mem_size = virtual_space()->committed_size();
size_t old_mem_size = new_mem_size + bytes;
! log_debug(gc)("Shrinking %s from " SIZE_FORMAT "K by " SIZE_FORMAT "K to " SIZE_FORMAT "K",
name(), old_mem_size/K, bytes/K, new_mem_size/K);
}
}
void PSOldGen::resize(size_t desired_free_space) {
const size_t alignment = virtual_space()->alignment();
const size_t size_before = virtual_space()->committed_size();
*** 351,368 ****
assert(gen_size_limit() >= reserved().byte_size(), "max new size problem?");
new_size = align_size_up(new_size, alignment);
const size_t current_size = capacity_in_bytes();
! if (PrintAdaptiveSizePolicy && Verbose) {
! gclog_or_tty->print_cr("AdaptiveSizePolicy::old generation size: "
"desired free: " SIZE_FORMAT " used: " SIZE_FORMAT
" new size: " SIZE_FORMAT " current size " SIZE_FORMAT
" gen limits: " SIZE_FORMAT " / " SIZE_FORMAT,
desired_free_space, used_in_bytes(), new_size, current_size,
gen_size_limit(), min_gen_size());
- }
if (new_size == current_size) {
// No change requested
return;
}
--- 344,359 ----
assert(gen_size_limit() >= reserved().byte_size(), "max new size problem?");
new_size = align_size_up(new_size, alignment);
const size_t current_size = capacity_in_bytes();
! log_trace(gc, ergo)("AdaptiveSizePolicy::old generation size: "
"desired free: " SIZE_FORMAT " used: " SIZE_FORMAT
" new size: " SIZE_FORMAT " current size " SIZE_FORMAT
" gen limits: " SIZE_FORMAT " / " SIZE_FORMAT,
desired_free_space, used_in_bytes(), new_size, current_size,
gen_size_limit(), min_gen_size());
if (new_size == current_size) {
// No change requested
return;
}
*** 374,391 ****
// shrink doesn't grab this lock, expand does. Is that right?
MutexLocker x(ExpandHeap_lock);
shrink(change_bytes);
}
! if (PrintAdaptiveSizePolicy) {
! ParallelScavengeHeap* heap = ParallelScavengeHeap::heap();
! gclog_or_tty->print_cr("AdaptiveSizePolicy::old generation size: "
! "collection: %d "
! "(" SIZE_FORMAT ") -> (" SIZE_FORMAT ") ",
! heap->total_collections(),
! size_before, virtual_space()->committed_size());
! }
}
// NOTE! We need to be careful about resizing. During a GC, multiple
// allocators may be active during heap expansion. If we allow the
// heap resizing to become visible before we have correctly resized
--- 365,378 ----
// shrink doesn't grab this lock, expand does. Is that right?
MutexLocker x(ExpandHeap_lock);
shrink(change_bytes);
}
! log_trace(gc, ergo)("AdaptiveSizePolicy::old generation size: collection: %d (" SIZE_FORMAT ") -> (" SIZE_FORMAT ") ",
! ParallelScavengeHeap::heap()->total_collections(),
! size_before,
! virtual_space()->committed_size());
}
// NOTE! We need to be careful about resizing. During a GC, multiple
// allocators may be active during heap expansion. If we allow the
// heap resizing to become visible before we have correctly resized
*** 428,460 ****
}
void PSOldGen::print() const { print_on(tty);}
void PSOldGen::print_on(outputStream* st) const {
st->print(" %-15s", name());
- if (PrintGCDetails && Verbose) {
- st->print(" total " SIZE_FORMAT ", used " SIZE_FORMAT,
- capacity_in_bytes(), used_in_bytes());
- } else {
st->print(" total " SIZE_FORMAT "K, used " SIZE_FORMAT "K",
capacity_in_bytes()/K, used_in_bytes()/K);
- }
st->print_cr(" [" INTPTR_FORMAT ", " INTPTR_FORMAT ", " INTPTR_FORMAT ")",
p2i(virtual_space()->low_boundary()),
p2i(virtual_space()->high()),
p2i(virtual_space()->high_boundary()));
st->print(" object"); object_space()->print_on(st);
}
void PSOldGen::print_used_change(size_t prev_used) const {
! gclog_or_tty->print(" [%s:", name());
! gclog_or_tty->print(" " SIZE_FORMAT "K"
! "->" SIZE_FORMAT "K"
! "(" SIZE_FORMAT "K)",
! prev_used / K, used_in_bytes() / K,
! capacity_in_bytes() / K);
! gclog_or_tty->print("]");
}
void PSOldGen::update_counters() {
if (UsePerfData) {
_space_counters->update_all();
--- 415,437 ----
}
void PSOldGen::print() const { print_on(tty);}
void PSOldGen::print_on(outputStream* st) const {
st->print(" %-15s", name());
st->print(" total " SIZE_FORMAT "K, used " SIZE_FORMAT "K",
capacity_in_bytes()/K, used_in_bytes()/K);
st->print_cr(" [" INTPTR_FORMAT ", " INTPTR_FORMAT ", " INTPTR_FORMAT ")",
p2i(virtual_space()->low_boundary()),
p2i(virtual_space()->high()),
p2i(virtual_space()->high_boundary()));
st->print(" object"); object_space()->print_on(st);
}
void PSOldGen::print_used_change(size_t prev_used) const {
! log_info(gc, heap)("%s: " SIZE_FORMAT "K->" SIZE_FORMAT "K(" SIZE_FORMAT "K)",
! name(), prev_used / K, used_in_bytes() / K, capacity_in_bytes() / K);
}
void PSOldGen::update_counters() {
if (UsePerfData) {
_space_counters->update_all();
< prev index next >