Mercurial > hg > truffle
diff src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp @ 1991:016a3628c885
6994056: G1: when GC locker is active, extend the Eden instead of allocating into the old gen
Summary: Allow the eden to the expanded up to a point when the GC locker is active.
Reviewed-by: jwilhelm, johnc, ysr, jcoomes
author | tonyp |
---|---|
date | Tue, 07 Dec 2010 16:47:42 -0500 |
parents | 631f79e71e90 |
children | 0fa27f37d4d4 |
line wrap: on
line diff
--- a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp Thu Dec 02 13:20:39 2010 -0500 +++ b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp Tue Dec 07 16:47:42 2010 -0500 @@ -479,6 +479,7 @@ // region before we need to do a collection again. size_t min_length = _g1->young_list()->length() + 1; _young_list_target_length = MAX2(_young_list_target_length, min_length); + calculate_max_gc_locker_expansion(); calculate_survivors_policy(); } @@ -2301,6 +2302,21 @@ }; } +void G1CollectorPolicy::calculate_max_gc_locker_expansion() { + size_t expansion_region_num = 0; + if (GCLockerEdenExpansionPercent > 0) { + double perc = (double) GCLockerEdenExpansionPercent / 100.0; + double expansion_region_num_d = perc * (double) _young_list_target_length; + // We use ceiling so that if expansion_region_num_d is > 0.0 (but + // less than 1.0) we'll get 1. + expansion_region_num = (size_t) ceil(expansion_region_num_d); + } else { + assert(expansion_region_num == 0, "sanity"); + } + _young_list_max_length = _young_list_target_length + expansion_region_num; + assert(_young_list_target_length <= _young_list_max_length, "post-condition"); +} + // Calculates survivor space parameters. void G1CollectorPolicy::calculate_survivors_policy() {