181 bool _full_young_gcs; |
181 bool _full_young_gcs; |
182 |
182 |
183 // if true, then it tries to dynamically adjust the length of the |
183 // if true, then it tries to dynamically adjust the length of the |
184 // young list |
184 // young list |
185 bool _adaptive_young_list_length; |
185 bool _adaptive_young_list_length; |
186 size_t _young_list_min_length; |
|
187 size_t _young_list_target_length; |
186 size_t _young_list_target_length; |
188 size_t _young_list_fixed_length; |
187 size_t _young_list_fixed_length; |
189 |
188 |
190 // The max number of regions we can extend the eden by while the GC |
189 // The max number of regions we can extend the eden by while the GC |
191 // locker is active. This should be >= _young_list_target_length; |
190 // locker is active. This should be >= _young_list_target_length; |
204 SurvRateGroup* _short_lived_surv_rate_group; |
203 SurvRateGroup* _short_lived_surv_rate_group; |
205 SurvRateGroup* _survivor_surv_rate_group; |
204 SurvRateGroup* _survivor_surv_rate_group; |
206 // add here any more surv rate groups |
205 // add here any more surv rate groups |
207 |
206 |
208 double _gc_overhead_perc; |
207 double _gc_overhead_perc; |
|
208 |
|
209 double _reserve_factor; |
|
210 size_t _reserve_regions; |
209 |
211 |
210 bool during_marking() { |
212 bool during_marking() { |
211 return _during_marking; |
213 return _during_marking; |
212 } |
214 } |
213 |
215 |
453 double predict_base_elapsed_time_ms(size_t pending_cards); |
455 double predict_base_elapsed_time_ms(size_t pending_cards); |
454 double predict_base_elapsed_time_ms(size_t pending_cards, |
456 double predict_base_elapsed_time_ms(size_t pending_cards, |
455 size_t scanned_cards); |
457 size_t scanned_cards); |
456 size_t predict_bytes_to_copy(HeapRegion* hr); |
458 size_t predict_bytes_to_copy(HeapRegion* hr); |
457 double predict_region_elapsed_time_ms(HeapRegion* hr, bool young); |
459 double predict_region_elapsed_time_ms(HeapRegion* hr, bool young); |
458 |
|
459 // for use by: calculate_young_list_target_length(rs_length) |
|
460 bool predict_will_fit(size_t young_region_num, |
|
461 double base_time_ms, |
|
462 size_t init_free_regions, |
|
463 double target_pause_time_ms); |
|
464 |
460 |
465 void start_recording_regions(); |
461 void start_recording_regions(); |
466 void record_cset_region_info(HeapRegion* hr, bool young); |
462 void record_cset_region_info(HeapRegion* hr, bool young); |
467 void record_non_young_cset_region(HeapRegion* hr); |
463 void record_non_young_cset_region(HeapRegion* hr); |
468 |
464 |
769 double _cur_mark_stop_world_time_ms; |
765 double _cur_mark_stop_world_time_ms; |
770 double _mark_remark_start_sec; |
766 double _mark_remark_start_sec; |
771 double _mark_cleanup_start_sec; |
767 double _mark_cleanup_start_sec; |
772 double _mark_closure_time_ms; |
768 double _mark_closure_time_ms; |
773 |
769 |
774 void calculate_young_list_min_length(); |
770 // Update the young list target length either by setting it to the |
775 void calculate_young_list_target_length(); |
771 // desired fixed value or by calculating it using G1's pause |
776 void calculate_young_list_target_length(size_t rs_lengths); |
772 // prediction model. If no rs_lengths parameter is passed, predict |
|
773 // the RS lengths using the prediction model, otherwise use the |
|
774 // given rs_lengths as the prediction. |
|
775 void update_young_list_target_length(size_t rs_lengths = (size_t) -1); |
|
776 |
|
777 // Calculate and return the minimum desired young list target |
|
778 // length. This is the minimum desired young list length according |
|
779 // to the user's inputs. |
|
780 size_t calculate_young_list_desired_min_length(size_t base_min_length); |
|
781 |
|
782 // Calculate and return the maximum desired young list target |
|
783 // length. This is the maximum desired young list length according |
|
784 // to the user's inputs. |
|
785 size_t calculate_young_list_desired_max_length(); |
|
786 |
|
787 // Calculate and return the maximum young list target length that |
|
788 // can fit into the pause time goal. The parameters are: rs_lengths |
|
789 // represent the prediction of how large the young RSet lengths will |
|
790 // be, base_min_length is the alreay existing number of regions in |
|
791 // the young list, min_length and max_length are the desired min and |
|
792 // max young list length according to the user's inputs. |
|
793 size_t calculate_young_list_target_length(size_t rs_lengths, |
|
794 size_t base_min_length, |
|
795 size_t desired_min_length, |
|
796 size_t desired_max_length); |
|
797 |
|
798 // Check whether a given young length (young_length) fits into the |
|
799 // given target pause time and whether the prediction for the amount |
|
800 // of objects to be copied for the given length will fit into the |
|
801 // given free space (expressed by base_free_regions). It is used by |
|
802 // calculate_young_list_target_length(). |
|
803 bool predict_will_fit(size_t young_length, double base_time_ms, |
|
804 size_t base_free_regions, double target_pause_time_ms); |
777 |
805 |
778 public: |
806 public: |
779 |
807 |
780 G1CollectorPolicy(); |
808 G1CollectorPolicy(); |
781 |
809 |
783 |
811 |
784 virtual CollectorPolicy::Name kind() { |
812 virtual CollectorPolicy::Name kind() { |
785 return CollectorPolicy::G1CollectorPolicyKind; |
813 return CollectorPolicy::G1CollectorPolicyKind; |
786 } |
814 } |
787 |
815 |
788 void check_prediction_validity(); |
816 // Check the current value of the young list RSet lengths and |
|
817 // compare it against the last prediction. If the current value is |
|
818 // higher, recalculate the young list target length prediction. |
|
819 void revise_young_list_target_length_if_necessary(); |
789 |
820 |
790 size_t bytes_in_collection_set() { |
821 size_t bytes_in_collection_set() { |
791 return _bytes_in_collection_set_before_gc; |
822 return _bytes_in_collection_set_before_gc; |
792 } |
823 } |
793 |
824 |
794 unsigned calc_gc_alloc_time_stamp() { |
825 unsigned calc_gc_alloc_time_stamp() { |
795 return _all_pause_times_ms->num() + 1; |
826 return _all_pause_times_ms->num() + 1; |
796 } |
827 } |
|
828 |
|
829 // Recalculate the reserve region number. This should be called |
|
830 // after the heap is resized. |
|
831 void calculate_reserve(size_t all_regions); |
797 |
832 |
798 protected: |
833 protected: |
799 |
834 |
800 // Count the number of bytes used in the CS. |
835 // Count the number of bytes used in the CS. |
801 void count_CS_bytes_used(); |
836 void count_CS_bytes_used(); |
1201 void record_thread_age_table(ageTable* age_table) |
1236 void record_thread_age_table(ageTable* age_table) |
1202 { |
1237 { |
1203 _survivors_age_table.merge_par(age_table); |
1238 _survivors_age_table.merge_par(age_table); |
1204 } |
1239 } |
1205 |
1240 |
1206 void calculate_max_gc_locker_expansion(); |
1241 void update_max_gc_locker_expansion(); |
1207 |
1242 |
1208 // Calculates survivor space parameters. |
1243 // Calculates survivor space parameters. |
1209 void calculate_survivors_policy(); |
1244 void update_survivors_policy(); |
1210 |
1245 |
1211 }; |
1246 }; |
1212 |
1247 |
1213 // This encapsulates a particular strategy for a g1 Collector. |
1248 // This encapsulates a particular strategy for a g1 Collector. |
1214 // |
1249 // |