39
40 // A G1Policy makes policy decisions that determine the
41 // characteristics of the collector. Examples include:
42 // * choice of collection set.
43 // * when to collect.
44
45 class HeapRegion;
46 class G1CollectionSet;
47 class G1CollectionSetCandidates;
48 class G1CollectionSetChooser;
49 class G1IHOPControl;
50 class G1Analytics;
51 class G1SurvivorRegions;
52 class G1YoungGenSizer;
53 class GCPolicyCounters;
54 class STWGCTimer;
55
56 class G1Policy: public CHeapObj<mtGC> {
57 private:
58
59 static G1IHOPControl* create_ihop_control(const G1Predictions* predictor);
60 // Update the IHOP control with necessary statistics.
61 void update_ihop_prediction(double mutator_time_s,
62 size_t mutator_alloc_bytes,
63 size_t young_gen_size,
64 bool this_gc_was_young_only);
65 void report_ihop_statistics();
66
67 G1Predictions _predictor;
68 G1Analytics* _analytics;
69 G1RemSetTrackingPolicy _remset_tracker;
70 G1MMUTracker* _mmu_tracker;
71 G1IHOPControl* _ihop_control;
72
73 GCPolicyCounters* _policy_counters;
74
75 double _full_collection_start_sec;
76
77 uint _young_list_target_length;
78 uint _young_list_fixed_length;
79
80 // The max number of regions we can extend the eden by while the GC
81 // locker is active. This should be >= _young_list_target_length;
82 uint _young_list_max_length;
83
84 // The survivor rate groups below must be initialized after the predictor because they
85 // indirectly use it through the "this" object passed to their constructor.
86 G1SurvRateGroup* _eden_surv_rate_group;
87 G1SurvRateGroup* _survivor_surv_rate_group;
88
89 double _reserve_factor;
90 // This will be set when the heap is expanded
91 // for the first time during initialization.
92 uint _reserve_regions;
93
94 G1YoungGenSizer* _young_gen_sizer;
95
96 uint _free_regions_at_end_of_collection;
97
98 size_t _rs_length;
99
100 size_t _rs_length_prediction;
101
102 size_t _pending_cards_at_gc_start;
103
104 // Tracking the allocation in the old generation between
105 // two GCs.
106 G1OldGenAllocationTracker _old_gen_alloc_tracker;
107
108 G1ConcurrentStartToMixedTimeTracker _concurrent_start_to_mixed;
109
110 bool should_update_surv_rate_group_predictors() {
111 return collector_state()->in_young_only_phase() && !collector_state()->mark_or_rebuild_in_progress();
112 }
113
114 double logged_cards_processing_time() const;
115 public:
116 const G1Predictions& predictor() const { return _predictor; }
117 const G1Analytics* analytics() const { return const_cast<const G1Analytics*>(_analytics); }
118
119 G1RemSetTrackingPolicy* remset_tracker() { return &_remset_tracker; }
120
121 G1OldGenAllocationTracker* old_gen_alloc_tracker() { return &_old_gen_alloc_tracker; }
122
123 void set_region_eden(HeapRegion* hr) {
124 hr->set_eden();
125 hr->install_surv_rate_group(_eden_surv_rate_group);
126 }
|
39
40 // A G1Policy makes policy decisions that determine the
41 // characteristics of the collector. Examples include:
42 // * choice of collection set.
43 // * when to collect.
44
45 class HeapRegion;
46 class G1CollectionSet;
47 class G1CollectionSetCandidates;
48 class G1CollectionSetChooser;
49 class G1IHOPControl;
50 class G1Analytics;
51 class G1SurvivorRegions;
52 class G1YoungGenSizer;
53 class GCPolicyCounters;
54 class STWGCTimer;
55
56 class G1Policy: public CHeapObj<mtGC> {
57 private:
58
59 static G1IHOPControl* create_ihop_control(const G1OldGenAllocationTracker* old_gen_alloc_tracker,
60 const G1Predictions* predictor);
61 // Update the IHOP control with necessary statistics.
62 void update_ihop_prediction(double mutator_time_s,
63 size_t young_gen_size,
64 bool this_gc_was_young_only);
65 void report_ihop_statistics();
66
67 G1Predictions _predictor;
68 G1Analytics* _analytics;
69 G1RemSetTrackingPolicy _remset_tracker;
70 G1MMUTracker* _mmu_tracker;
71
72 // Tracking the allocation in the old generation between
73 // two GCs.
74 G1OldGenAllocationTracker _old_gen_alloc_tracker;
75 G1IHOPControl* _ihop_control;
76
77 GCPolicyCounters* _policy_counters;
78
79 double _full_collection_start_sec;
80
81 uint _young_list_target_length;
82 uint _young_list_fixed_length;
83
84 // The max number of regions we can extend the eden by while the GC
85 // locker is active. This should be >= _young_list_target_length;
86 uint _young_list_max_length;
87
88 // The survivor rate groups below must be initialized after the predictor because they
89 // indirectly use it through the "this" object passed to their constructor.
90 G1SurvRateGroup* _eden_surv_rate_group;
91 G1SurvRateGroup* _survivor_surv_rate_group;
92
93 double _reserve_factor;
94 // This will be set when the heap is expanded
95 // for the first time during initialization.
96 uint _reserve_regions;
97
98 G1YoungGenSizer* _young_gen_sizer;
99
100 uint _free_regions_at_end_of_collection;
101
102 size_t _rs_length;
103
104 size_t _rs_length_prediction;
105
106 size_t _pending_cards_at_gc_start;
107
108 G1ConcurrentStartToMixedTimeTracker _concurrent_start_to_mixed;
109
110 bool should_update_surv_rate_group_predictors() {
111 return collector_state()->in_young_only_phase() && !collector_state()->mark_or_rebuild_in_progress();
112 }
113
114 double logged_cards_processing_time() const;
115 public:
116 const G1Predictions& predictor() const { return _predictor; }
117 const G1Analytics* analytics() const { return const_cast<const G1Analytics*>(_analytics); }
118
119 G1RemSetTrackingPolicy* remset_tracker() { return &_remset_tracker; }
120
121 G1OldGenAllocationTracker* old_gen_alloc_tracker() { return &_old_gen_alloc_tracker; }
122
123 void set_region_eden(HeapRegion* hr) {
124 hr->set_eden();
125 hr->install_surv_rate_group(_eden_surv_rate_group);
126 }
|