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/shared/cardTableRS.hpp"
27 #include "gc/shared/collectedHeap.hpp"
28 #include "gc/shared/gcArguments.hpp"
29 #include "gc/shared/gcConfig.hpp"
30 #include "gc/shared/jvmFlagConstraintsGC.hpp"
31 #include "gc/shared/plab.hpp"
32 #include "gc/shared/threadLocalAllocBuffer.hpp"
33 #include "gc/shared/tlab_globals.hpp"
34 #include "runtime/arguments.hpp"
35 #include "runtime/globals.hpp"
36 #include "runtime/globals_extension.hpp"
37 #include "runtime/thread.inline.hpp"
38 #include "utilities/align.hpp"
39 #include "utilities/macros.hpp"
40 #include "utilities/powerOfTwo.hpp"
41 #if INCLUDE_G1GC
42 #include "gc/g1/jvmFlagConstraintsG1.hpp"
43 #endif
44 #if INCLUDE_PARALLELGC
45 #include "gc/parallel/jvmFlagConstraintsParallel.hpp"
46 #endif
47
48 // Some flags that have default values that indicate that the
49 // JVM should automatically determine an appropriate value
50 // for that flag. In those cases it is only appropriate for the
51 // constraint checking to be done if the user has specified the
52 // value(s) of the flag(s) on the command line. In the constraint
53 // checking functions, FLAG_IS_CMDLINE() is used to check if
383 return JVMFlag::VIOLATES_CONSTRAINT;
384 }
385 }
386 return JVMFlag::SUCCESS;
387 }
388
389 JVMFlag::Error SurvivorRatioConstraintFunc(uintx value, bool verbose) {
390 if (FLAG_IS_CMDLINE(SurvivorRatio) &&
391 (value > (MaxHeapSize / SpaceAlignment))) {
392 JVMFlag::printError(verbose,
393 "SurvivorRatio (" UINTX_FORMAT ") must be "
394 "less than or equal to ergonomic SurvivorRatio maximum (" SIZE_FORMAT ")\n",
395 value,
396 (MaxHeapSize / SpaceAlignment));
397 return JVMFlag::VIOLATES_CONSTRAINT;
398 } else {
399 return JVMFlag::SUCCESS;
400 }
401 }
402
403 JVMFlag::Error MetaspaceSizeConstraintFunc(size_t value, bool verbose) {
404 if (value > MaxMetaspaceSize) {
405 JVMFlag::printError(verbose,
406 "MetaspaceSize (" SIZE_FORMAT ") must be "
407 "less than or equal to MaxMetaspaceSize (" SIZE_FORMAT ")\n",
408 value, MaxMetaspaceSize);
409 return JVMFlag::VIOLATES_CONSTRAINT;
410 } else {
411 return JVMFlag::SUCCESS;
412 }
413 }
414
415 JVMFlag::Error MaxMetaspaceSizeConstraintFunc(size_t value, bool verbose) {
416 if (value < MetaspaceSize) {
417 JVMFlag::printError(verbose,
418 "MaxMetaspaceSize (" SIZE_FORMAT ") must be "
419 "greater than or equal to MetaspaceSize (" SIZE_FORMAT ")\n",
420 value, MaxMetaspaceSize);
421 return JVMFlag::VIOLATES_CONSTRAINT;
422 } else {
|
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/shared/cardTableRS.hpp"
27 #include "gc/shared/collectedHeap.hpp"
28 #include "gc/shared/gcArguments.hpp"
29 #include "gc/shared/gcConfig.hpp"
30 #include "gc/shared/jvmFlagConstraintsGC.hpp"
31 #include "gc/shared/plab.hpp"
32 #include "gc/shared/threadLocalAllocBuffer.hpp"
33 #include "gc/shared/tlab_globals.hpp"
34 #include "memory/metaspace.hpp"
35 #include "runtime/arguments.hpp"
36 #include "runtime/globals.hpp"
37 #include "runtime/globals_extension.hpp"
38 #include "runtime/thread.inline.hpp"
39 #include "utilities/align.hpp"
40 #include "utilities/macros.hpp"
41 #include "utilities/powerOfTwo.hpp"
42 #if INCLUDE_G1GC
43 #include "gc/g1/jvmFlagConstraintsG1.hpp"
44 #endif
45 #if INCLUDE_PARALLELGC
46 #include "gc/parallel/jvmFlagConstraintsParallel.hpp"
47 #endif
48
49 // Some flags that have default values that indicate that the
50 // JVM should automatically determine an appropriate value
51 // for that flag. In those cases it is only appropriate for the
52 // constraint checking to be done if the user has specified the
53 // value(s) of the flag(s) on the command line. In the constraint
54 // checking functions, FLAG_IS_CMDLINE() is used to check if
384 return JVMFlag::VIOLATES_CONSTRAINT;
385 }
386 }
387 return JVMFlag::SUCCESS;
388 }
389
390 JVMFlag::Error SurvivorRatioConstraintFunc(uintx value, bool verbose) {
391 if (FLAG_IS_CMDLINE(SurvivorRatio) &&
392 (value > (MaxHeapSize / SpaceAlignment))) {
393 JVMFlag::printError(verbose,
394 "SurvivorRatio (" UINTX_FORMAT ") must be "
395 "less than or equal to ergonomic SurvivorRatio maximum (" SIZE_FORMAT ")\n",
396 value,
397 (MaxHeapSize / SpaceAlignment));
398 return JVMFlag::VIOLATES_CONSTRAINT;
399 } else {
400 return JVMFlag::SUCCESS;
401 }
402 }
403
404 JVMFlag::Error CompressedClassSpaceSizeConstraintFunc(size_t value, bool verbose) {
405 #ifdef _LP64
406 // There is no minimal value check, although class space will be transparently enlarged
407 // to a multiple of metaspace root chunk size (4m).
408 // The max. value of class space size depends on narrow klass pointer encoding range size
409 // and CDS, see metaspace.cpp.
410 if (value > Metaspace::max_class_space_size()) {
411 JVMFlag::printError(verbose, "CompressedClassSpaceSize " SIZE_FORMAT " too large (max: " SIZE_FORMAT ")\n",
412 value, Metaspace::max_class_space_size());
413 return JVMFlag::VIOLATES_CONSTRAINT;
414 }
415 #endif
416 return JVMFlag::SUCCESS;
417 }
418
419 JVMFlag::Error MetaspaceSizeConstraintFunc(size_t value, bool verbose) {
420 if (value > MaxMetaspaceSize) {
421 JVMFlag::printError(verbose,
422 "MetaspaceSize (" SIZE_FORMAT ") must be "
423 "less than or equal to MaxMetaspaceSize (" SIZE_FORMAT ")\n",
424 value, MaxMetaspaceSize);
425 return JVMFlag::VIOLATES_CONSTRAINT;
426 } else {
427 return JVMFlag::SUCCESS;
428 }
429 }
430
431 JVMFlag::Error MaxMetaspaceSizeConstraintFunc(size_t value, bool verbose) {
432 if (value < MetaspaceSize) {
433 JVMFlag::printError(verbose,
434 "MaxMetaspaceSize (" SIZE_FORMAT ") must be "
435 "greater than or equal to MetaspaceSize (" SIZE_FORMAT ")\n",
436 value, MaxMetaspaceSize);
437 return JVMFlag::VIOLATES_CONSTRAINT;
438 } else {
|