hotspot/src/share/vm/runtime/commandLineFlagConstraintsGC.cpp
author sangheki
Wed, 09 Mar 2016 15:37:33 -0800
changeset 37054 31d83caf01e8
parent 35203 3e70c7dc0772
child 37157 2a0fdb3e2a19
permissions -rw-r--r--
8145312: CMS: There is insufficient memory with CMSSamplingGrain=1 Summary: Change minimum range and add constraint function for CMSSamplingGrain flag Reviewed-by: jmasa, ddmitriev
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
/*
37054
31d83caf01e8 8145312: CMS: There is insufficient memory with CMSSamplingGrain=1
sangheki
parents: 35203
diff changeset
     2
 * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
31371
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"
37054
31d83caf01e8 8145312: CMS: There is insufficient memory with CMSSamplingGrain=1
sangheki
parents: 35203
diff changeset
    28
#include "gc/shared/genCollectedHeap.hpp"
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    29
#include "gc/shared/threadLocalAllocBuffer.hpp"
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    30
#include "runtime/arguments.hpp"
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    31
#include "runtime/commandLineFlagConstraintsGC.hpp"
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
    32
#include "runtime/commandLineFlagRangeList.hpp"
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    33
#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
    34
#include "runtime/globals_extension.hpp"
34661
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
    35
#include "runtime/thread.inline.hpp"
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    36
#include "utilities/defaultStream.hpp"
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    37
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    38
#if INCLUDE_ALL_GCS
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    39
#include "gc/g1/g1_globals.hpp"
31995
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
    40
#include "gc/g1/heapRegionBounds.inline.hpp"
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
    41
#include "gc/shared/plab.hpp"
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    42
#endif // INCLUDE_ALL_GCS
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    43
#ifdef COMPILER1
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    44
#include "c1/c1_globals.hpp"
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    45
#endif // COMPILER1
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    46
#ifdef COMPILER2
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    47
#include "opto/c2_globals.hpp"
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    48
#endif // COMPILER2
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    49
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    50
// 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
    51
// 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
    52
// 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
    53
// 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
    54
// 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
    55
// 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
    56
// 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
    57
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    58
#if INCLUDE_ALL_GCS
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    59
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
    60
  // 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
    61
  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
    62
    CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    63
                            "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
    64
                            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
    65
                            threads, threshold);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    66
    return Flag::VIOLATES_CONSTRAINT;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    67
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    68
  return Flag::SUCCESS;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    69
}
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    70
#endif
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    71
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    72
// 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
    73
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
    74
  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
    75
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    76
#if INCLUDE_ALL_GCS
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    77
  // 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
    78
  // 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
    79
  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
    80
    CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    81
                            "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
    82
                            "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
    83
                            value, max_jint);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    84
    return Flag::VIOLATES_CONSTRAINT;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    85
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    86
  // 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
    87
  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
    88
    CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    89
                            "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
    90
                            "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
    91
                            value, (max_jint / 10));
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    92
    return Flag::VIOLATES_CONSTRAINT;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    93
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    94
  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
    95
#endif
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    96
  return status;
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
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    99
// 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
   100
// we need constraint function.
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   101
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
   102
#if INCLUDE_ALL_GCS
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   103
  // 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
   104
  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
   105
    CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   106
                            "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
   107
                            "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
   108
                            value, ParallelGCThreads);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   109
    return Flag::VIOLATES_CONSTRAINT;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   110
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   111
#endif
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   112
  return Flag::SUCCESS;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   113
}
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   114
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   115
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
   116
#if INCLUDE_ALL_GCS
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   117
  if ((UseConcMarkSweepGC || UseG1GC) && (value < PLAB::min_size())) {
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   118
    CommandLineError::print(verbose,
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   119
                            "%s (" SIZE_FORMAT ") must be "
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   120
                            "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
   121
                            name, value, PLAB::min_size());
31995
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
   122
    return Flag::VIOLATES_CONSTRAINT;
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
   123
  }
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
   124
#endif // INCLUDE_ALL_GCS
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
   125
  return Flag::SUCCESS;
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
   126
}
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
   127
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   128
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
   129
#if INCLUDE_ALL_GCS
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   130
  if ((UseConcMarkSweepGC || UseG1GC) && (value > PLAB::max_size())) {
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   131
    CommandLineError::print(verbose,
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   132
                            "%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
   133
                            "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
   134
                            name, value, PLAB::max_size());
31995
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
   135
    return Flag::VIOLATES_CONSTRAINT;
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
   136
  }
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
   137
#endif // INCLUDE_ALL_GCS
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
   138
  return Flag::SUCCESS;
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
   139
}
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
   140
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   141
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
   142
  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
   143
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   144
  if (status == Flag::SUCCESS) {
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   145
    return MaxPLABSizeBounds(name, value, verbose);
31995
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
   146
  }
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   147
  return status;
31995
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
   148
}
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
   149
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   150
Flag::Error YoungPLABSizeConstraintFunc(size_t value, bool verbose) {
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   151
  return MinMaxPLABSizeBounds("YoungPLABSize", value, verbose);
31995
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
   152
}
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
   153
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   154
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
   155
  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
   156
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   157
#if INCLUDE_ALL_GCS
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   158
  if (UseConcMarkSweepGC) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   159
    if (value == 0) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   160
      CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   161
                              "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
   162
                              value);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   163
      return Flag::VIOLATES_CONSTRAINT;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   164
    }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   165
    // 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
   166
    // 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
   167
    // 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
   168
    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
   169
  } else {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   170
    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
   171
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   172
#endif
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   173
  return status;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   174
}
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   175
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   176
Flag::Error MinHeapFreeRatioConstraintFunc(uintx value, bool verbose) {
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   177
  if (value > MaxHeapFreeRatio) {
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   178
    CommandLineError::print(verbose,
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   179
                            "MinHeapFreeRatio (" UINTX_FORMAT ") must be "
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   180
                            "less than or equal to MaxHeapFreeRatio (" UINTX_FORMAT ")\n",
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   181
                            value, MaxHeapFreeRatio);
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   182
    return Flag::VIOLATES_CONSTRAINT;
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   183
  } else {
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   184
    return Flag::SUCCESS;
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
}
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   187
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   188
Flag::Error MaxHeapFreeRatioConstraintFunc(uintx value, bool verbose) {
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   189
  if (value < MinHeapFreeRatio) {
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   190
    CommandLineError::print(verbose,
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   191
                            "MaxHeapFreeRatio (" UINTX_FORMAT ") must be "
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   192
                            "greater than or equal to MinHeapFreeRatio (" UINTX_FORMAT ")\n",
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   193
                            value, MinHeapFreeRatio);
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   194
    return Flag::VIOLATES_CONSTRAINT;
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   195
  } else {
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   196
    return Flag::SUCCESS;
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
}
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   199
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   200
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
   201
  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
   202
    CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   203
                            "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
   204
                            "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
   205
                            "(" 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
   206
                            maxHeap, softRef);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   207
    return Flag::VIOLATES_CONSTRAINT;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   208
  } else {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   209
    return Flag::SUCCESS;
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
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   213
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
   214
  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
   215
}
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   216
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   217
Flag::Error MinMetaspaceFreeRatioConstraintFunc(uintx value, bool verbose) {
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   218
  if (value > MaxMetaspaceFreeRatio) {
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   219
    CommandLineError::print(verbose,
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   220
                            "MinMetaspaceFreeRatio (" UINTX_FORMAT ") must be "
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   221
                            "less than or equal to MaxMetaspaceFreeRatio (" UINTX_FORMAT ")\n",
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   222
                            value, MaxMetaspaceFreeRatio);
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   223
    return Flag::VIOLATES_CONSTRAINT;
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   224
  } else {
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   225
    return Flag::SUCCESS;
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
}
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   228
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   229
Flag::Error MaxMetaspaceFreeRatioConstraintFunc(uintx value, bool verbose) {
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   230
  if (value < MinMetaspaceFreeRatio) {
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   231
    CommandLineError::print(verbose,
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   232
                            "MaxMetaspaceFreeRatio (" UINTX_FORMAT ") must be "
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   233
                            "greater than or equal to MinMetaspaceFreeRatio (" UINTX_FORMAT ")\n",
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   234
                            value, MinMetaspaceFreeRatio);
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   235
    return Flag::VIOLATES_CONSTRAINT;
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   236
  } else {
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   237
    return Flag::SUCCESS;
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
}
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   240
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   241
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
   242
#if INCLUDE_ALL_GCS
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   243
  // 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
   244
  if (UseParallelGC && (value > MaxTenuringThreshold)) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   245
      CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   246
                              "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
   247
                              "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
   248
                              value, MaxTenuringThreshold);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   249
      return Flag::VIOLATES_CONSTRAINT;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   250
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   251
#endif
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   252
  return Flag::SUCCESS;
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   253
}
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   254
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   255
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
   256
#if INCLUDE_ALL_GCS
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   257
  // 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
   258
  // 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
   259
  if (UseParallelGC && (value < InitialTenuringThreshold)) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   260
    CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   261
                            "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
   262
                            "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
   263
                            value, InitialTenuringThreshold);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   264
    return Flag::VIOLATES_CONSTRAINT;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   265
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   266
#endif
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   267
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   268
  // 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
   269
  if ((value == 0) && (NeverTenure || !AlwaysTenure)) {
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   270
    CommandLineError::print(verbose,
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   271
                            "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
   272
                            "&& 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
   273
                            "AlwaysTenure=%s\n",
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   274
                            NeverTenure ? "true" : "false",
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   275
                            AlwaysTenure ? "true" : "false");
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   276
    return Flag::VIOLATES_CONSTRAINT;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   277
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   278
  return Flag::SUCCESS;
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
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   281
#if INCLUDE_ALL_GCS
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   282
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
   283
  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
   284
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   285
  // 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
   286
  // Minimum value is 1.
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   287
  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
   288
    CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   289
                            "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
   290
                            "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
   291
                            value);
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   292
    return Flag::VIOLATES_CONSTRAINT;
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   293
  } else {
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   294
    return Flag::SUCCESS;
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
}
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   297
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   298
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
   299
  if (!UseG1GC) return Flag::SUCCESS;
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   300
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   301
  // 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
   302
  // Minimum value is 1.
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   303
  if (FLAG_IS_CMDLINE(G1RSetSparseRegionEntries) && (value < 1)) {
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   304
    CommandLineError::print(verbose,
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   305
                            "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
   306
                            "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
   307
                            value);
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   308
    return Flag::VIOLATES_CONSTRAINT;
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   309
  } else {
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   310
    return Flag::SUCCESS;
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
}
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   313
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   314
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
   315
  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
   316
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   317
  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
   318
    CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   319
                            "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
   320
                            "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
   321
                            value, HeapRegionBounds::target_number());
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   322
    return Flag::VIOLATES_CONSTRAINT;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   323
  } else {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   324
    return Flag::SUCCESS;
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
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   328
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
   329
  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
   330
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   331
  // 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
   332
  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
   333
    CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   334
                            "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
   335
                            "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
   336
                            value);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   337
    return Flag::VIOLATES_CONSTRAINT;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   338
  } else {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   339
    return Flag::SUCCESS;
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
}
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   342
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   343
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
   344
  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
   345
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   346
  if (value > G1MaxNewSizePercent) {
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   347
    CommandLineError::print(verbose,
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   348
                            "G1NewSizePercent (" UINTX_FORMAT ") must be "
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   349
                            "less than or equal to G1MaxNewSizePercent (" UINTX_FORMAT ")\n",
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   350
                            value, G1MaxNewSizePercent);
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   351
    return Flag::VIOLATES_CONSTRAINT;
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   352
  } else {
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   353
    return Flag::SUCCESS;
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
}
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   356
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   357
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
   358
  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
   359
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   360
  if (value < G1NewSizePercent) {
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   361
    CommandLineError::print(verbose,
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   362
                            "G1MaxNewSizePercent (" UINTX_FORMAT ") must be "
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   363
                            "greater than or equal to G1NewSizePercent (" UINTX_FORMAT ")\n",
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   364
                            value, G1NewSizePercent);
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   365
    return Flag::VIOLATES_CONSTRAINT;
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   366
  } else {
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   367
    return Flag::SUCCESS;
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   368
  }
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   369
}
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   370
#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
   371
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   372
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
   373
#if INCLUDE_ALL_GCS
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   374
  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
   375
    CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   376
                            "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
   377
                            "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
   378
                            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
   379
    return Flag::VIOLATES_CONSTRAINT;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   380
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   381
#endif
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   382
  return Flag::SUCCESS;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   383
}
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   384
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   385
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
   386
  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
   387
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   388
#if INCLUDE_ALL_GCS
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   389
  if (UseConcMarkSweepGC) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   390
    if (value > CMSOldPLABMax) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   391
      CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   392
                              "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
   393
                              "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
   394
                              value, CMSOldPLABMax);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   395
      return Flag::VIOLATES_CONSTRAINT;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   396
    }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   397
    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
   398
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   399
#endif
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   400
  return status;
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
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   403
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
   404
  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
   405
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   406
#if INCLUDE_ALL_GCS
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   407
  if (UseConcMarkSweepGC) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   408
    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
   409
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   410
#endif
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   411
  return status;
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
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   414
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
   415
  if (value > MarkStackSizeMax) {
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   416
    CommandLineError::print(verbose,
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   417
                            "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
   418
                            "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
   419
                            value, MarkStackSizeMax);
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   420
    return Flag::VIOLATES_CONSTRAINT;
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   421
  } else {
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   422
    return Flag::SUCCESS;
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
}
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   425
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   426
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
   427
#if INCLUDE_ALL_GCS
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   428
  if (UseConcMarkSweepGC && (value <= CMSPrecleanNumerator)) {
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   429
    CommandLineError::print(verbose,
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   430
                            "CMSPrecleanDenominator (" UINTX_FORMAT ") must be "
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   431
                            "strickly greater than CMSPrecleanNumerator (" UINTX_FORMAT ")\n",
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   432
                            value, CMSPrecleanNumerator);
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   433
    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
   434
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   435
#endif
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   436
  return Flag::SUCCESS;
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
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   439
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
   440
#if INCLUDE_ALL_GCS
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   441
  if (UseConcMarkSweepGC && (value >= CMSPrecleanDenominator)) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   442
    CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   443
                            "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
   444
                            "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
   445
                            value, CMSPrecleanDenominator);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   446
    return Flag::VIOLATES_CONSTRAINT;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   447
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   448
#endif
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   449
  return Flag::SUCCESS;
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
37054
31d83caf01e8 8145312: CMS: There is insufficient memory with CMSSamplingGrain=1
sangheki
parents: 35203
diff changeset
   452
Flag::Error CMSSamplingGrainConstraintFunc(uintx value, bool verbose) {
31d83caf01e8 8145312: CMS: There is insufficient memory with CMSSamplingGrain=1
sangheki
parents: 35203
diff changeset
   453
#if INCLUDE_ALL_GCS
31d83caf01e8 8145312: CMS: There is insufficient memory with CMSSamplingGrain=1
sangheki
parents: 35203
diff changeset
   454
  if (UseConcMarkSweepGC) {
31d83caf01e8 8145312: CMS: There is insufficient memory with CMSSamplingGrain=1
sangheki
parents: 35203
diff changeset
   455
    size_t max_capacity = GenCollectedHeap::heap()->young_gen()->max_capacity();
31d83caf01e8 8145312: CMS: There is insufficient memory with CMSSamplingGrain=1
sangheki
parents: 35203
diff changeset
   456
    if (value > max_uintx - max_capacity) {
31d83caf01e8 8145312: CMS: There is insufficient memory with CMSSamplingGrain=1
sangheki
parents: 35203
diff changeset
   457
    CommandLineError::print(verbose,
31d83caf01e8 8145312: CMS: There is insufficient memory with CMSSamplingGrain=1
sangheki
parents: 35203
diff changeset
   458
                            "CMSSamplingGrain (" UINTX_FORMAT ") must be "
31d83caf01e8 8145312: CMS: There is insufficient memory with CMSSamplingGrain=1
sangheki
parents: 35203
diff changeset
   459
                            "less than or equal to ergonomic maximum (" SIZE_FORMAT ")\n",
31d83caf01e8 8145312: CMS: There is insufficient memory with CMSSamplingGrain=1
sangheki
parents: 35203
diff changeset
   460
                            value, max_uintx - max_capacity);
31d83caf01e8 8145312: CMS: There is insufficient memory with CMSSamplingGrain=1
sangheki
parents: 35203
diff changeset
   461
    return Flag::VIOLATES_CONSTRAINT;
31d83caf01e8 8145312: CMS: There is insufficient memory with CMSSamplingGrain=1
sangheki
parents: 35203
diff changeset
   462
    }
31d83caf01e8 8145312: CMS: There is insufficient memory with CMSSamplingGrain=1
sangheki
parents: 35203
diff changeset
   463
  }
31d83caf01e8 8145312: CMS: There is insufficient memory with CMSSamplingGrain=1
sangheki
parents: 35203
diff changeset
   464
#endif
31d83caf01e8 8145312: CMS: There is insufficient memory with CMSSamplingGrain=1
sangheki
parents: 35203
diff changeset
   465
  return Flag::SUCCESS;
31d83caf01e8 8145312: CMS: There is insufficient memory with CMSSamplingGrain=1
sangheki
parents: 35203
diff changeset
   466
}
31d83caf01e8 8145312: CMS: There is insufficient memory with CMSSamplingGrain=1
sangheki
parents: 35203
diff changeset
   467
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   468
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
   469
#if INCLUDE_ALL_GCS
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   470
  if (UseConcMarkSweepGC) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   471
    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
   472
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   473
#endif
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   474
  return Flag::SUCCESS;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   475
}
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   476
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   477
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
   478
#if INCLUDE_ALL_GCS
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   479
  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
   480
    CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   481
                            "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
   482
                            "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
   483
                            value, GCPauseIntervalMillis);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   484
    return Flag::VIOLATES_CONSTRAINT;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   485
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   486
#endif
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   487
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   488
  return Flag::SUCCESS;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   489
}
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   490
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   491
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
   492
#if INCLUDE_ALL_GCS
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   493
  if (UseG1GC) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   494
    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
   495
      if (value < 1) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   496
        CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   497
                                "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
   498
                                "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
   499
                                value);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   500
        return Flag::VIOLATES_CONSTRAINT;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   501
      }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   502
      if (value <= MaxGCPauseMillis) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   503
        CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   504
                                "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
   505
                                "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
   506
                                value, MaxGCPauseMillis);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   507
        return Flag::VIOLATES_CONSTRAINT;
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
    }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   510
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   511
#endif
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   512
  return Flag::SUCCESS;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   513
}
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   514
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   515
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
   516
  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
   517
  if (value > aligned_max) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   518
    CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   519
                            "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
   520
                            "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
   521
                            value, aligned_max);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   522
    return Flag::VIOLATES_CONSTRAINT;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   523
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   524
  return Flag::SUCCESS;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   525
}
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   526
34661
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   527
// 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
   528
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
   529
  size_t aligned_max = ((max_uintx - alignment) & ~(alignment-1));
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   530
  if (value > aligned_max) {
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   531
    CommandLineError::print(verbose,
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   532
                            "%s (" SIZE_FORMAT ") must be "
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   533
                            "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
   534
                            name, value, aligned_max);
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   535
    return Flag::VIOLATES_CONSTRAINT;
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   536
  }
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   537
  return Flag::SUCCESS;
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   538
}
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   539
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   540
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
   541
  // 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
   542
  size_t heap_alignment;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   543
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   544
#if INCLUDE_ALL_GCS
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   545
  if (UseG1GC) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   546
    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
   547
  } else
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   548
#endif
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   549
  {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   550
    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
   551
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   552
34661
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   553
  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
   554
}
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   555
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   556
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
   557
  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
   558
}
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   559
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   560
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
   561
  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
   562
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   563
  if (status == Flag::SUCCESS) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   564
    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
   565
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   566
  return status;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   567
}
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   568
34661
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   569
Flag::Error HeapBaseMinAddressConstraintFunc(size_t value, bool verbose) {
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   570
  // 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
   571
  // 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
   572
  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
   573
    CommandLineError::print(verbose,
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   574
                            "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
   575
                            "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
   576
                            value, MaxHeapSize, max_uintx);
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   577
    return Flag::VIOLATES_CONSTRAINT;
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   578
  }
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   579
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   580
  return MaxSizeForHeapAlignment("HeapBaseMinAddress", value, verbose);
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   581
}
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   582
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   583
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
   584
#ifdef _LP64
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   585
#if INCLUDE_ALL_GCS
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   586
  // 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
   587
  // 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
   588
  // 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
   589
  // 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
   590
  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
   591
    CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   592
                            "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
   593
                            value);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   594
    return Flag::VIOLATES_CONSTRAINT;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   595
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   596
#endif // INCLUDE_ALL_GCS
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   597
#endif // _LP64
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   598
  return Flag::SUCCESS;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   599
}
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   600
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   601
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
   602
  // 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
   603
  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
   604
    CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   605
                            "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
   606
                            "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
   607
                            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
   608
    return Flag::VIOLATES_CONSTRAINT;
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   609
  } else {
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   610
    return Flag::SUCCESS;
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   611
  }
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   612
}
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   613
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   614
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
   615
  // 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
   616
  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
   617
    if (value < MinTLABSize) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   618
      CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   619
                              "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
   620
                              "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
   621
                              value, MinTLABSize);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   622
      return Flag::VIOLATES_CONSTRAINT;
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
    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
   625
      CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   626
                              "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
   627
                              "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
   628
                              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
   629
      return Flag::VIOLATES_CONSTRAINT;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   630
    }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   631
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   632
  return Flag::SUCCESS;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   633
}
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   634
34661
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   635
// We will protect overflow from ThreadLocalAllocBuffer::record_slow_allocation(),
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   636
// so AfterMemoryInit type is enough to check.
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   637
Flag::Error TLABWasteIncrementConstraintFunc(uintx value, bool verbose) {
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   638
  if (UseTLAB) {
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   639
    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
   640
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   641
    // 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
   642
    if (refill_waste_limit > (max_uintx - value)) {
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   643
      CommandLineError::print(verbose,
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   644
                              "TLABWasteIncrement (" UINTX_FORMAT ") must be "
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   645
                              "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
   646
                              value, (max_uintx - refill_waste_limit));
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   647
      return Flag::VIOLATES_CONSTRAINT;
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   648
    }
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   649
  }
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   650
  return Flag::SUCCESS;
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   651
}
9a1d11d88ea0 8142341: GC: current flags need ranges to be implemented
sangheki
parents: 33144
diff changeset
   652
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   653
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
   654
  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
   655
      (value > (MaxHeapSize / Universe::heap()->collector_policy()->space_alignment()))) {
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   656
    CommandLineError::print(verbose,
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   657
                            "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
   658
                            "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
   659
                            value,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   660
                            (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
   661
    return Flag::VIOLATES_CONSTRAINT;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   662
  } else {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   663
    return Flag::SUCCESS;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   664
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   665
}
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   666
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   667
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
   668
  if (value > MaxMetaspaceSize) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   669
    CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   670
                            "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
   671
                            "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
   672
                            value, MaxMetaspaceSize);
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   673
    return Flag::VIOLATES_CONSTRAINT;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   674
  } else {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   675
    return Flag::SUCCESS;
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   676
  }
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   677
}
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   678
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   679
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
   680
  if (value < MetaspaceSize) {
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   681
    CommandLineError::print(verbose,
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
   682
                            "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
   683
                            "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
   684
                            value, MaxMetaspaceSize);
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   685
    return Flag::VIOLATES_CONSTRAINT;
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   686
  } else {
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   687
    return Flag::SUCCESS;
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   688
  }
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   689
}
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   690
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   691
Flag::Error SurvivorAlignmentInBytesConstraintFunc(intx value, bool verbose) {
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   692
  if (value != 0) {
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   693
    if (!is_power_of_2(value)) {
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   694
      CommandLineError::print(verbose,
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   695
                              "SurvivorAlignmentInBytes (" INTX_FORMAT ") must be "
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   696
                              "power of 2\n",
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   697
                              value);
31995
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
   698
      return Flag::VIOLATES_CONSTRAINT;
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
   699
    }
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   700
    if (value < ObjectAlignmentInBytes) {
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   701
      CommandLineError::print(verbose,
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   702
                              "SurvivorAlignmentInBytes (" INTX_FORMAT ") must be "
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   703
                              "greater than or equal to ObjectAlignmentInBytes (" INTX_FORMAT ")\n",
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31995
diff changeset
   704
                              value, ObjectAlignmentInBytes);
31995
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
   705
      return Flag::VIOLATES_CONSTRAINT;
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   706
    }
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   707
  }
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   708
  return Flag::SUCCESS;
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
   709
}