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/collectedHeap.hpp"
27 #include "gc/shared/collectorPolicy.hpp"
28 #include "gc/shared/genCollectedHeap.hpp"
29 #include "gc/shared/threadLocalAllocBuffer.hpp"
30 #include "runtime/arguments.hpp"
31 #include "runtime/commandLineFlagConstraintsGC.hpp"
32 #include "runtime/commandLineFlagRangeList.hpp"
33 #include "runtime/globals.hpp"
34 #include "runtime/globals_extension.hpp"
35 #include "runtime/thread.inline.hpp"
36 #include "utilities/defaultStream.hpp"
37
38 #if INCLUDE_ALL_GCS
39 #include "gc/g1/g1_globals.hpp"
40 #include "gc/g1/heapRegionBounds.inline.hpp"
41 #include "gc/shared/plab.hpp"
42 #endif // INCLUDE_ALL_GCS
43 #ifdef COMPILER1
44 #include "c1/c1_globals.hpp"
45 #endif // COMPILER1
46 #ifdef COMPILER2
47 #include "opto/c2_globals.hpp"
48 #endif // COMPILER2
49
50 // Some flags that have default values that indicate that the
51 // JVM should automatically determine an appropriate value
52 // for that flag. In those cases it is only appropriate for the
53 // constraint checking to be done if the user has specified the
54 // value(s) of the flag(s) on the command line. In the constraint
55 // checking functions, FLAG_IS_CMDLINE() is used to check if
56 // the flag has been set by the user and so should be checked.
57
58 #if INCLUDE_ALL_GCS
452 Flag::Error CMSSamplingGrainConstraintFunc(uintx value, bool verbose) {
453 #if INCLUDE_ALL_GCS
454 if (UseConcMarkSweepGC) {
455 size_t max_capacity = GenCollectedHeap::heap()->young_gen()->max_capacity();
456 if (value > max_uintx - max_capacity) {
457 CommandLineError::print(verbose,
458 "CMSSamplingGrain (" UINTX_FORMAT ") must be "
459 "less than or equal to ergonomic maximum (" SIZE_FORMAT ")\n",
460 value, max_uintx - max_capacity);
461 return Flag::VIOLATES_CONSTRAINT;
462 }
463 }
464 #endif
465 return Flag::SUCCESS;
466 }
467
468 Flag::Error CMSWorkQueueDrainThresholdConstraintFunc(uintx value, bool verbose) {
469 #if INCLUDE_ALL_GCS
470 if (UseConcMarkSweepGC) {
471 return ParallelGCThreadsAndCMSWorkQueueDrainThreshold(ParallelGCThreads, value, verbose);
472 }
473 #endif
474 return Flag::SUCCESS;
475 }
476
477 Flag::Error MaxGCPauseMillisConstraintFunc(uintx value, bool verbose) {
478 #if INCLUDE_ALL_GCS
479 if (UseG1GC && FLAG_IS_CMDLINE(MaxGCPauseMillis) && (value >= GCPauseIntervalMillis)) {
480 CommandLineError::print(verbose,
481 "MaxGCPauseMillis (" UINTX_FORMAT ") must be "
482 "less than GCPauseIntervalMillis (" UINTX_FORMAT ")\n",
483 value, GCPauseIntervalMillis);
484 return Flag::VIOLATES_CONSTRAINT;
485 }
486 #endif
487
488 return Flag::SUCCESS;
489 }
490
491 Flag::Error GCPauseIntervalMillisConstraintFunc(uintx value, bool verbose) {
|
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/collectedHeap.hpp"
27 #include "gc/shared/collectorPolicy.hpp"
28 #include "gc/shared/genCollectedHeap.hpp"
29 #include "gc/shared/threadLocalAllocBuffer.hpp"
30 #include "runtime/arguments.hpp"
31 #include "runtime/commandLineFlagConstraintsGC.hpp"
32 #include "runtime/commandLineFlagRangeList.hpp"
33 #include "runtime/globals.hpp"
34 #include "runtime/globals_extension.hpp"
35 #include "runtime/thread.inline.hpp"
36 #include "utilities/defaultStream.hpp"
37
38 #if INCLUDE_ALL_GCS
39 #include "gc/cms/concurrentMarkSweepGeneration.inline.hpp"
40 #include "gc/g1/g1_globals.hpp"
41 #include "gc/g1/heapRegionBounds.inline.hpp"
42 #include "gc/shared/plab.hpp"
43 #endif // INCLUDE_ALL_GCS
44 #ifdef COMPILER1
45 #include "c1/c1_globals.hpp"
46 #endif // COMPILER1
47 #ifdef COMPILER2
48 #include "opto/c2_globals.hpp"
49 #endif // COMPILER2
50
51 // Some flags that have default values that indicate that the
52 // JVM should automatically determine an appropriate value
53 // for that flag. In those cases it is only appropriate for the
54 // constraint checking to be done if the user has specified the
55 // value(s) of the flag(s) on the command line. In the constraint
56 // checking functions, FLAG_IS_CMDLINE() is used to check if
57 // the flag has been set by the user and so should be checked.
58
59 #if INCLUDE_ALL_GCS
453 Flag::Error CMSSamplingGrainConstraintFunc(uintx value, bool verbose) {
454 #if INCLUDE_ALL_GCS
455 if (UseConcMarkSweepGC) {
456 size_t max_capacity = GenCollectedHeap::heap()->young_gen()->max_capacity();
457 if (value > max_uintx - max_capacity) {
458 CommandLineError::print(verbose,
459 "CMSSamplingGrain (" UINTX_FORMAT ") must be "
460 "less than or equal to ergonomic maximum (" SIZE_FORMAT ")\n",
461 value, max_uintx - max_capacity);
462 return Flag::VIOLATES_CONSTRAINT;
463 }
464 }
465 #endif
466 return Flag::SUCCESS;
467 }
468
469 Flag::Error CMSWorkQueueDrainThresholdConstraintFunc(uintx value, bool verbose) {
470 #if INCLUDE_ALL_GCS
471 if (UseConcMarkSweepGC) {
472 return ParallelGCThreadsAndCMSWorkQueueDrainThreshold(ParallelGCThreads, value, verbose);
473 }
474 #endif
475 return Flag::SUCCESS;
476 }
477
478 Flag::Error CMSBitMapYieldQuantumConstraintFunc(size_t value, bool verbose) {
479 #if INCLUDE_ALL_GCS
480 // Skip for current default value.
481 if (UseConcMarkSweepGC && FLAG_IS_CMDLINE(CMSBitMapYieldQuantum)) {
482 // CMSBitMapYieldQuantum should be compared with mark bitmap size.
483 ConcurrentMarkSweepGeneration* cms = (ConcurrentMarkSweepGeneration*)GenCollectedHeap::heap()->old_gen();
484 size_t bitmap_size = cms->collector()->markBitMap()->sizeInWords();
485
486 if (value > bitmap_size) {
487 CommandLineError::print(verbose,
488 "CMSBitMapYieldQuantum (" SIZE_FORMAT ") must "
489 "be less than or equal to bitmap size (" SIZE_FORMAT ")\n",
490 value, bitmap_size);
491 return Flag::VIOLATES_CONSTRAINT;
492 }
493 }
494 #endif
495 return Flag::SUCCESS;
496 }
497
498 Flag::Error MaxGCPauseMillisConstraintFunc(uintx value, bool verbose) {
499 #if INCLUDE_ALL_GCS
500 if (UseG1GC && FLAG_IS_CMDLINE(MaxGCPauseMillis) && (value >= GCPauseIntervalMillis)) {
501 CommandLineError::print(verbose,
502 "MaxGCPauseMillis (" UINTX_FORMAT ") must be "
503 "less than GCPauseIntervalMillis (" UINTX_FORMAT ")\n",
504 value, GCPauseIntervalMillis);
505 return Flag::VIOLATES_CONSTRAINT;
506 }
507 #endif
508
509 return Flag::SUCCESS;
510 }
511
512 Flag::Error GCPauseIntervalMillisConstraintFunc(uintx value, bool verbose) {
|