8139772: Cleanups in Generation related code
Reviewed-by: tbenson, mgerdin
This commit is contained in:
parent
686fb800c8
commit
f21d1afd70
@ -1121,12 +1121,6 @@ class ConcurrentMarkSweepGeneration: public CardGeneration {
|
||||
// over-rides
|
||||
MemRegion used_region_at_save_marks() const;
|
||||
|
||||
// Does a "full" (forced) collection invoked on this generation collect
|
||||
// the young generation as well?
|
||||
virtual bool full_collects_young_generation() const {
|
||||
return !ScavengeBeforeFullGC;
|
||||
}
|
||||
|
||||
// Adjust quantities in the generation affected by
|
||||
// the compaction.
|
||||
void reset_after_compaction();
|
||||
|
@ -383,7 +383,7 @@ void DefNewGeneration::compute_new_size() {
|
||||
|
||||
size_t old_size = gch->old_gen()->capacity();
|
||||
size_t new_size_before = _virtual_space.committed_size();
|
||||
size_t min_new_size = spec()->init_size();
|
||||
size_t min_new_size = initial_size();
|
||||
size_t max_new_size = reserved().byte_size();
|
||||
assert(min_new_size <= new_size_before &&
|
||||
new_size_before <= max_new_size,
|
||||
|
@ -66,13 +66,6 @@ class TenuredGeneration: public CardGeneration {
|
||||
const char* name() const { return "tenured generation"; }
|
||||
const char* short_name() const { return "Tenured"; }
|
||||
|
||||
// Does a "full" (forced) collection invoked on this generation collect
|
||||
// the young generation as well? Note that this is a hack to allow the
|
||||
// collection of the young gen first if the flag is set.
|
||||
virtual bool full_collects_young_generation() const {
|
||||
return !ScavengeBeforeFullGC;
|
||||
}
|
||||
|
||||
size_t unsafe_max_alloc_nogc() const;
|
||||
size_t contiguous_available() const;
|
||||
|
||||
|
@ -208,8 +208,7 @@ void CardGeneration::compute_new_size() {
|
||||
const double min_tmp = used_after_gc / maximum_used_percentage;
|
||||
size_t minimum_desired_capacity = (size_t)MIN2(min_tmp, double(max_uintx));
|
||||
// Don't shrink less than the initial generation size
|
||||
minimum_desired_capacity = MAX2(minimum_desired_capacity,
|
||||
spec()->init_size());
|
||||
minimum_desired_capacity = MAX2(minimum_desired_capacity, initial_size());
|
||||
assert(used_after_gc <= minimum_desired_capacity, "sanity check");
|
||||
|
||||
if (PrintGC && Verbose) {
|
||||
@ -262,8 +261,7 @@ void CardGeneration::compute_new_size() {
|
||||
const double minimum_used_percentage = 1.0 - maximum_free_percentage;
|
||||
const double max_tmp = used_after_gc / minimum_used_percentage;
|
||||
size_t maximum_desired_capacity = (size_t)MIN2(max_tmp, double(max_uintx));
|
||||
maximum_desired_capacity = MAX2(maximum_desired_capacity,
|
||||
spec()->init_size());
|
||||
maximum_desired_capacity = MAX2(maximum_desired_capacity, initial_size());
|
||||
if (PrintGC && Verbose) {
|
||||
gclog_or_tty->print_cr(" "
|
||||
" maximum_free_percentage: %6.2f"
|
||||
@ -299,20 +297,20 @@ void CardGeneration::compute_new_size() {
|
||||
}
|
||||
if (PrintGC && Verbose) {
|
||||
gclog_or_tty->print_cr(" "
|
||||
" shrinking:"
|
||||
" initSize: %.1fK"
|
||||
" maximum_desired_capacity: %.1fK",
|
||||
spec()->init_size() / (double) K,
|
||||
maximum_desired_capacity / (double) K);
|
||||
" shrinking:"
|
||||
" initSize: %.1fK"
|
||||
" maximum_desired_capacity: %.1fK",
|
||||
initial_size() / (double) K,
|
||||
maximum_desired_capacity / (double) K);
|
||||
gclog_or_tty->print_cr(" "
|
||||
" shrink_bytes: %.1fK"
|
||||
" current_shrink_factor: " SIZE_FORMAT
|
||||
" new shrink factor: " SIZE_FORMAT
|
||||
" _min_heap_delta_bytes: %.1fK",
|
||||
shrink_bytes / (double) K,
|
||||
current_shrink_factor,
|
||||
_shrink_factor,
|
||||
_min_heap_delta_bytes / (double) K);
|
||||
" shrink_bytes: %.1fK"
|
||||
" current_shrink_factor: " SIZE_FORMAT
|
||||
" new shrink factor: " SIZE_FORMAT
|
||||
" _min_heap_delta_bytes: %.1fK",
|
||||
shrink_bytes / (double) K,
|
||||
current_shrink_factor,
|
||||
_shrink_factor,
|
||||
_min_heap_delta_bytes / (double) K);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -460,10 +460,9 @@ void GenCollectedHeap::do_collection(bool full,
|
||||
|
||||
bool prepared_for_verification = false;
|
||||
bool collected_old = false;
|
||||
bool old_collects_young = complete &&
|
||||
_old_gen->full_collects_young_generation();
|
||||
if (!old_collects_young &&
|
||||
_young_gen->should_collect(full, size, is_tlab)) {
|
||||
bool old_collects_young = complete && !ScavengeBeforeFullGC;
|
||||
|
||||
if (!old_collects_young && _young_gen->should_collect(full, size, is_tlab)) {
|
||||
if (run_verification && VerifyGCLevel <= 0 && VerifyBeforeGC) {
|
||||
prepare_for_verify();
|
||||
prepared_for_verification = true;
|
||||
@ -1107,10 +1106,6 @@ void GenCollectedHeap::prepare_for_compaction() {
|
||||
_young_gen->prepare_for_compaction(&cp);
|
||||
}
|
||||
|
||||
GCStats* GenCollectedHeap::gc_stats(Generation* gen) const {
|
||||
return gen->gc_stats();
|
||||
}
|
||||
|
||||
void GenCollectedHeap::verify(bool silent, VerifyOption option /* ignored */) {
|
||||
if (!silent) {
|
||||
gclog_or_tty->print("%s", _old_gen->name());
|
||||
|
@ -126,8 +126,6 @@ public:
|
||||
|
||||
WorkGang* workers() const { return _workers; }
|
||||
|
||||
GCStats* gc_stats(Generation* generation) const;
|
||||
|
||||
// Returns JNI_OK on success
|
||||
virtual jint initialize();
|
||||
|
||||
|
@ -58,12 +58,12 @@ Generation::Generation(ReservedSpace rs, size_t initial_size) :
|
||||
(HeapWord*)_virtual_space.high_boundary());
|
||||
}
|
||||
|
||||
GenerationSpec* Generation::spec() {
|
||||
size_t Generation::initial_size() {
|
||||
GenCollectedHeap* gch = GenCollectedHeap::heap();
|
||||
if (gch->is_young_gen(this)) {
|
||||
return gch->gen_policy()->young_gen_spec();
|
||||
return gch->gen_policy()->young_gen_spec()->init_size();
|
||||
}
|
||||
return gch->gen_policy()->old_gen_spec();
|
||||
return gch->gen_policy()->old_gen_spec()->init_size();
|
||||
}
|
||||
|
||||
size_t Generation::max_capacity() const {
|
||||
|
@ -141,14 +141,14 @@ class Generation: public CHeapObj<mtGC> {
|
||||
}
|
||||
|
||||
virtual Generation::Name kind() { return Generation::Other; }
|
||||
GenerationSpec* spec();
|
||||
|
||||
// This properly belongs in the collector, but for now this
|
||||
// will do.
|
||||
virtual bool refs_discovery_is_atomic() const { return true; }
|
||||
virtual bool refs_discovery_is_mt() const { return false; }
|
||||
|
||||
// Space enquiries (results in bytes)
|
||||
// Space inquiries (results in bytes)
|
||||
size_t initial_size();
|
||||
virtual size_t capacity() const = 0; // The maximum number of object bytes the
|
||||
// generation can currently hold.
|
||||
virtual size_t used() const = 0; // The number of used bytes in the gen.
|
||||
@ -309,10 +309,6 @@ class Generation: public CHeapObj<mtGC> {
|
||||
// do nothing.
|
||||
virtual void par_oop_since_save_marks_iterate_done(int thread_num) {}
|
||||
|
||||
// This generation will collect all younger generations
|
||||
// during a full collection.
|
||||
virtual bool full_collects_young_generation() const { return false; }
|
||||
|
||||
// This generation does in-place marking, meaning that mark words
|
||||
// are mutated during the marking phase and presumably reinitialized
|
||||
// to a canonical value after the GC. This is currently used by the
|
||||
@ -403,7 +399,7 @@ class Generation: public CHeapObj<mtGC> {
|
||||
// that was most recently collected. This allows the generation to
|
||||
// decide what statistics are valid to collect. For example, the
|
||||
// generation can decide to gather the amount of promoted data if
|
||||
// the collection of the younger generations has completed.
|
||||
// the collection of the young generation has completed.
|
||||
GCStats* gc_stats() const { return _gc_stats; }
|
||||
virtual void update_gc_stats(Generation* current_generation, bool full) {}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user