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 bool this_gc_was_young_only);
64 void report_ihop_statistics();
65
66 G1Predictions _predictor;
67 G1Analytics* _analytics;
68 G1RemSetTrackingPolicy _remset_tracker;
69 G1MMUTracker* _mmu_tracker;
70 G1IHOPControl* _ihop_control;
71
72 GCPolicyCounters* _policy_counters;
73
74 double _full_collection_start_sec;
75
76 jlong _time_of_last_gc_ns; // For CollectedHeap::millis_since_last_gc() support
77
78 uint _young_list_desired_length;
79 uint _young_list_target_length;
80
81 // The max number of regions we can extend the eden by while the GC
82 // locker is active. This should be >= _young_list_target_length;
83 uint _young_list_max_length;
84
85 // The survivor rate groups below must be initialized after the predictor because they
86 // indirectly use it through the "this" object passed to their constructor.
87 G1SurvRateGroup* _eden_surv_rate_group;
88 G1SurvRateGroup* _survivor_surv_rate_group;
89
90 double _reserve_factor;
91 // This will be set when the heap is expanded
92 // for the first time during initialization.
93 uint _reserve_regions;
94
95 G1YoungGenSizer* _young_gen_sizer;
96
97 uint _free_regions_at_end_of_collection;
237 // given free space (expressed by base_free_regions). It is used by
238 // calculate_young_list_target_length().
239 bool predict_will_fit(uint young_length, double base_time_ms,
240 uint base_free_regions, double target_pause_time_ms) const;
241
242 public:
243 size_t pending_cards_at_gc_start() const { return _pending_cards_at_gc_start; }
244
245 // Calculate the minimum number of old regions we'll add to the CSet
246 // during a mixed GC.
247 uint calc_min_old_cset_length() const;
248
249 // Calculate the maximum number of old regions we'll add to the CSet
250 // during a mixed GC.
251 uint calc_max_old_cset_length() const;
252
253 // Returns the given amount of reclaimable bytes (that represents
254 // the amount of reclaimable space still to be collected) as a
255 // percentage of the current heap capacity.
256 double reclaimable_bytes_percent(size_t reclaimable_bytes) const;
257
258 jlong time_of_last_gc() { return _time_of_last_gc_ns; }
259
260 private:
261 void clear_collection_set_candidates();
262 // Sets up marking if proper conditions are met.
263 void maybe_start_marking();
264
265 // The kind of STW pause.
266 enum PauseKind {
267 FullGC,
268 YoungOnlyGC,
269 MixedGC,
270 LastYoungGC,
271 InitialMarkGC,
272 Cleanup,
273 Remark
274 };
275
276 // Calculate PauseKind from internal state.
277 PauseKind young_gc_pause_kind() const;
278 // Record the given STW pause with the given start and end times (in s).
|
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 bool this_gc_was_young_only);
64 void report_ihop_statistics();
65
66 G1Predictions _predictor;
67 G1Analytics* _analytics;
68 G1RemSetTrackingPolicy _remset_tracker;
69 G1MMUTracker* _mmu_tracker;
70 G1IHOPControl* _ihop_control;
71
72 GCPolicyCounters* _policy_counters;
73
74 double _full_collection_start_sec;
75
76 uint _young_list_desired_length;
77 uint _young_list_target_length;
78
79 // The max number of regions we can extend the eden by while the GC
80 // locker is active. This should be >= _young_list_target_length;
81 uint _young_list_max_length;
82
83 // The survivor rate groups below must be initialized after the predictor because they
84 // indirectly use it through the "this" object passed to their constructor.
85 G1SurvRateGroup* _eden_surv_rate_group;
86 G1SurvRateGroup* _survivor_surv_rate_group;
87
88 double _reserve_factor;
89 // This will be set when the heap is expanded
90 // for the first time during initialization.
91 uint _reserve_regions;
92
93 G1YoungGenSizer* _young_gen_sizer;
94
95 uint _free_regions_at_end_of_collection;
235 // given free space (expressed by base_free_regions). It is used by
236 // calculate_young_list_target_length().
237 bool predict_will_fit(uint young_length, double base_time_ms,
238 uint base_free_regions, double target_pause_time_ms) const;
239
240 public:
241 size_t pending_cards_at_gc_start() const { return _pending_cards_at_gc_start; }
242
243 // Calculate the minimum number of old regions we'll add to the CSet
244 // during a mixed GC.
245 uint calc_min_old_cset_length() const;
246
247 // Calculate the maximum number of old regions we'll add to the CSet
248 // during a mixed GC.
249 uint calc_max_old_cset_length() const;
250
251 // Returns the given amount of reclaimable bytes (that represents
252 // the amount of reclaimable space still to be collected) as a
253 // percentage of the current heap capacity.
254 double reclaimable_bytes_percent(size_t reclaimable_bytes) const;
255
256 private:
257 void clear_collection_set_candidates();
258 // Sets up marking if proper conditions are met.
259 void maybe_start_marking();
260
261 // The kind of STW pause.
262 enum PauseKind {
263 FullGC,
264 YoungOnlyGC,
265 MixedGC,
266 LastYoungGC,
267 InitialMarkGC,
268 Cleanup,
269 Remark
270 };
271
272 // Calculate PauseKind from internal state.
273 PauseKind young_gc_pause_kind() const;
274 // Record the given STW pause with the given start and end times (in s).
|