1 /*
2 * Copyright (c) 2015, 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 *
23 */
24
25 #include "precompiled.hpp"
26 #include "gc/shared/collectedHeap.hpp"
27 #include "gc/shared/collectorPolicy.hpp"
28 #include "gc/shared/threadLocalAllocBuffer.hpp"
29 #include "runtime/arguments.hpp"
30 #include "runtime/commandLineFlagConstraintsGC.hpp"
31 #include "runtime/commandLineFlagRangeList.hpp"
32 #include "runtime/globals.hpp"
33 #include "runtime/globals_extension.hpp"
34 #include "runtime/thread.inline.hpp"
35 #include "utilities/defaultStream.hpp"
36
37 #if INCLUDE_ALL_GCS
38 #include "gc/g1/g1_globals.hpp"
39 #include "gc/g1/heapRegionBounds.inline.hpp"
40 #include "gc/shared/plab.hpp"
41 #endif // INCLUDE_ALL_GCS
42 #ifdef COMPILER1
43 #include "c1/c1_globals.hpp"
44 #endif // COMPILER1
45 #ifdef COMPILER2
46 #include "opto/c2_globals.hpp"
47 #endif // COMPILER2
426 #if INCLUDE_ALL_GCS
427 if (UseConcMarkSweepGC && (value <= CMSPrecleanNumerator)) {
428 CommandLineError::print(verbose,
429 "CMSPrecleanDenominator (" UINTX_FORMAT ") must be "
430 "strickly greater than CMSPrecleanNumerator (" UINTX_FORMAT ")\n",
431 value, CMSPrecleanNumerator);
432 return Flag::VIOLATES_CONSTRAINT;
433 }
434 #endif
435 return Flag::SUCCESS;
436 }
437
438 Flag::Error CMSPrecleanNumeratorConstraintFunc(uintx value, bool verbose) {
439 #if INCLUDE_ALL_GCS
440 if (UseConcMarkSweepGC && (value >= CMSPrecleanDenominator)) {
441 CommandLineError::print(verbose,
442 "CMSPrecleanNumerator (" UINTX_FORMAT ") must be "
443 "less than CMSPrecleanDenominator (" UINTX_FORMAT ")\n",
444 value, CMSPrecleanDenominator);
445 return Flag::VIOLATES_CONSTRAINT;
446 }
447 #endif
448 return Flag::SUCCESS;
449 }
450
451 Flag::Error CMSWorkQueueDrainThresholdConstraintFunc(uintx value, bool verbose) {
452 #if INCLUDE_ALL_GCS
453 if (UseConcMarkSweepGC) {
454 return ParallelGCThreadsAndCMSWorkQueueDrainThreshold(ParallelGCThreads, value, verbose);
455 }
456 #endif
457 return Flag::SUCCESS;
458 }
459
460 Flag::Error MaxGCPauseMillisConstraintFunc(uintx value, bool verbose) {
461 #if INCLUDE_ALL_GCS
462 if (UseG1GC && FLAG_IS_CMDLINE(MaxGCPauseMillis) && (value >= GCPauseIntervalMillis)) {
463 CommandLineError::print(verbose,
464 "MaxGCPauseMillis (" UINTX_FORMAT ") must be "
465 "less than GCPauseIntervalMillis (" UINTX_FORMAT ")\n",
|
1 /*
2 * Copyright (c) 2015, 2016, 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 *
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
427 #if INCLUDE_ALL_GCS
428 if (UseConcMarkSweepGC && (value <= CMSPrecleanNumerator)) {
429 CommandLineError::print(verbose,
430 "CMSPrecleanDenominator (" UINTX_FORMAT ") must be "
431 "strickly greater than CMSPrecleanNumerator (" UINTX_FORMAT ")\n",
432 value, CMSPrecleanNumerator);
433 return Flag::VIOLATES_CONSTRAINT;
434 }
435 #endif
436 return Flag::SUCCESS;
437 }
438
439 Flag::Error CMSPrecleanNumeratorConstraintFunc(uintx value, bool verbose) {
440 #if INCLUDE_ALL_GCS
441 if (UseConcMarkSweepGC && (value >= CMSPrecleanDenominator)) {
442 CommandLineError::print(verbose,
443 "CMSPrecleanNumerator (" UINTX_FORMAT ") must be "
444 "less than CMSPrecleanDenominator (" UINTX_FORMAT ")\n",
445 value, CMSPrecleanDenominator);
446 return Flag::VIOLATES_CONSTRAINT;
447 }
448 #endif
449 return Flag::SUCCESS;
450 }
451
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",
|