hotspot/src/share/vm/runtime/commandLineFlagConstraintsGC.cpp
author sangheki
Fri, 04 Dec 2015 15:24:14 -0800
changeset 34661 9a1d11d88ea0
parent 33144 c56850e328fc
child 35203 3e70c7dc0772
permissions -rw-r--r--
8142341: GC: current flags need ranges to be implemented Summary: Add explicit ranges and constraint for all gc flags Reviewed-by: jwilhelm, gziemski, ddmitriev, tbenson
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
     1
/*
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
     2
 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
     4
 *
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
     7
 * published by the Free Software Foundation.
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
     8
 *
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    13
 * accompanied this code).
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    14
 *
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    18
 *
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    21
 * questions.
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    22
 *
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    23
 */
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    24
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    25
#include "precompiled.hpp"
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    26
#include "gc/shared/collectedHeap.hpp"
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    27
#include "gc/shared/collectorPolicy.hpp"
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    28
#include "gc/shared/threadLocalAllocBuffer.hpp"
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    29
#include "runtime/arguments.hpp"
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    30
#include "runtime/commandLineFlagConstraintsGC.hpp"
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
    31
#include "runtime/commandLineFlagRangeList.hpp"
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    32
#include "runtime/globals.hpp"
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    33
#include "runtime/globals_extension.hpp"
34661
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
    34
#include "runtime/thread.inline.hpp"
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    35
#include "utilities/defaultStream.hpp"
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    36
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    37
#if INCLUDE_ALL_GCS
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    38
#include "gc/g1/g1_globals.hpp"
31995
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
    39
#include "gc/g1/heapRegionBounds.inline.hpp"
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
    40
#include "gc/shared/plab.hpp"
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    41
#endif // INCLUDE_ALL_GCS
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    42
#ifdef COMPILER1
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    43
#include "c1/c1_globals.hpp"
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    44
#endif // COMPILER1
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    45
#ifdef COMPILER2
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    46
#include "opto/c2_globals.hpp"
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    47
#endif // COMPILER2
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    48
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    49
// Some flags that have default values that indicate that the
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    50
// JVM should automatically determine an appropriate value
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    51
// for that flag.  In those cases it is only appropriate for the
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    52
// constraint checking to be done if the user has specified the
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    53
// value(s) of the flag(s) on the command line.  In the constraint
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    54
// checking functions,  FLAG_IS_CMDLINE() is used to check if
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    55
// the flag has been set by the user and so should be checked.
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    56
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    57
#if INCLUDE_ALL_GCS
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    58
static Flag::Error ParallelGCThreadsAndCMSWorkQueueDrainThreshold(uint threads, uintx threshold, bool verbose) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    59
  // CMSWorkQueueDrainThreshold is verified to be less than max_juint
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    60
  if (UseConcMarkSweepGC && (threads > (uint)(max_jint / (uint)threshold))) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    61
    CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    62
                            "ParallelGCThreads (" UINT32_FORMAT ") or CMSWorkQueueDrainThreshold ("
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    63
                            UINTX_FORMAT ") is too large\n",
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    64
                            threads, threshold);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    65
    return Flag::VIOLATES_CONSTRAINT;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    66
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    67
  return Flag::SUCCESS;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    68
}
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    69
#endif
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    70
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    71
// As ParallelGCThreads differs among GC modes, we need constraint function.
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    72
Flag::Error ParallelGCThreadsConstraintFunc(uint value, bool verbose) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    73
  Flag::Error status = Flag::SUCCESS;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    74
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    75
#if INCLUDE_ALL_GCS
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    76
  // Parallel GC passes ParallelGCThreads when creating GrowableArray as 'int' type parameter.
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    77
  // So can't exceed with "max_jint"
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    78
  if (UseParallelGC && (value > (uint)max_jint)) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    79
    CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    80
                            "ParallelGCThreads (" UINT32_FORMAT ") must be "
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    81
                            "less than or equal to " UINT32_FORMAT " for Parallel GC\n",
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    82
                            value, max_jint);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    83
    return Flag::VIOLATES_CONSTRAINT;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    84
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    85
  // To avoid overflow at ParScanClosure::do_oop_work.
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    86
  if (UseConcMarkSweepGC && (value > (max_jint / 10))) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    87
    CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    88
                            "ParallelGCThreads (" UINT32_FORMAT ") must be "
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    89
                            "less than or equal to " UINT32_FORMAT " for CMS GC\n",
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    90
                            value, (max_jint / 10));
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    91
    return Flag::VIOLATES_CONSTRAINT;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    92
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    93
  status = ParallelGCThreadsAndCMSWorkQueueDrainThreshold(value, CMSWorkQueueDrainThreshold, verbose);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    94
#endif
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    95
  return status;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    96
}
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    97
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    98
// As ConcGCThreads should be smaller than ParallelGCThreads,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    99
// we need constraint function.
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   100
Flag::Error ConcGCThreadsConstraintFunc(uint value, bool verbose) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   101
#if INCLUDE_ALL_GCS
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   102
  // CMS and G1 GCs use ConcGCThreads.
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   103
  if ((UseConcMarkSweepGC || UseG1GC) && (value > ParallelGCThreads)) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   104
    CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   105
                            "ConcGCThreads (" UINT32_FORMAT ") must be "
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   106
                            "less than or equal to ParallelGCThreads (" UINT32_FORMAT ")\n",
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   107
                            value, ParallelGCThreads);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   108
    return Flag::VIOLATES_CONSTRAINT;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   109
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   110
#endif
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   111
  return Flag::SUCCESS;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   112
}
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   113
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   114
static Flag::Error MinPLABSizeBounds(const char* name, size_t value, bool verbose) {
31995
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
   115
#if INCLUDE_ALL_GCS
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   116
  if ((UseConcMarkSweepGC || UseG1GC) && (value < PLAB::min_size())) {
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   117
    CommandLineError::print(verbose,
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   118
                            "%s (" SIZE_FORMAT ") must be "
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   119
                            "greater than or equal to ergonomic PLAB minimum size (" SIZE_FORMAT ")\n",
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   120
                            name, value, PLAB::min_size());
31995
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
   121
    return Flag::VIOLATES_CONSTRAINT;
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
   122
  }
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
   123
#endif // INCLUDE_ALL_GCS
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
   124
  return Flag::SUCCESS;
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
   125
}
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
   126
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   127
static Flag::Error MaxPLABSizeBounds(const char* name, size_t value, bool verbose) {
31995
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
   128
#if INCLUDE_ALL_GCS
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   129
  if ((UseConcMarkSweepGC || UseG1GC) && (value > PLAB::max_size())) {
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   130
    CommandLineError::print(verbose,
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   131
                            "%s (" SIZE_FORMAT ") must be "
32601
c5df671276bd 8078555: GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32351
diff changeset
   132
                            "less than or equal to ergonomic PLAB maximum size (" SIZE_FORMAT ")\n",
32610
bf513f9f3fb9 8134856: Incorrect use of PLAB::min_size() in MaxPLABSizeBounds
tschatzl
parents: 32601
diff changeset
   133
                            name, value, PLAB::max_size());
31995
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
   134
    return Flag::VIOLATES_CONSTRAINT;
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
   135
  }
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
   136
#endif // INCLUDE_ALL_GCS
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
   137
  return Flag::SUCCESS;
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
   138
}
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
   139
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   140
static Flag::Error MinMaxPLABSizeBounds(const char* name, size_t value, bool verbose) {
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   141
  Flag::Error status = MinPLABSizeBounds(name, value, verbose);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   142
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   143
  if (status == Flag::SUCCESS) {
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   144
    return MaxPLABSizeBounds(name, value, verbose);
31995
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
   145
  }
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   146
  return status;
31995
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
   147
}
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
   148
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   149
Flag::Error YoungPLABSizeConstraintFunc(size_t value, bool verbose) {
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   150
  return MinMaxPLABSizeBounds("YoungPLABSize", value, verbose);
31995
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
   151
}
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
   152
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   153
Flag::Error OldPLABSizeConstraintFunc(size_t value, bool verbose) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   154
  Flag::Error status = Flag::SUCCESS;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   155
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   156
#if INCLUDE_ALL_GCS
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   157
  if (UseConcMarkSweepGC) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   158
    if (value == 0) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   159
      CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   160
                              "OldPLABSize (" SIZE_FORMAT ") must be greater than 0",
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   161
                              value);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   162
      return Flag::VIOLATES_CONSTRAINT;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   163
    }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   164
    // For CMS, OldPLABSize is the number of free blocks of a given size that are used when
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   165
    // replenishing the local per-worker free list caches.
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   166
    // For more details, please refer to Arguments::set_cms_and_parnew_gc_flags().
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   167
    status = MaxPLABSizeBounds("OldPLABSize", value, verbose);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   168
  } else {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   169
    status = MinMaxPLABSizeBounds("OldPLABSize", value, verbose);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   170
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   171
#endif
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   172
  return status;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   173
}
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   174
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   175
Flag::Error MinHeapFreeRatioConstraintFunc(uintx value, bool verbose) {
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   176
  if (value > MaxHeapFreeRatio) {
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   177
    CommandLineError::print(verbose,
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   178
                            "MinHeapFreeRatio (" UINTX_FORMAT ") must be "
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   179
                            "less than or equal to MaxHeapFreeRatio (" UINTX_FORMAT ")\n",
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   180
                            value, MaxHeapFreeRatio);
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   181
    return Flag::VIOLATES_CONSTRAINT;
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   182
  } else {
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   183
    return Flag::SUCCESS;
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   184
  }
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   185
}
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   186
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   187
Flag::Error MaxHeapFreeRatioConstraintFunc(uintx value, bool verbose) {
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   188
  if (value < MinHeapFreeRatio) {
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   189
    CommandLineError::print(verbose,
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   190
                            "MaxHeapFreeRatio (" UINTX_FORMAT ") must be "
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   191
                            "greater than or equal to MinHeapFreeRatio (" UINTX_FORMAT ")\n",
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   192
                            value, MinHeapFreeRatio);
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   193
    return Flag::VIOLATES_CONSTRAINT;
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   194
  } else {
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   195
    return Flag::SUCCESS;
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   196
  }
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   197
}
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   198
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   199
static Flag::Error CheckMaxHeapSizeAndSoftRefLRUPolicyMSPerMB(size_t maxHeap, intx softRef, bool verbose) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   200
  if ((softRef > 0) && ((maxHeap / M) > (max_uintx / softRef))) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   201
    CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   202
                            "Desired lifetime of SoftReferences cannot be expressed correctly. "
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   203
                            "MaxHeapSize (" SIZE_FORMAT ") or SoftRefLRUPolicyMSPerMB "
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   204
                            "(" INTX_FORMAT ") is too large\n",
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   205
                            maxHeap, softRef);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   206
    return Flag::VIOLATES_CONSTRAINT;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   207
  } else {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   208
    return Flag::SUCCESS;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   209
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   210
}
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   211
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   212
Flag::Error SoftRefLRUPolicyMSPerMBConstraintFunc(intx value, bool verbose) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   213
  return CheckMaxHeapSizeAndSoftRefLRUPolicyMSPerMB(MaxHeapSize, value, verbose);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   214
}
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   215
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   216
Flag::Error MinMetaspaceFreeRatioConstraintFunc(uintx value, bool verbose) {
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   217
  if (value > MaxMetaspaceFreeRatio) {
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   218
    CommandLineError::print(verbose,
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   219
                            "MinMetaspaceFreeRatio (" UINTX_FORMAT ") must be "
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   220
                            "less than or equal to MaxMetaspaceFreeRatio (" UINTX_FORMAT ")\n",
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   221
                            value, MaxMetaspaceFreeRatio);
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   222
    return Flag::VIOLATES_CONSTRAINT;
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   223
  } else {
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   224
    return Flag::SUCCESS;
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   225
  }
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   226
}
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   227
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   228
Flag::Error MaxMetaspaceFreeRatioConstraintFunc(uintx value, bool verbose) {
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   229
  if (value < MinMetaspaceFreeRatio) {
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   230
    CommandLineError::print(verbose,
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   231
                            "MaxMetaspaceFreeRatio (" UINTX_FORMAT ") must be "
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   232
                            "greater than or equal to MinMetaspaceFreeRatio (" UINTX_FORMAT ")\n",
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   233
                            value, MinMetaspaceFreeRatio);
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   234
    return Flag::VIOLATES_CONSTRAINT;
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   235
  } else {
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   236
    return Flag::SUCCESS;
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   237
  }
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   238
}
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   239
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   240
Flag::Error InitialTenuringThresholdConstraintFunc(uintx value, bool verbose) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   241
#if INCLUDE_ALL_GCS
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   242
  // InitialTenuringThreshold is only used for ParallelGC.
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   243
  if (UseParallelGC && (value > MaxTenuringThreshold)) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   244
      CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   245
                              "InitialTenuringThreshold (" UINTX_FORMAT ") must be "
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   246
                              "less than or equal to MaxTenuringThreshold (" UINTX_FORMAT ")\n",
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   247
                              value, MaxTenuringThreshold);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   248
      return Flag::VIOLATES_CONSTRAINT;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   249
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   250
#endif
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   251
  return Flag::SUCCESS;
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   252
}
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   253
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   254
Flag::Error MaxTenuringThresholdConstraintFunc(uintx value, bool verbose) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   255
#if INCLUDE_ALL_GCS
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   256
  // As only ParallelGC uses InitialTenuringThreshold,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   257
  // we don't need to compare InitialTenuringThreshold with MaxTenuringThreshold.
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   258
  if (UseParallelGC && (value < InitialTenuringThreshold)) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   259
    CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   260
                            "MaxTenuringThreshold (" UINTX_FORMAT ") must be "
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   261
                            "greater than or equal to InitialTenuringThreshold (" UINTX_FORMAT ")\n",
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   262
                            value, InitialTenuringThreshold);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   263
    return Flag::VIOLATES_CONSTRAINT;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   264
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   265
#endif
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   266
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   267
  // MaxTenuringThreshold=0 means NeverTenure=false && AlwaysTenure=true
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   268
  if ((value == 0) && (NeverTenure || !AlwaysTenure)) {
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   269
    CommandLineError::print(verbose,
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   270
                            "MaxTenuringThreshold (0) should match to NeverTenure=false "
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   271
                            "&& AlwaysTenure=true. But we have NeverTenure=%s "
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   272
                            "AlwaysTenure=%s\n",
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   273
                            NeverTenure ? "true" : "false",
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   274
                            AlwaysTenure ? "true" : "false");
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   275
    return Flag::VIOLATES_CONSTRAINT;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   276
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   277
  return Flag::SUCCESS;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   278
}
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   279
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   280
#if INCLUDE_ALL_GCS
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   281
Flag::Error G1RSetRegionEntriesConstraintFunc(intx value, bool verbose) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   282
  if (!UseG1GC) return Flag::SUCCESS;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   283
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   284
  // Default value of G1RSetRegionEntries=0 means will be set ergonomically.
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   285
  // Minimum value is 1.
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   286
  if (FLAG_IS_CMDLINE(G1RSetRegionEntries) && (value < 1)) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   287
    CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   288
                            "G1RSetRegionEntries (" INTX_FORMAT ") must be "
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   289
                            "greater than or equal to 1\n",
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   290
                            value);
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   291
    return Flag::VIOLATES_CONSTRAINT;
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   292
  } else {
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   293
    return Flag::SUCCESS;
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   294
  }
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   295
}
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   296
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   297
Flag::Error G1RSetSparseRegionEntriesConstraintFunc(intx value, bool verbose) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   298
  if (!UseG1GC) return Flag::SUCCESS;
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   299
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   300
  // Default value of G1RSetSparseRegionEntries=0 means will be set ergonomically.
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   301
  // Minimum value is 1.
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   302
  if (FLAG_IS_CMDLINE(G1RSetSparseRegionEntries) && (value < 1)) {
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   303
    CommandLineError::print(verbose,
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   304
                            "G1RSetSparseRegionEntries (" INTX_FORMAT ") must be "
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   305
                            "greater than or equal to 1\n",
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   306
                            value);
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   307
    return Flag::VIOLATES_CONSTRAINT;
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   308
  } else {
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   309
    return Flag::SUCCESS;
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   310
  }
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   311
}
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   312
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   313
Flag::Error G1YoungSurvRateNumRegionsSummaryConstraintFunc(intx value, bool verbose) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   314
  if (!UseG1GC) return Flag::SUCCESS;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   315
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   316
  if (value > (intx)HeapRegionBounds::target_number()) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   317
    CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   318
                            "G1YoungSurvRateNumRegionsSummary (" INTX_FORMAT ") must be "
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   319
                            "less than or equal to region count (" SIZE_FORMAT ")\n",
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   320
                            value, HeapRegionBounds::target_number());
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   321
    return Flag::VIOLATES_CONSTRAINT;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   322
  } else {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   323
    return Flag::SUCCESS;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   324
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   325
}
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   326
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   327
Flag::Error G1HeapRegionSizeConstraintFunc(size_t value, bool verbose) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   328
  if (!UseG1GC) return Flag::SUCCESS;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   329
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   330
  // Default value of G1HeapRegionSize=0 means will be set ergonomically.
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   331
  if (FLAG_IS_CMDLINE(G1HeapRegionSize) && (value < HeapRegionBounds::min_size())) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   332
    CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   333
                            "G1HeapRegionSize (" SIZE_FORMAT ") must be "
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   334
                            "greater than or equal to ergonomic heap region minimum size\n",
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   335
                            value);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   336
    return Flag::VIOLATES_CONSTRAINT;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   337
  } else {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   338
    return Flag::SUCCESS;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   339
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   340
}
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   341
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   342
Flag::Error G1NewSizePercentConstraintFunc(uintx value, bool verbose) {
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   343
  if (!UseG1GC) return Flag::SUCCESS;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   344
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   345
  if (value > G1MaxNewSizePercent) {
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   346
    CommandLineError::print(verbose,
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   347
                            "G1NewSizePercent (" UINTX_FORMAT ") must be "
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   348
                            "less than or equal to G1MaxNewSizePercent (" UINTX_FORMAT ")\n",
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   349
                            value, G1MaxNewSizePercent);
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   350
    return Flag::VIOLATES_CONSTRAINT;
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   351
  } else {
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   352
    return Flag::SUCCESS;
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   353
  }
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   354
}
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   355
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   356
Flag::Error G1MaxNewSizePercentConstraintFunc(uintx value, bool verbose) {
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   357
  if (!UseG1GC) return Flag::SUCCESS;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   358
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   359
  if (value < G1NewSizePercent) {
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   360
    CommandLineError::print(verbose,
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   361
                            "G1MaxNewSizePercent (" UINTX_FORMAT ") must be "
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   362
                            "greater than or equal to G1NewSizePercent (" UINTX_FORMAT ")\n",
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   363
                            value, G1NewSizePercent);
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   364
    return Flag::VIOLATES_CONSTRAINT;
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   365
  } else {
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   366
    return Flag::SUCCESS;
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   367
  }
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   368
}
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   369
#endif // INCLUDE_ALL_GCS
32613
73bec9f941d7 8134972: [BACKOUT] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32610
diff changeset
   370
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   371
Flag::Error ParGCStridesPerThreadConstraintFunc(uintx value, bool verbose) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   372
#if INCLUDE_ALL_GCS
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   373
  if (UseConcMarkSweepGC && (value > ((uintx)max_jint / (uintx)ParallelGCThreads))) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   374
    CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   375
                            "ParGCStridesPerThread (" UINTX_FORMAT ") must be "
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   376
                            "less than or equal to ergonomic maximum (" UINTX_FORMAT ")\n",
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   377
                            value, ((uintx)max_jint / (uintx)ParallelGCThreads));
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   378
    return Flag::VIOLATES_CONSTRAINT;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   379
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   380
#endif
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   381
  return Flag::SUCCESS;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   382
}
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   383
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   384
Flag::Error CMSOldPLABMinConstraintFunc(size_t value, bool verbose) {
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   385
  Flag::Error status = Flag::SUCCESS;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   386
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   387
#if INCLUDE_ALL_GCS
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   388
  if (UseConcMarkSweepGC) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   389
    if (value > CMSOldPLABMax) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   390
      CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   391
                              "CMSOldPLABMin (" SIZE_FORMAT ") must be "
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   392
                              "less than or equal to CMSOldPLABMax (" SIZE_FORMAT ")\n",
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   393
                              value, CMSOldPLABMax);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   394
      return Flag::VIOLATES_CONSTRAINT;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   395
    }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   396
    status = MaxPLABSizeBounds("CMSOldPLABMin", value, verbose);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   397
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   398
#endif
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   399
  return status;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   400
}
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   401
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   402
Flag::Error CMSOldPLABMaxConstraintFunc(size_t value, bool verbose) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   403
  Flag::Error status = Flag::SUCCESS;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   404
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   405
#if INCLUDE_ALL_GCS
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   406
  if (UseConcMarkSweepGC) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   407
    status = MaxPLABSizeBounds("CMSOldPLABMax", value, verbose);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   408
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   409
#endif
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   410
  return status;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   411
}
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   412
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   413
Flag::Error MarkStackSizeConstraintFunc(size_t value, bool verbose) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   414
  if (value > MarkStackSizeMax) {
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   415
    CommandLineError::print(verbose,
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   416
                            "MarkStackSize (" SIZE_FORMAT ") must be "
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   417
                            "less than or equal to MarkStackSizeMax (" SIZE_FORMAT ")\n",
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   418
                            value, MarkStackSizeMax);
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   419
    return Flag::VIOLATES_CONSTRAINT;
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   420
  } else {
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   421
    return Flag::SUCCESS;
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   422
  }
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   423
}
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   424
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   425
Flag::Error CMSPrecleanDenominatorConstraintFunc(uintx value, bool verbose) {
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   426
#if INCLUDE_ALL_GCS
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   427
  if (UseConcMarkSweepGC && (value <= CMSPrecleanNumerator)) {
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   428
    CommandLineError::print(verbose,
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   429
                            "CMSPrecleanDenominator (" UINTX_FORMAT ") must be "
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   430
                            "strickly greater than CMSPrecleanNumerator (" UINTX_FORMAT ")\n",
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   431
                            value, CMSPrecleanNumerator);
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   432
    return Flag::VIOLATES_CONSTRAINT;
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   433
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   434
#endif
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   435
  return Flag::SUCCESS;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   436
}
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   437
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   438
Flag::Error CMSPrecleanNumeratorConstraintFunc(uintx value, bool verbose) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   439
#if INCLUDE_ALL_GCS
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   440
  if (UseConcMarkSweepGC && (value >= CMSPrecleanDenominator)) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   441
    CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   442
                            "CMSPrecleanNumerator (" UINTX_FORMAT ") must be "
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   443
                            "less than CMSPrecleanDenominator (" UINTX_FORMAT ")\n",
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   444
                            value, CMSPrecleanDenominator);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   445
    return Flag::VIOLATES_CONSTRAINT;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   446
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   447
#endif
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   448
  return Flag::SUCCESS;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   449
}
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   450
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   451
Flag::Error CMSWorkQueueDrainThresholdConstraintFunc(uintx value, bool verbose) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   452
#if INCLUDE_ALL_GCS
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   453
  if (UseConcMarkSweepGC) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   454
    return ParallelGCThreadsAndCMSWorkQueueDrainThreshold(ParallelGCThreads, value, verbose);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   455
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   456
#endif
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   457
  return Flag::SUCCESS;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   458
}
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   459
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   460
Flag::Error MaxGCPauseMillisConstraintFunc(uintx value, bool verbose) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   461
#if INCLUDE_ALL_GCS
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   462
  if (UseG1GC && FLAG_IS_CMDLINE(MaxGCPauseMillis) && (value >= GCPauseIntervalMillis)) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   463
    CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   464
                            "MaxGCPauseMillis (" UINTX_FORMAT ") must be "
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   465
                            "less than GCPauseIntervalMillis (" UINTX_FORMAT ")\n",
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   466
                            value, GCPauseIntervalMillis);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   467
    return Flag::VIOLATES_CONSTRAINT;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   468
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   469
#endif
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   470
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   471
  return Flag::SUCCESS;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   472
}
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   473
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   474
Flag::Error GCPauseIntervalMillisConstraintFunc(uintx value, bool verbose) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   475
#if INCLUDE_ALL_GCS
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   476
  if (UseG1GC) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   477
    if (FLAG_IS_CMDLINE(GCPauseIntervalMillis)) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   478
      if (value < 1) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   479
        CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   480
                                "GCPauseIntervalMillis (" UINTX_FORMAT ") must be "
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   481
                                "greater than or equal to 1\n",
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   482
                                value);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   483
        return Flag::VIOLATES_CONSTRAINT;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   484
      }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   485
      if (value <= MaxGCPauseMillis) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   486
        CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   487
                                "GCPauseIntervalMillis (" UINTX_FORMAT ") must be "
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   488
                                "greater than MaxGCPauseMillis (" UINTX_FORMAT ")\n",
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   489
                                value, MaxGCPauseMillis);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   490
        return Flag::VIOLATES_CONSTRAINT;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   491
      }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   492
    }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   493
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   494
#endif
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   495
  return Flag::SUCCESS;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   496
}
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   497
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   498
Flag::Error InitialBootClassLoaderMetaspaceSizeConstraintFunc(size_t value, bool verbose) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   499
  size_t aligned_max = (size_t)align_size_down(max_uintx/2, Metaspace::reserve_alignment_words());
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   500
  if (value > aligned_max) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   501
    CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   502
                            "InitialBootClassLoaderMetaspaceSize (" SIZE_FORMAT ") must be "
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   503
                            "less than or equal to aligned maximum value (" SIZE_FORMAT ")\n",
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   504
                            value, aligned_max);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   505
    return Flag::VIOLATES_CONSTRAINT;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   506
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   507
  return Flag::SUCCESS;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   508
}
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   509
34661
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   510
// To avoid an overflow by 'align_size_up(value, alignment)'.
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   511
static Flag::Error MaxSizeForAlignment(const char* name, size_t value, size_t alignment, bool verbose) {
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   512
  size_t aligned_max = ((max_uintx - alignment) & ~(alignment-1));
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   513
  if (value > aligned_max) {
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   514
    CommandLineError::print(verbose,
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   515
                            "%s (" SIZE_FORMAT ") must be "
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   516
                            "less than or equal to aligned maximum value (" SIZE_FORMAT ")\n",
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   517
                            name, value, aligned_max);
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   518
    return Flag::VIOLATES_CONSTRAINT;
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   519
  }
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   520
  return Flag::SUCCESS;
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   521
}
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   522
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   523
static Flag::Error MaxSizeForHeapAlignment(const char* name, size_t value, bool verbose) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   524
  // For G1 GC, we don't know until G1CollectorPolicy is created.
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   525
  size_t heap_alignment;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   526
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   527
#if INCLUDE_ALL_GCS
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   528
  if (UseG1GC) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   529
    heap_alignment = HeapRegionBounds::max_size();
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   530
  } else
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   531
#endif
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   532
  {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   533
    heap_alignment = CollectorPolicy::compute_heap_alignment();
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   534
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   535
34661
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   536
  return MaxSizeForAlignment(name, value, heap_alignment, verbose);
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   537
}
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   538
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   539
Flag::Error InitialHeapSizeConstraintFunc(size_t value, bool verbose) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   540
  return MaxSizeForHeapAlignment("InitialHeapSize", value, verbose);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   541
}
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   542
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   543
Flag::Error MaxHeapSizeConstraintFunc(size_t value, bool verbose) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   544
  Flag::Error status = MaxSizeForHeapAlignment("MaxHeapSize", value, verbose);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   545
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   546
  if (status == Flag::SUCCESS) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   547
    status = CheckMaxHeapSizeAndSoftRefLRUPolicyMSPerMB(value, SoftRefLRUPolicyMSPerMB, verbose);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   548
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   549
  return status;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   550
}
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   551
34661
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   552
Flag::Error HeapBaseMinAddressConstraintFunc(size_t value, bool verbose) {
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   553
  // If an overflow happened in Arguments::set_heap_size(), MaxHeapSize will have too large a value.
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   554
  // Check for this by ensuring that MaxHeapSize plus the requested min base address still fit within max_uintx.
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   555
  if (UseCompressedOops && FLAG_IS_ERGO(MaxHeapSize) && (value > (max_uintx - MaxHeapSize))) {
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   556
    CommandLineError::print(verbose,
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   557
                            "HeapBaseMinAddress (" SIZE_FORMAT ") or MaxHeapSize (" SIZE_FORMAT ") is too large. "
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   558
                            "Sum of them must be less than or equal to maximum of size_t (" SIZE_FORMAT ")\n",
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   559
                            value, MaxHeapSize, max_uintx);
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   560
    return Flag::VIOLATES_CONSTRAINT;
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   561
  }
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   562
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   563
  return MaxSizeForHeapAlignment("HeapBaseMinAddress", value, verbose);
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   564
}
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   565
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   566
Flag::Error NUMAInterleaveGranularityConstraintFunc(size_t value, bool verbose) {
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   567
  if (UseNUMA && UseNUMAInterleaving) {
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   568
    size_t min_interleave_granularity = UseLargePages ? os::large_page_size() : os::vm_allocation_granularity();
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   569
    return MaxSizeForAlignment("NUMAInterleaveGranularity", value, min_interleave_granularity, verbose);
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   570
  } else {
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   571
    return Flag::SUCCESS;
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   572
  }
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   573
}
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   574
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   575
Flag::Error NewSizeConstraintFunc(size_t value, bool verbose) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   576
#ifdef _LP64
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   577
#if INCLUDE_ALL_GCS
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   578
  // Overflow would happen for uint type variable of YoungGenSizer::_min_desired_young_length
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   579
  // when the value to be assigned exceeds uint range.
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   580
  // i.e. result of '(uint)(NewSize / region size(1~32MB))'
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   581
  // So maximum of NewSize should be 'max_juint * 1M'
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   582
  if (UseG1GC && (value > (max_juint * 1 * M))) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   583
    CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   584
                            "NewSize (" SIZE_FORMAT ") must be less than ergonomic maximum value\n",
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   585
                            value);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   586
    return Flag::VIOLATES_CONSTRAINT;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   587
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   588
#endif // INCLUDE_ALL_GCS
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   589
#endif // _LP64
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   590
  return Flag::SUCCESS;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   591
}
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   592
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   593
Flag::Error MinTLABSizeConstraintFunc(size_t value, bool verbose) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   594
  // At least, alignment reserve area is needed.
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   595
  if (value < ThreadLocalAllocBuffer::alignment_reserve_in_bytes()) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   596
    CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   597
                            "MinTLABSize (" SIZE_FORMAT ") must be "
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   598
                            "greater than or equal to reserved area in TLAB (" SIZE_FORMAT ")\n",
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   599
                            value, ThreadLocalAllocBuffer::alignment_reserve_in_bytes());
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   600
    return Flag::VIOLATES_CONSTRAINT;
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   601
  } else {
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   602
    return Flag::SUCCESS;
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   603
  }
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   604
}
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   605
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   606
Flag::Error TLABSizeConstraintFunc(size_t value, bool verbose) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   607
  // Skip for default value of zero which means set ergonomically.
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   608
  if (FLAG_IS_CMDLINE(TLABSize)) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   609
    if (value < MinTLABSize) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   610
      CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   611
                              "TLABSize (" SIZE_FORMAT ") must be "
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   612
                              "greater than or equal to MinTLABSize (" SIZE_FORMAT ")\n",
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   613
                              value, MinTLABSize);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   614
      return Flag::VIOLATES_CONSTRAINT;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   615
    }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   616
    if (value > (ThreadLocalAllocBuffer::max_size() * HeapWordSize)) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   617
      CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   618
                              "TLABSize (" SIZE_FORMAT ") must be "
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   619
                              "less than or equal to ergonomic TLAB maximum size (" SIZE_FORMAT ")\n",
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   620
                              value, (ThreadLocalAllocBuffer::max_size() * HeapWordSize));
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   621
      return Flag::VIOLATES_CONSTRAINT;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   622
    }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   623
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   624
  return Flag::SUCCESS;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   625
}
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   626
34661
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   627
// We will protect overflow from ThreadLocalAllocBuffer::record_slow_allocation(),
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   628
// so AfterMemoryInit type is enough to check.
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   629
Flag::Error TLABWasteIncrementConstraintFunc(uintx value, bool verbose) {
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   630
  if (UseTLAB) {
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   631
    size_t refill_waste_limit = Thread::current()->tlab().refill_waste_limit();
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   632
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   633
    // Compare with 'max_uintx' as ThreadLocalAllocBuffer::_refill_waste_limit is 'size_t'.
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   634
    if (refill_waste_limit > (max_uintx - value)) {
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   635
      CommandLineError::print(verbose,
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   636
                              "TLABWasteIncrement (" UINTX_FORMAT ") must be "
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   637
                              "less than or equal to ergonomic TLAB waste increment maximum size(" SIZE_FORMAT ")\n",
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   638
                              value, (max_uintx - refill_waste_limit));
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   639
      return Flag::VIOLATES_CONSTRAINT;
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   640
    }
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   641
  }
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   642
  return Flag::SUCCESS;
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   643
}
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   644
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   645
Flag::Error SurvivorRatioConstraintFunc(uintx value, bool verbose) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   646
  if (FLAG_IS_CMDLINE(SurvivorRatio) &&
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   647
      (value > (MaxHeapSize / Universe::heap()->collector_policy()->space_alignment()))) {
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   648
    CommandLineError::print(verbose,
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   649
                            "SurvivorRatio (" UINTX_FORMAT ") must be "
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   650
                            "less than or equal to ergonomic SurvivorRatio maximum (" SIZE_FORMAT ")\n",
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   651
                            value,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   652
                            (MaxHeapSize / Universe::heap()->collector_policy()->space_alignment()));
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   653
    return Flag::VIOLATES_CONSTRAINT;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   654
  } else {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   655
    return Flag::SUCCESS;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   656
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   657
}
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   658
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   659
Flag::Error MetaspaceSizeConstraintFunc(size_t value, bool verbose) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   660
  if (value > MaxMetaspaceSize) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   661
    CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   662
                            "MetaspaceSize (" SIZE_FORMAT ") must be "
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   663
                            "less than or equal to MaxMetaspaceSize (" SIZE_FORMAT ")\n",
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   664
                            value, MaxMetaspaceSize);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   665
    return Flag::VIOLATES_CONSTRAINT;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   666
  } else {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   667
    return Flag::SUCCESS;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   668
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   669
}
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   670
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   671
Flag::Error MaxMetaspaceSizeConstraintFunc(size_t value, bool verbose) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   672
  if (value < MetaspaceSize) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   673
    CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   674
                            "MaxMetaspaceSize (" SIZE_FORMAT ") must be "
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   675
                            "greater than or equal to MetaspaceSize (" SIZE_FORMAT ")\n",
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   676
                            value, MaxMetaspaceSize);
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   677
    return Flag::VIOLATES_CONSTRAINT;
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   678
  } else {
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   679
    return Flag::SUCCESS;
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   680
  }
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   681
}
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   682
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   683
Flag::Error SurvivorAlignmentInBytesConstraintFunc(intx value, bool verbose) {
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   684
  if (value != 0) {
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   685
    if (!is_power_of_2(value)) {
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   686
      CommandLineError::print(verbose,
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   687
                              "SurvivorAlignmentInBytes (" INTX_FORMAT ") must be "
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   688
                              "power of 2\n",
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   689
                              value);
31995
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
   690
      return Flag::VIOLATES_CONSTRAINT;
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
   691
    }
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   692
    if (value < ObjectAlignmentInBytes) {
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   693
      CommandLineError::print(verbose,
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   694
                              "SurvivorAlignmentInBytes (" INTX_FORMAT ") must be "
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   695
                              "greater than or equal to ObjectAlignmentInBytes (" INTX_FORMAT ")\n",
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   696
                              value, ObjectAlignmentInBytes);
31995
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
   697
      return Flag::VIOLATES_CONSTRAINT;
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   698
    }
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   699
  }
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   700
  return Flag::SUCCESS;
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   701
}