74 // Statistical data gathered for GC
75 GCStats _gc_stats;
76
77 size_t _survivor_size_limit; // Limit in bytes of survivor size
78 const double _collection_cost_margin_fraction;
79
80 // Variable for estimating the major and minor pause times.
81 // These variables represent linear least-squares fits of
82 // the data.
83 // major pause time vs. old gen size
84 LinearLeastSquareFit* _major_pause_old_estimator;
85 // major pause time vs. young gen size
86 LinearLeastSquareFit* _major_pause_young_estimator;
87
88
89 // These record the most recent collection times. They
90 // are available as an alternative to using the averages
91 // for making ergonomic decisions.
92 double _latest_major_mutator_interval_seconds;
93
94 const size_t _intra_generation_alignment; // alignment for eden, survivors
95
96 const double _gc_minor_pause_goal_sec; // goal for maximum minor gc pause
97
98 // The amount of live data in the heap at the last full GC, used
99 // as a baseline to help us determine when we need to perform the
100 // next full GC.
101 size_t _live_at_last_full_gc;
102
103 // decrease/increase the old generation for minor pause time
104 int _change_old_gen_for_min_pauses;
105
106 // increase/decrease the young generation for major pause time
107 int _change_young_gen_for_maj_pauses;
108
109
110 // Flag indicating that the adaptive policy is ready to use
111 bool _old_gen_policy_is_ready;
112
113 // Changing the generation sizing depends on the data that is
114 // gathered about the effects of changes on the pause times and
212
213 virtual size_t eden_increment(size_t cur_eden);
214 virtual size_t promo_increment(size_t cur_promo);
215
216 // Accessors for use by performance counters
217 AdaptivePaddedNoZeroDevAverage* avg_promoted() const {
218 return _gc_stats.avg_promoted();
219 }
220 AdaptiveWeightedAverage* avg_base_footprint() const {
221 return _avg_base_footprint;
222 }
223
224 // Input arguments are initial free space sizes for young and old
225 // generations, the initial survivor space size, the
226 // alignment values and the pause & throughput goals.
227 //
228 // NEEDS_CLEANUP this is a singleton object
229 PSAdaptiveSizePolicy(size_t init_eden_size,
230 size_t init_promo_size,
231 size_t init_survivor_size,
232 size_t intra_generation_alignment,
233 double gc_pause_goal_sec,
234 double gc_minor_pause_goal_sec,
235 uint gc_time_ratio);
236
237 // Methods indicating events of interest to the adaptive size policy,
238 // called by GC algorithms. It is the responsibility of users of this
239 // policy to call these methods at the correct times!
240 void major_collection_begin();
241 void major_collection_end(size_t amount_live, GCCause::Cause gc_cause);
242
243 //
244 void tenured_allocation(size_t size) {
245 _avg_pretenured->sample(size);
246 }
247
248 // Accessors
249 // NEEDS_CLEANUP should use sizes.hpp
250
251 size_t calculated_old_free_size_in_bytes() const {
252 return (size_t)(_promo_size + avg_promoted()->padded_average());
361 size_t cur_eden, // current eden in bytes
362 size_t max_old_gen_size,
363 bool is_full_gc);
364
365 // Calculates new survivor space size; returns a new tenuring threshold
366 // value. Stores new survivor size in _survivor_size.
367 uint compute_survivor_space_size_and_threshold(bool is_survivor_overflow,
368 uint tenuring_threshold,
369 size_t survivor_limit);
370
371 // Return the maximum size of a survivor space if the young generation were of
372 // size gen_size.
373 size_t max_survivor_size(size_t gen_size) {
374 // Never allow the target survivor size to grow more than MinSurvivorRatio
375 // of the young generation size. We cannot grow into a two semi-space
376 // system, with Eden zero sized. Even if the survivor space grows, from()
377 // might grow by moving the bottom boundary "down" -- so from space will
378 // remain almost full anyway (top() will be near end(), but there will be a
379 // large filler object at the bottom).
380 const size_t sz = gen_size / MinSurvivorRatio;
381 const size_t alignment = _intra_generation_alignment;
382 return sz > alignment ? align_size_down(sz, alignment) : alignment;
383 }
384
385 size_t live_at_last_full_gc() {
386 return _live_at_last_full_gc;
387 }
388
389 size_t bytes_absorbed_from_eden() const { return _bytes_absorbed_from_eden; }
390 void reset_bytes_absorbed_from_eden() { _bytes_absorbed_from_eden = 0; }
391
392 void set_bytes_absorbed_from_eden(size_t val) {
393 _bytes_absorbed_from_eden = val;
394 }
395
396 // Update averages that are always used (even
397 // if adaptive sizing is turned off).
398 void update_averages(bool is_survivor_overflow,
399 size_t survived,
400 size_t promoted);
401
|
74 // Statistical data gathered for GC
75 GCStats _gc_stats;
76
77 size_t _survivor_size_limit; // Limit in bytes of survivor size
78 const double _collection_cost_margin_fraction;
79
80 // Variable for estimating the major and minor pause times.
81 // These variables represent linear least-squares fits of
82 // the data.
83 // major pause time vs. old gen size
84 LinearLeastSquareFit* _major_pause_old_estimator;
85 // major pause time vs. young gen size
86 LinearLeastSquareFit* _major_pause_young_estimator;
87
88
89 // These record the most recent collection times. They
90 // are available as an alternative to using the averages
91 // for making ergonomic decisions.
92 double _latest_major_mutator_interval_seconds;
93
94 const size_t _space_alignment; // alignment for eden, survivors
95
96 const double _gc_minor_pause_goal_sec; // goal for maximum minor gc pause
97
98 // The amount of live data in the heap at the last full GC, used
99 // as a baseline to help us determine when we need to perform the
100 // next full GC.
101 size_t _live_at_last_full_gc;
102
103 // decrease/increase the old generation for minor pause time
104 int _change_old_gen_for_min_pauses;
105
106 // increase/decrease the young generation for major pause time
107 int _change_young_gen_for_maj_pauses;
108
109
110 // Flag indicating that the adaptive policy is ready to use
111 bool _old_gen_policy_is_ready;
112
113 // Changing the generation sizing depends on the data that is
114 // gathered about the effects of changes on the pause times and
212
213 virtual size_t eden_increment(size_t cur_eden);
214 virtual size_t promo_increment(size_t cur_promo);
215
216 // Accessors for use by performance counters
217 AdaptivePaddedNoZeroDevAverage* avg_promoted() const {
218 return _gc_stats.avg_promoted();
219 }
220 AdaptiveWeightedAverage* avg_base_footprint() const {
221 return _avg_base_footprint;
222 }
223
224 // Input arguments are initial free space sizes for young and old
225 // generations, the initial survivor space size, the
226 // alignment values and the pause & throughput goals.
227 //
228 // NEEDS_CLEANUP this is a singleton object
229 PSAdaptiveSizePolicy(size_t init_eden_size,
230 size_t init_promo_size,
231 size_t init_survivor_size,
232 size_t space_alignment,
233 double gc_pause_goal_sec,
234 double gc_minor_pause_goal_sec,
235 uint gc_time_ratio);
236
237 // Methods indicating events of interest to the adaptive size policy,
238 // called by GC algorithms. It is the responsibility of users of this
239 // policy to call these methods at the correct times!
240 void major_collection_begin();
241 void major_collection_end(size_t amount_live, GCCause::Cause gc_cause);
242
243 //
244 void tenured_allocation(size_t size) {
245 _avg_pretenured->sample(size);
246 }
247
248 // Accessors
249 // NEEDS_CLEANUP should use sizes.hpp
250
251 size_t calculated_old_free_size_in_bytes() const {
252 return (size_t)(_promo_size + avg_promoted()->padded_average());
361 size_t cur_eden, // current eden in bytes
362 size_t max_old_gen_size,
363 bool is_full_gc);
364
365 // Calculates new survivor space size; returns a new tenuring threshold
366 // value. Stores new survivor size in _survivor_size.
367 uint compute_survivor_space_size_and_threshold(bool is_survivor_overflow,
368 uint tenuring_threshold,
369 size_t survivor_limit);
370
371 // Return the maximum size of a survivor space if the young generation were of
372 // size gen_size.
373 size_t max_survivor_size(size_t gen_size) {
374 // Never allow the target survivor size to grow more than MinSurvivorRatio
375 // of the young generation size. We cannot grow into a two semi-space
376 // system, with Eden zero sized. Even if the survivor space grows, from()
377 // might grow by moving the bottom boundary "down" -- so from space will
378 // remain almost full anyway (top() will be near end(), but there will be a
379 // large filler object at the bottom).
380 const size_t sz = gen_size / MinSurvivorRatio;
381 const size_t alignment = _space_alignment;
382 return sz > alignment ? align_size_down(sz, alignment) : alignment;
383 }
384
385 size_t live_at_last_full_gc() {
386 return _live_at_last_full_gc;
387 }
388
389 size_t bytes_absorbed_from_eden() const { return _bytes_absorbed_from_eden; }
390 void reset_bytes_absorbed_from_eden() { _bytes_absorbed_from_eden = 0; }
391
392 void set_bytes_absorbed_from_eden(size_t val) {
393 _bytes_absorbed_from_eden = val;
394 }
395
396 // Update averages that are always used (even
397 // if adaptive sizing is turned off).
398 void update_averages(bool is_survivor_overflow,
399 size_t survived,
400 size_t promoted);
401
|