1.1 --- a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp Wed Sep 07 18:58:33 2011 -0700 1.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp Thu Sep 08 05:16:49 2011 -0400 1.3 @@ -183,7 +183,6 @@ 1.4 // if true, then it tries to dynamically adjust the length of the 1.5 // young list 1.6 bool _adaptive_young_list_length; 1.7 - size_t _young_list_min_length; 1.8 size_t _young_list_target_length; 1.9 size_t _young_list_fixed_length; 1.10 1.11 @@ -207,6 +206,9 @@ 1.12 1.13 double _gc_overhead_perc; 1.14 1.15 + double _reserve_factor; 1.16 + size_t _reserve_regions; 1.17 + 1.18 bool during_marking() { 1.19 return _during_marking; 1.20 } 1.21 @@ -456,12 +458,6 @@ 1.22 size_t predict_bytes_to_copy(HeapRegion* hr); 1.23 double predict_region_elapsed_time_ms(HeapRegion* hr, bool young); 1.24 1.25 - // for use by: calculate_young_list_target_length(rs_length) 1.26 - bool predict_will_fit(size_t young_region_num, 1.27 - double base_time_ms, 1.28 - size_t init_free_regions, 1.29 - double target_pause_time_ms); 1.30 - 1.31 void start_recording_regions(); 1.32 void record_cset_region_info(HeapRegion* hr, bool young); 1.33 void record_non_young_cset_region(HeapRegion* hr); 1.34 @@ -771,9 +767,41 @@ 1.35 double _mark_cleanup_start_sec; 1.36 double _mark_closure_time_ms; 1.37 1.38 - void calculate_young_list_min_length(); 1.39 - void calculate_young_list_target_length(); 1.40 - void calculate_young_list_target_length(size_t rs_lengths); 1.41 + // Update the young list target length either by setting it to the 1.42 + // desired fixed value or by calculating it using G1's pause 1.43 + // prediction model. If no rs_lengths parameter is passed, predict 1.44 + // the RS lengths using the prediction model, otherwise use the 1.45 + // given rs_lengths as the prediction. 1.46 + void update_young_list_target_length(size_t rs_lengths = (size_t) -1); 1.47 + 1.48 + // Calculate and return the minimum desired young list target 1.49 + // length. This is the minimum desired young list length according 1.50 + // to the user's inputs. 1.51 + size_t calculate_young_list_desired_min_length(size_t base_min_length); 1.52 + 1.53 + // Calculate and return the maximum desired young list target 1.54 + // length. This is the maximum desired young list length according 1.55 + // to the user's inputs. 1.56 + size_t calculate_young_list_desired_max_length(); 1.57 + 1.58 + // Calculate and return the maximum young list target length that 1.59 + // can fit into the pause time goal. The parameters are: rs_lengths 1.60 + // represent the prediction of how large the young RSet lengths will 1.61 + // be, base_min_length is the alreay existing number of regions in 1.62 + // the young list, min_length and max_length are the desired min and 1.63 + // max young list length according to the user's inputs. 1.64 + size_t calculate_young_list_target_length(size_t rs_lengths, 1.65 + size_t base_min_length, 1.66 + size_t desired_min_length, 1.67 + size_t desired_max_length); 1.68 + 1.69 + // Check whether a given young length (young_length) fits into the 1.70 + // given target pause time and whether the prediction for the amount 1.71 + // of objects to be copied for the given length will fit into the 1.72 + // given free space (expressed by base_free_regions). It is used by 1.73 + // calculate_young_list_target_length(). 1.74 + bool predict_will_fit(size_t young_length, double base_time_ms, 1.75 + size_t base_free_regions, double target_pause_time_ms); 1.76 1.77 public: 1.78 1.79 @@ -785,7 +813,10 @@ 1.80 return CollectorPolicy::G1CollectorPolicyKind; 1.81 } 1.82 1.83 - void check_prediction_validity(); 1.84 + // Check the current value of the young list RSet lengths and 1.85 + // compare it against the last prediction. If the current value is 1.86 + // higher, recalculate the young list target length prediction. 1.87 + void revise_young_list_target_length_if_necessary(); 1.88 1.89 size_t bytes_in_collection_set() { 1.90 return _bytes_in_collection_set_before_gc; 1.91 @@ -795,6 +826,10 @@ 1.92 return _all_pause_times_ms->num() + 1; 1.93 } 1.94 1.95 + // Recalculate the reserve region number. This should be called 1.96 + // after the heap is resized. 1.97 + void calculate_reserve(size_t all_regions); 1.98 + 1.99 protected: 1.100 1.101 // Count the number of bytes used in the CS. 1.102 @@ -1203,10 +1238,10 @@ 1.103 _survivors_age_table.merge_par(age_table); 1.104 } 1.105 1.106 - void calculate_max_gc_locker_expansion(); 1.107 + void update_max_gc_locker_expansion(); 1.108 1.109 // Calculates survivor space parameters. 1.110 - void calculate_survivors_policy(); 1.111 + void update_survivors_policy(); 1.112 1.113 }; 1.114