1 /*
2 * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
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 *
242
243 JVMFlag::Error MaxGCPauseMillisConstraintFunc(uintx value, bool verbose) {
244 #if INCLUDE_G1GC
245 JVMFlag::Error status = MaxGCPauseMillisConstraintFuncG1(value, verbose);
246 if (status != JVMFlag::SUCCESS) {
247 return status;
248 }
249 #endif
250
251 return JVMFlag::SUCCESS;
252 }
253
254 JVMFlag::Error GCPauseIntervalMillisConstraintFunc(uintx value, bool verbose) {
255 #if INCLUDE_G1GC
256 JVMFlag::Error status = GCPauseIntervalMillisConstraintFuncG1(value, verbose);
257 if (status != JVMFlag::SUCCESS) {
258 return status;
259 }
260 #endif
261
262 return JVMFlag::SUCCESS;
263 }
264
265 JVMFlag::Error InitialBootClassLoaderMetaspaceSizeConstraintFunc(size_t value, bool verbose) {
266 size_t aligned_max = align_down(max_uintx/2, Metaspace::reserve_alignment_words());
267 if (value > aligned_max) {
268 JVMFlag::printError(verbose,
269 "InitialBootClassLoaderMetaspaceSize (" SIZE_FORMAT ") must be "
270 "less than or equal to aligned maximum value (" SIZE_FORMAT ")\n",
271 value, aligned_max);
272 return JVMFlag::VIOLATES_CONSTRAINT;
273 }
274 return JVMFlag::SUCCESS;
275 }
276
277 // To avoid an overflow by 'align_up(value, alignment)'.
278 static JVMFlag::Error MaxSizeForAlignment(const char* name, size_t value, size_t alignment, bool verbose) {
279 size_t aligned_max = ((max_uintx - alignment) & ~(alignment-1));
280 if (value > aligned_max) {
281 JVMFlag::printError(verbose,
282 "%s (" SIZE_FORMAT ") must be "
283 "less than or equal to aligned maximum value (" SIZE_FORMAT ")\n",
284 name, value, aligned_max);
285 return JVMFlag::VIOLATES_CONSTRAINT;
286 }
287 return JVMFlag::SUCCESS;
288 }
289
290 static JVMFlag::Error MaxSizeForHeapAlignment(const char* name, size_t value, bool verbose) {
291 size_t heap_alignment;
292
293 #if INCLUDE_G1GC
|
1 /*
2 * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
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 *
242
243 JVMFlag::Error MaxGCPauseMillisConstraintFunc(uintx value, bool verbose) {
244 #if INCLUDE_G1GC
245 JVMFlag::Error status = MaxGCPauseMillisConstraintFuncG1(value, verbose);
246 if (status != JVMFlag::SUCCESS) {
247 return status;
248 }
249 #endif
250
251 return JVMFlag::SUCCESS;
252 }
253
254 JVMFlag::Error GCPauseIntervalMillisConstraintFunc(uintx value, bool verbose) {
255 #if INCLUDE_G1GC
256 JVMFlag::Error status = GCPauseIntervalMillisConstraintFuncG1(value, verbose);
257 if (status != JVMFlag::SUCCESS) {
258 return status;
259 }
260 #endif
261
262 return JVMFlag::SUCCESS;
263 }
264
265 // To avoid an overflow by 'align_up(value, alignment)'.
266 static JVMFlag::Error MaxSizeForAlignment(const char* name, size_t value, size_t alignment, bool verbose) {
267 size_t aligned_max = ((max_uintx - alignment) & ~(alignment-1));
268 if (value > aligned_max) {
269 JVMFlag::printError(verbose,
270 "%s (" SIZE_FORMAT ") must be "
271 "less than or equal to aligned maximum value (" SIZE_FORMAT ")\n",
272 name, value, aligned_max);
273 return JVMFlag::VIOLATES_CONSTRAINT;
274 }
275 return JVMFlag::SUCCESS;
276 }
277
278 static JVMFlag::Error MaxSizeForHeapAlignment(const char* name, size_t value, bool verbose) {
279 size_t heap_alignment;
280
281 #if INCLUDE_G1GC
|