提交 d8e75982 编写于 作者: T tamao

8007763: Refactoring: split up compute_generation_free_space() into two...

8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
Summary: split up compute_generation_free_space() into two functions: compute_eden_space_size() + compute_old_gen_free_space(), each of which (if needed) can be reused without executing an overhead of the other.
Reviewed-by: jmasa, tschatzl
Contributed-by: Ntamao <tao.mao@oracle.com>
上级 f0036e39
/*
* Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -136,18 +136,24 @@ class PSAdaptiveSizePolicy : public AdaptiveSizePolicy {
double gc_minor_pause_goal_sec() const { return _gc_minor_pause_goal_sec; }
// Change the young generation size to achieve a minor GC pause time goal
void adjust_for_minor_pause_time(bool is_full_gc,
void adjust_promo_for_minor_pause_time(bool is_full_gc,
size_t* desired_promo_size_ptr,
size_t* desired_eden_size_ptr);
void adjust_eden_for_minor_pause_time(bool is_full_gc,
size_t* desired_eden_size_ptr);
// Change the generation sizes to achieve a GC pause time goal
// Returned sizes are not necessarily aligned.
void adjust_for_pause_time(bool is_full_gc,
void adjust_promo_for_pause_time(bool is_full_gc,
size_t* desired_promo_size_ptr,
size_t* desired_eden_size_ptr);
void adjust_eden_for_pause_time(bool is_full_gc,
size_t* desired_promo_size_ptr,
size_t* desired_eden_size_ptr);
// Change the generation sizes to achieve an application throughput goal
// Returned sizes are not necessarily aligned.
void adjust_for_throughput(bool is_full_gc,
size_t* desired_promo_size_ptr,
void adjust_promo_for_throughput(bool is_full_gc,
size_t* desired_promo_size_ptr);
void adjust_eden_for_throughput(bool is_full_gc,
size_t* desired_eden_size_ptr);
// Change the generation sizes to achieve minimum footprint
// Returned sizes are not aligned.
......@@ -168,9 +174,6 @@ class PSAdaptiveSizePolicy : public AdaptiveSizePolicy {
size_t promo_decrement_aligned_down(size_t cur_promo);
size_t promo_increment_with_supplement_aligned_up(size_t cur_promo);
// Decay the supplemental growth additive.
void decay_supplemental_growth(bool is_full_gc);
// Returns a change that has been scaled down. Result
// is not aligned. (If useful, move to some shared
// location.)
......@@ -336,7 +339,7 @@ class PSAdaptiveSizePolicy : public AdaptiveSizePolicy {
// perform a Full GC?
bool should_full_GC(size_t live_in_old_gen);
// Calculates optimial free space sizes for both the old and young
// Calculates optimal (free) space sizes for both the young and old
// generations. Stores results in _eden_size and _promo_size.
// Takes current used space in all generations as input, as well
// as an indication if a full gc has just been performed, for use
......@@ -347,9 +350,18 @@ class PSAdaptiveSizePolicy : public AdaptiveSizePolicy {
size_t cur_eden, // current eden in bytes
size_t max_old_gen_size,
size_t max_eden_size,
bool is_full_gc,
GCCause::Cause gc_cause,
CollectorPolicy* collector_policy);
bool is_full_gc);
void compute_eden_space_size(size_t young_live,
size_t eden_live,
size_t cur_eden, // current eden in bytes
size_t max_eden_size,
bool is_full_gc);
void compute_old_gen_free_space(size_t old_live,
size_t cur_eden, // current eden in bytes
size_t max_old_gen_size,
bool is_full_gc);
// Calculates new survivor space size; returns a new tenuring threshold
// value. Stores new survivor size in _survivor_size.
......@@ -390,6 +402,9 @@ class PSAdaptiveSizePolicy : public AdaptiveSizePolicy {
// Printing support
virtual bool print_adaptive_size_policy_on(outputStream* st) const;
// Decay the supplemental growth additive.
void decay_supplemental_growth(bool is_full_gc);
};
#endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSADAPTIVESIZEPOLICY_HPP
/*
* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -277,18 +277,36 @@ bool PSMarkSweep::invoke_no_policy(bool clear_all_softrefs) {
young_gen->from_space()->capacity_in_bytes() +
young_gen->to_space()->capacity_in_bytes(),
"Sizes of space in young gen are out-of-bounds");
size_t young_live = young_gen->used_in_bytes();
size_t eden_live = young_gen->eden_space()->used_in_bytes();
size_t old_live = old_gen->used_in_bytes();
size_t cur_eden = young_gen->eden_space()->capacity_in_bytes();
size_t max_old_gen_size = old_gen->max_gen_size();
size_t max_eden_size = young_gen->max_size() -
young_gen->from_space()->capacity_in_bytes() -
young_gen->to_space()->capacity_in_bytes();
size_policy->compute_generation_free_space(young_gen->used_in_bytes(),
young_gen->eden_space()->used_in_bytes(),
old_gen->used_in_bytes(),
young_gen->eden_space()->capacity_in_bytes(),
old_gen->max_gen_size(),
max_eden_size,
true /* full gc*/,
gc_cause,
heap->collector_policy());
// Used for diagnostics
size_policy->clear_generation_free_space_flags();
size_policy->compute_generation_free_space(young_live,
eden_live,
old_live,
cur_eden,
max_old_gen_size,
max_eden_size,
true /* full gc*/);
size_policy->check_gc_overhead_limit(young_live,
eden_live,
max_old_gen_size,
max_eden_size,
true /* full gc*/,
gc_cause,
heap->collector_policy());
size_policy->decay_supplemental_growth(true /* full gc*/);
heap->resize_old_gen(size_policy->calculated_old_free_size_in_bytes());
......
/*
* Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -2084,19 +2084,36 @@ bool PSParallelCompact::invoke_no_policy(bool maximum_heap_compaction) {
young_gen->from_space()->capacity_in_bytes() +
young_gen->to_space()->capacity_in_bytes(),
"Sizes of space in young gen are out-of-bounds");
size_t young_live = young_gen->used_in_bytes();
size_t eden_live = young_gen->eden_space()->used_in_bytes();
size_t old_live = old_gen->used_in_bytes();
size_t cur_eden = young_gen->eden_space()->capacity_in_bytes();
size_t max_old_gen_size = old_gen->max_gen_size();
size_t max_eden_size = young_gen->max_size() -
young_gen->from_space()->capacity_in_bytes() -
young_gen->to_space()->capacity_in_bytes();
size_policy->compute_generation_free_space(
young_gen->used_in_bytes(),
young_gen->eden_space()->used_in_bytes(),
old_gen->used_in_bytes(),
young_gen->eden_space()->capacity_in_bytes(),
old_gen->max_gen_size(),
max_eden_size,
true /* full gc*/,
gc_cause,
heap->collector_policy());
// Used for diagnostics
size_policy->clear_generation_free_space_flags();
size_policy->compute_generation_free_space(young_live,
eden_live,
old_live,
cur_eden,
max_old_gen_size,
max_eden_size,
true /* full gc*/);
size_policy->check_gc_overhead_limit(young_live,
eden_live,
max_old_gen_size,
max_eden_size,
true /* full gc*/,
gc_cause,
heap->collector_policy());
size_policy->decay_supplemental_growth(true /* full gc*/);
heap->resize_old_gen(
size_policy->calculated_old_free_size_in_bytes());
......
......@@ -552,19 +552,33 @@ bool PSScavenge::invoke_no_policy() {
young_gen->from_space()->capacity_in_bytes() +
young_gen->to_space()->capacity_in_bytes(),
"Sizes of space in young gen are out-of-bounds");
size_t young_live = young_gen->used_in_bytes();
size_t eden_live = young_gen->eden_space()->used_in_bytes();
size_t cur_eden = young_gen->eden_space()->capacity_in_bytes();
size_t max_old_gen_size = old_gen->max_gen_size();
size_t max_eden_size = young_gen->max_size() -
young_gen->from_space()->capacity_in_bytes() -
young_gen->to_space()->capacity_in_bytes();
size_policy->compute_generation_free_space(young_gen->used_in_bytes(),
young_gen->eden_space()->used_in_bytes(),
old_gen->used_in_bytes(),
young_gen->eden_space()->capacity_in_bytes(),
old_gen->max_gen_size(),
max_eden_size,
false /* full gc*/,
gc_cause,
heap->collector_policy());
// Used for diagnostics
size_policy->clear_generation_free_space_flags();
size_policy->compute_eden_space_size(young_live,
eden_live,
cur_eden,
max_eden_size,
false /* not full gc*/);
size_policy->check_gc_overhead_limit(young_live,
eden_live,
max_old_gen_size,
max_eden_size,
false /* not full gc*/,
gc_cause,
heap->collector_policy());
size_policy->decay_supplemental_growth(false /* not full gc*/);
}
// Resize the young generation at every collection
// even if new sizes have not been calculated. This is
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册