13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #include "precompiled.hpp" 26 #include "gc/g1/g1YoungGenSizer.hpp" 27 #include "gc/g1/heapRegion.hpp" 28 29 G1YoungGenSizer::G1YoungGenSizer() : _sizer_kind(SizerDefaults), _adaptive_size(true), 30 _min_desired_young_length(0), _max_desired_young_length(0) { 31 if (FLAG_IS_CMDLINE(NewRatio)) { 32 if (FLAG_IS_CMDLINE(NewSize) || FLAG_IS_CMDLINE(MaxNewSize)) { 33 warning("-XX:NewSize and -XX:MaxNewSize override -XX:NewRatio"); 34 } else { 35 _sizer_kind = SizerNewRatio; 36 _adaptive_size = false; 37 return; 38 } 39 } 40 41 if (NewSize > MaxNewSize) { 42 if (FLAG_IS_CMDLINE(MaxNewSize)) { 43 warning("NewSize (" SIZE_FORMAT "k) is greater than the MaxNewSize (" SIZE_FORMAT "k). " 44 "A new max generation size of " SIZE_FORMAT "k will be used.", 45 NewSize/K, MaxNewSize/K, NewSize/K); 46 } 47 MaxNewSize = NewSize; 48 } 49 50 if (FLAG_IS_CMDLINE(NewSize)) { 51 _min_desired_young_length = MAX2((uint) (NewSize / HeapRegion::GrainBytes), 52 1U); 53 if (FLAG_IS_CMDLINE(MaxNewSize)) { 54 _max_desired_young_length = 55 MAX2((uint) (MaxNewSize / HeapRegion::GrainBytes), 56 1U); 57 _sizer_kind = SizerMaxAndNewSize; 58 _adaptive_size = _min_desired_young_length == _max_desired_young_length; 59 } else { 60 _sizer_kind = SizerNewSizeOnly; 61 } 62 } else if (FLAG_IS_CMDLINE(MaxNewSize)) { 63 _max_desired_young_length = | 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #include "precompiled.hpp" 26 #include "gc/g1/g1YoungGenSizer.hpp" 27 #include "gc/g1/heapRegion.hpp" 28 29 G1YoungGenSizer::G1YoungGenSizer() : _sizer_kind(SizerDefaults), _adaptive_size(true), 30 _min_desired_young_length(0), _max_desired_young_length(0) { 31 if (FLAG_IS_CMDLINE(NewRatio)) { 32 if (FLAG_IS_CMDLINE(NewSize) || FLAG_IS_CMDLINE(MaxNewSize)) { 33 log_warning(gc, ergo)("-XX:NewSize and -XX:MaxNewSize override -XX:NewRatio"); 34 } else { 35 _sizer_kind = SizerNewRatio; 36 _adaptive_size = false; 37 return; 38 } 39 } 40 41 if (NewSize > MaxNewSize) { 42 if (FLAG_IS_CMDLINE(MaxNewSize)) { 43 log_warning(gc, ergo)("NewSize (" SIZE_FORMAT "k) is greater than the MaxNewSize (" SIZE_FORMAT "k). " 44 "A new max generation size of " SIZE_FORMAT "k will be used.", 45 NewSize/K, MaxNewSize/K, NewSize/K); 46 } 47 MaxNewSize = NewSize; 48 } 49 50 if (FLAG_IS_CMDLINE(NewSize)) { 51 _min_desired_young_length = MAX2((uint) (NewSize / HeapRegion::GrainBytes), 52 1U); 53 if (FLAG_IS_CMDLINE(MaxNewSize)) { 54 _max_desired_young_length = 55 MAX2((uint) (MaxNewSize / HeapRegion::GrainBytes), 56 1U); 57 _sizer_kind = SizerMaxAndNewSize; 58 _adaptive_size = _min_desired_young_length == _max_desired_young_length; 59 } else { 60 _sizer_kind = SizerNewSizeOnly; 61 } 62 } else if (FLAG_IS_CMDLINE(MaxNewSize)) { 63 _max_desired_young_length = |