comparison src/share/vm/gc_implementation/parallelScavenge/psAdaptiveSizePolicy.hpp @ 10288:eba99d16dc6f

8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy Summary: split up compute_generation_free_space() into two functions: compute_eden_space_size() + compute_old_gen_free_space(), each of which (if needed) can be reused without executing an overhead of the other. Reviewed-by: jmasa, tschatzl Contributed-by: tamao <tao.mao@oracle.com>
author tamao
date Wed, 15 May 2013 10:41:22 -0700
parents 22b8d3d181d9
children 14d3f71f831d
comparison
equal deleted inserted replaced
10287:12f651e29f6b 10288:eba99d16dc6f
1 /* 1 /*
2 * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
134 // Accessors 134 // Accessors
135 AdaptivePaddedAverage* avg_major_pause() const { return _avg_major_pause; } 135 AdaptivePaddedAverage* avg_major_pause() const { return _avg_major_pause; }
136 double gc_minor_pause_goal_sec() const { return _gc_minor_pause_goal_sec; } 136 double gc_minor_pause_goal_sec() const { return _gc_minor_pause_goal_sec; }
137 137
138 // Change the young generation size to achieve a minor GC pause time goal 138 // Change the young generation size to achieve a minor GC pause time goal
139 void adjust_for_minor_pause_time(bool is_full_gc, 139 void adjust_promo_for_minor_pause_time(bool is_full_gc,
140 size_t* desired_promo_size_ptr, 140 size_t* desired_promo_size_ptr,
141 size_t* desired_eden_size_ptr);
142 void adjust_eden_for_minor_pause_time(bool is_full_gc,
141 size_t* desired_eden_size_ptr); 143 size_t* desired_eden_size_ptr);
142 // Change the generation sizes to achieve a GC pause time goal 144 // Change the generation sizes to achieve a GC pause time goal
143 // Returned sizes are not necessarily aligned. 145 // Returned sizes are not necessarily aligned.
144 void adjust_for_pause_time(bool is_full_gc, 146 void adjust_promo_for_pause_time(bool is_full_gc,
147 size_t* desired_promo_size_ptr,
148 size_t* desired_eden_size_ptr);
149 void adjust_eden_for_pause_time(bool is_full_gc,
145 size_t* desired_promo_size_ptr, 150 size_t* desired_promo_size_ptr,
146 size_t* desired_eden_size_ptr); 151 size_t* desired_eden_size_ptr);
147 // Change the generation sizes to achieve an application throughput goal 152 // Change the generation sizes to achieve an application throughput goal
148 // Returned sizes are not necessarily aligned. 153 // Returned sizes are not necessarily aligned.
149 void adjust_for_throughput(bool is_full_gc, 154 void adjust_promo_for_throughput(bool is_full_gc,
150 size_t* desired_promo_size_ptr, 155 size_t* desired_promo_size_ptr);
156 void adjust_eden_for_throughput(bool is_full_gc,
151 size_t* desired_eden_size_ptr); 157 size_t* desired_eden_size_ptr);
152 // Change the generation sizes to achieve minimum footprint 158 // Change the generation sizes to achieve minimum footprint
153 // Returned sizes are not aligned. 159 // Returned sizes are not aligned.
154 size_t adjust_promo_for_footprint(size_t desired_promo_size, 160 size_t adjust_promo_for_footprint(size_t desired_promo_size,
155 size_t desired_total); 161 size_t desired_total);
165 // Size in bytes for an increment or decrement of the promotion area 171 // Size in bytes for an increment or decrement of the promotion area
166 virtual size_t promo_increment(size_t cur_promo, uint percent_change); 172 virtual size_t promo_increment(size_t cur_promo, uint percent_change);
167 virtual size_t promo_decrement(size_t cur_promo); 173 virtual size_t promo_decrement(size_t cur_promo);
168 size_t promo_decrement_aligned_down(size_t cur_promo); 174 size_t promo_decrement_aligned_down(size_t cur_promo);
169 size_t promo_increment_with_supplement_aligned_up(size_t cur_promo); 175 size_t promo_increment_with_supplement_aligned_up(size_t cur_promo);
170
171 // Decay the supplemental growth additive.
172 void decay_supplemental_growth(bool is_full_gc);
173 176
174 // Returns a change that has been scaled down. Result 177 // Returns a change that has been scaled down. Result
175 // is not aligned. (If useful, move to some shared 178 // is not aligned. (If useful, move to some shared
176 // location.) 179 // location.)
177 size_t scale_down(size_t change, double part, double total); 180 size_t scale_down(size_t change, double part, double total);
334 337
335 // Given the amount of live data in the heap, should we 338 // Given the amount of live data in the heap, should we
336 // perform a Full GC? 339 // perform a Full GC?
337 bool should_full_GC(size_t live_in_old_gen); 340 bool should_full_GC(size_t live_in_old_gen);
338 341
339 // Calculates optimial free space sizes for both the old and young 342 // Calculates optimal (free) space sizes for both the young and old
340 // generations. Stores results in _eden_size and _promo_size. 343 // generations. Stores results in _eden_size and _promo_size.
341 // Takes current used space in all generations as input, as well 344 // Takes current used space in all generations as input, as well
342 // as an indication if a full gc has just been performed, for use 345 // as an indication if a full gc has just been performed, for use
343 // in deciding if an OOM error should be thrown. 346 // in deciding if an OOM error should be thrown.
344 void compute_generation_free_space(size_t young_live, 347 void compute_generation_free_space(size_t young_live,
345 size_t eden_live, 348 size_t eden_live,
346 size_t old_live, 349 size_t old_live,
347 size_t cur_eden, // current eden in bytes 350 size_t cur_eden, // current eden in bytes
348 size_t max_old_gen_size, 351 size_t max_old_gen_size,
349 size_t max_eden_size, 352 size_t max_eden_size,
350 bool is_full_gc, 353 bool is_full_gc);
351 GCCause::Cause gc_cause, 354
352 CollectorPolicy* collector_policy); 355 void compute_eden_space_size(size_t young_live,
356 size_t eden_live,
357 size_t cur_eden, // current eden in bytes
358 size_t max_eden_size,
359 bool is_full_gc);
360
361 void compute_old_gen_free_space(size_t old_live,
362 size_t cur_eden, // current eden in bytes
363 size_t max_old_gen_size,
364 bool is_full_gc);
353 365
354 // Calculates new survivor space size; returns a new tenuring threshold 366 // Calculates new survivor space size; returns a new tenuring threshold
355 // value. Stores new survivor size in _survivor_size. 367 // value. Stores new survivor size in _survivor_size.
356 uint compute_survivor_space_size_and_threshold(bool is_survivor_overflow, 368 uint compute_survivor_space_size_and_threshold(bool is_survivor_overflow,
357 uint tenuring_threshold, 369 uint tenuring_threshold,
388 size_t survived, 400 size_t survived,
389 size_t promoted); 401 size_t promoted);
390 402
391 // Printing support 403 // Printing support
392 virtual bool print_adaptive_size_policy_on(outputStream* st) const; 404 virtual bool print_adaptive_size_policy_on(outputStream* st) const;
405
406 // Decay the supplemental growth additive.
407 void decay_supplemental_growth(bool is_full_gc);
393 }; 408 };
394 409
395 #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSADAPTIVESIZEPOLICY_HPP 410 #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSADAPTIVESIZEPOLICY_HPP