comparison 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
comparison
equal deleted inserted replaced
1975:d9310331a29c 1991:016a3628c885
477 477
478 // Make sure we allow the application to allocate at least one 478 // Make sure we allow the application to allocate at least one
479 // region before we need to do a collection again. 479 // region before we need to do a collection again.
480 size_t min_length = _g1->young_list()->length() + 1; 480 size_t min_length = _g1->young_list()->length() + 1;
481 _young_list_target_length = MAX2(_young_list_target_length, min_length); 481 _young_list_target_length = MAX2(_young_list_target_length, min_length);
482 calculate_max_gc_locker_expansion();
482 calculate_survivors_policy(); 483 calculate_survivors_policy();
483 } 484 }
484 485
485 void G1CollectorPolicy::calculate_young_list_target_length(size_t rs_lengths) { 486 void G1CollectorPolicy::calculate_young_list_target_length(size_t rs_lengths) {
486 guarantee( adaptive_young_list_length(), "pre-condition" ); 487 guarantee( adaptive_young_list_length(), "pre-condition" );
2299 ShouldNotReachHere(); 2300 ShouldNotReachHere();
2300 return REGIONS_UNLIMITED; 2301 return REGIONS_UNLIMITED;
2301 }; 2302 };
2302 } 2303 }
2303 2304
2305 void G1CollectorPolicy::calculate_max_gc_locker_expansion() {
2306 size_t expansion_region_num = 0;
2307 if (GCLockerEdenExpansionPercent > 0) {
2308 double perc = (double) GCLockerEdenExpansionPercent / 100.0;
2309 double expansion_region_num_d = perc * (double) _young_list_target_length;
2310 // We use ceiling so that if expansion_region_num_d is > 0.0 (but
2311 // less than 1.0) we'll get 1.
2312 expansion_region_num = (size_t) ceil(expansion_region_num_d);
2313 } else {
2314 assert(expansion_region_num == 0, "sanity");
2315 }
2316 _young_list_max_length = _young_list_target_length + expansion_region_num;
2317 assert(_young_list_target_length <= _young_list_max_length, "post-condition");
2318 }
2319
2304 // Calculates survivor space parameters. 2320 // Calculates survivor space parameters.
2305 void G1CollectorPolicy::calculate_survivors_policy() 2321 void G1CollectorPolicy::calculate_survivors_policy()
2306 { 2322 {
2307 if (G1FixedSurvivorSpaceSize == 0) { 2323 if (G1FixedSurvivorSpaceSize == 0) {
2308 _max_survivor_regions = _young_list_target_length / SurvivorRatio; 2324 _max_survivor_regions = _young_list_target_length / SurvivorRatio;