42 class HeapRegion;
43 class G1CollectionSet;
44 class CollectionSetChooser;
45 class G1IHOPControl;
46 class G1Measurements;
47 class G1YoungGenSizer;
48
49 class G1CollectorPolicy: public CollectorPolicy {
50 private:
51 G1IHOPControl* _ihop_control;
52
53 G1IHOPControl* create_ihop_control() const;
54 // Update the IHOP control with necessary statistics.
55 void update_ihop_prediction(double mutator_time_s,
56 size_t mutator_alloc_bytes,
57 size_t young_gen_size);
58 void report_ihop_statistics();
59
60 G1Predictions _predictor;
61 G1Measurements* _measurements;
62
63 G1MMUTracker* _mmu_tracker;
64
65 void initialize_alignments();
66 void initialize_flags();
67
68 double _full_collection_start_sec;
69
70 // Ratio check data for determining if heap growth is necessary.
71 uint _ratio_over_threshold_count;
72 double _ratio_over_threshold_sum;
73 uint _pauses_since_start;
74
75 uint _young_list_target_length;
76 uint _young_list_fixed_length;
77
78 // The max number of regions we can extend the eden by while the GC
79 // locker is active. This should be >= _young_list_target_length;
80 uint _young_list_max_length;
81
82 SurvRateGroup* _short_lived_surv_rate_group;
83 SurvRateGroup* _survivor_surv_rate_group;
84
85 double _gc_overhead_perc;
86
87 double _reserve_factor;
88 uint _reserve_regions;
89
90 enum PredictionConstants {
91 NumPrevPausesForHeuristics = 10,
92 // MinOverThresholdForGrowth must be less than NumPrevPausesForHeuristics,
93 // representing the minimum number of pause time ratios that exceed
94 // GCTimeRatio before a heap expansion will be triggered.
95 MinOverThresholdForGrowth = 4
96 };
97 G1YoungGenSizer* _young_gen_sizer;
98
99 uint _free_regions_at_end_of_collection;
100
101 size_t _max_rs_lengths;
102
103 size_t _rs_lengths_prediction;
104
105 #ifndef PRODUCT
106 bool verify_young_ages(HeapRegion* head, SurvRateGroup *surv_rate_group);
107 #endif // PRODUCT
108
109 void adjust_concurrent_refinement(double update_rs_time,
110 double update_rs_processed_buffers,
111 double goal_ms);
112
113 double _pause_time_target_ms;
114
115 size_t _pending_cards;
116
373 private:
374 // Set the state to start a concurrent marking cycle and clear
375 // _initiate_conc_mark_if_possible because it has now been
376 // acted on.
377 void initiate_conc_mark();
378
379 public:
380 // This sets the initiate_conc_mark_if_possible() flag to start a
381 // new cycle, as long as we are not already in one. It's best if it
382 // is called during a safepoint when the test whether a cycle is in
383 // progress or not is stable.
384 bool force_initial_mark_if_outside_cycle(GCCause::Cause gc_cause);
385
386 // This is called at the very beginning of an evacuation pause (it
387 // has to be the first thing that the pause does). If
388 // initiate_conc_mark_if_possible() is true, and the concurrent
389 // marking thread has completed its work during the previous cycle,
390 // it will set during_initial_mark_pause() to so that the pause does
391 // the initial-mark work and start a marking cycle.
392 void decide_on_conc_mark_initiation();
393
394 // If an expansion would be appropriate, because recent GC overhead had
395 // exceeded the desired limit, return an amount to expand by.
396 virtual size_t expansion_amount();
397
398 // Clear ratio tracking data used by expansion_amount().
399 void clear_ratio_check_data();
400
401 // Print stats on young survival ratio
402 void print_yg_surv_rate_info() const;
403
404 void finished_recalculating_age_indexes(bool is_survivors) {
405 if (is_survivors) {
406 _survivor_surv_rate_group->finished_recalculating_age_indexes();
407 } else {
408 _short_lived_surv_rate_group->finished_recalculating_age_indexes();
409 }
410 }
411
412 size_t young_list_target_length() const { return _young_list_target_length; }
413
414 bool is_young_list_full() const;
415
416 bool can_expand_young_list() const;
417
418 uint young_list_max_length() const {
419 return _young_list_max_length;
|
42 class HeapRegion;
43 class G1CollectionSet;
44 class CollectionSetChooser;
45 class G1IHOPControl;
46 class G1Measurements;
47 class G1YoungGenSizer;
48
49 class G1CollectorPolicy: public CollectorPolicy {
50 private:
51 G1IHOPControl* _ihop_control;
52
53 G1IHOPControl* create_ihop_control() const;
54 // Update the IHOP control with necessary statistics.
55 void update_ihop_prediction(double mutator_time_s,
56 size_t mutator_alloc_bytes,
57 size_t young_gen_size);
58 void report_ihop_statistics();
59
60 G1Predictions _predictor;
61 G1Measurements* _measurements;
62 G1MMUTracker* _mmu_tracker;
63
64 void initialize_alignments();
65 void initialize_flags();
66
67 double _full_collection_start_sec;
68
69 uint _young_list_target_length;
70 uint _young_list_fixed_length;
71
72 // The max number of regions we can extend the eden by while the GC
73 // locker is active. This should be >= _young_list_target_length;
74 uint _young_list_max_length;
75
76 SurvRateGroup* _short_lived_surv_rate_group;
77 SurvRateGroup* _survivor_surv_rate_group;
78
79 double _reserve_factor;
80 uint _reserve_regions;
81
82 G1YoungGenSizer* _young_gen_sizer;
83
84 uint _free_regions_at_end_of_collection;
85
86 size_t _max_rs_lengths;
87
88 size_t _rs_lengths_prediction;
89
90 #ifndef PRODUCT
91 bool verify_young_ages(HeapRegion* head, SurvRateGroup *surv_rate_group);
92 #endif // PRODUCT
93
94 void adjust_concurrent_refinement(double update_rs_time,
95 double update_rs_processed_buffers,
96 double goal_ms);
97
98 double _pause_time_target_ms;
99
100 size_t _pending_cards;
101
358 private:
359 // Set the state to start a concurrent marking cycle and clear
360 // _initiate_conc_mark_if_possible because it has now been
361 // acted on.
362 void initiate_conc_mark();
363
364 public:
365 // This sets the initiate_conc_mark_if_possible() flag to start a
366 // new cycle, as long as we are not already in one. It's best if it
367 // is called during a safepoint when the test whether a cycle is in
368 // progress or not is stable.
369 bool force_initial_mark_if_outside_cycle(GCCause::Cause gc_cause);
370
371 // This is called at the very beginning of an evacuation pause (it
372 // has to be the first thing that the pause does). If
373 // initiate_conc_mark_if_possible() is true, and the concurrent
374 // marking thread has completed its work during the previous cycle,
375 // it will set during_initial_mark_pause() to so that the pause does
376 // the initial-mark work and start a marking cycle.
377 void decide_on_conc_mark_initiation();
378
379 // Print stats on young survival ratio
380 void print_yg_surv_rate_info() const;
381
382 void finished_recalculating_age_indexes(bool is_survivors) {
383 if (is_survivors) {
384 _survivor_surv_rate_group->finished_recalculating_age_indexes();
385 } else {
386 _short_lived_surv_rate_group->finished_recalculating_age_indexes();
387 }
388 }
389
390 size_t young_list_target_length() const { return _young_list_target_length; }
391
392 bool is_young_list_full() const;
393
394 bool can_expand_young_list() const;
395
396 uint young_list_max_length() const {
397 return _young_list_max_length;
|