src/hotspot/share/gc/shared/jvmFlagConstraintsGC.cpp
author gziemski
Thu, 26 Apr 2018 11:19:05 -0500
changeset 49902 3661f31c6df4
parent 49860 src/hotspot/share/gc/shared/commandLineFlagConstraintsGC.cpp@ca5216a2a2cc
child 49982 9042ffe5b7fe
child 56497 598e0c5b6f8c
permissions -rw-r--r--
8202150: [REDO] Split globals.hpp to factor out the Flag class Summary: Factored out Flag out go globals, renamed to JVMFlag Reviewed-by: coleenp, dholmes, kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
     1
/*
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
     2
 * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
     4
 *
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
     7
 * published by the Free Software Foundation.
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
     8
 *
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    13
 * accompanied this code).
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    14
 *
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    18
 *
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    21
 * questions.
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    22
 *
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    23
 */
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    24
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    25
#include "precompiled.hpp"
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    26
#include "gc/shared/collectedHeap.hpp"
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    27
#include "gc/shared/collectorPolicy.hpp"
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
    28
#include "gc/shared/jvmFlagConstraintsGC.hpp"
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    29
#include "gc/shared/plab.hpp"
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    30
#include "gc/shared/threadLocalAllocBuffer.hpp"
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    31
#include "runtime/arguments.hpp"
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
    32
#include "runtime/flags/jvmFlagRangeList.hpp"
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    33
#include "runtime/globals.hpp"
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    34
#include "runtime/globals_extension.hpp"
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    35
#include "runtime/thread.inline.hpp"
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    36
#include "utilities/align.hpp"
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    37
#include "utilities/defaultStream.hpp"
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    38
#include "utilities/macros.hpp"
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    39
#if INCLUDE_ALL_GCS
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
    40
#include "gc/cms/jvmFlagConstraintsCMS.hpp"
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
    41
#include "gc/g1/jvmFlagConstraintsG1.hpp"
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
    42
#include "gc/parallel/jvmFlagConstraintsParallel.hpp"
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    43
#endif
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    44
#ifdef COMPILER1
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    45
#include "c1/c1_globals.hpp"
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    46
#endif // COMPILER1
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    47
#ifdef COMPILER2
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    48
#include "opto/c2_globals.hpp"
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    49
#endif // COMPILER2
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    50
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    51
// Some flags that have default values that indicate that the
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    52
// JVM should automatically determine an appropriate value
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    53
// for that flag.  In those cases it is only appropriate for the
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    54
// constraint checking to be done if the user has specified the
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    55
// value(s) of the flag(s) on the command line.  In the constraint
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    56
// checking functions,  FLAG_IS_CMDLINE() is used to check if
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    57
// the flag has been set by the user and so should be checked.
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    58
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    59
// As ParallelGCThreads differs among GC modes, we need constraint function.
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
    60
JVMFlag::Error ParallelGCThreadsConstraintFunc(uint value, bool verbose) {
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
    61
  JVMFlag::Error status = JVMFlag::SUCCESS;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    62
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    63
#if INCLUDE_ALL_GCS
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    64
  status = ParallelGCThreadsConstraintFuncParallel(value, verbose);
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
    65
  if (status != JVMFlag::SUCCESS) {
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    66
    return status;
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    67
  }
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    68
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    69
  status = ParallelGCThreadsConstraintFuncCMS(value, verbose);
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
    70
  if (status != JVMFlag::SUCCESS) {
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    71
    return status;
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    72
  }
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    73
#endif
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    74
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    75
  return status;
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    76
}
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    77
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    78
// As ConcGCThreads should be smaller than ParallelGCThreads,
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    79
// we need constraint function.
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
    80
JVMFlag::Error ConcGCThreadsConstraintFunc(uint value, bool verbose) {
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    81
#if INCLUDE_ALL_GCS
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    82
  // CMS and G1 GCs use ConcGCThreads.
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    83
  if ((UseConcMarkSweepGC || UseG1GC) && (value > ParallelGCThreads)) {
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    84
    CommandLineError::print(verbose,
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    85
                            "ConcGCThreads (" UINT32_FORMAT ") must be "
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    86
                            "less than or equal to ParallelGCThreads (" UINT32_FORMAT ")\n",
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    87
                            value, ParallelGCThreads);
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
    88
    return JVMFlag::VIOLATES_CONSTRAINT;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    89
  }
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    90
#endif
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
    91
  return JVMFlag::SUCCESS;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    92
}
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    93
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
    94
static JVMFlag::Error MinPLABSizeBounds(const char* name, size_t value, bool verbose) {
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    95
#if INCLUDE_ALL_GCS
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    96
  if ((UseConcMarkSweepGC || UseG1GC || UseParallelGC) && (value < PLAB::min_size())) {
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    97
    CommandLineError::print(verbose,
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    98
                            "%s (" SIZE_FORMAT ") must be "
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    99
                            "greater than or equal to ergonomic PLAB minimum size (" SIZE_FORMAT ")\n",
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   100
                            name, value, PLAB::min_size());
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   101
    return JVMFlag::VIOLATES_CONSTRAINT;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   102
  }
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   103
#endif // INCLUDE_ALL_GCS
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   104
  return JVMFlag::SUCCESS;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   105
}
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   106
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   107
JVMFlag::Error MaxPLABSizeBounds(const char* name, size_t value, bool verbose) {
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   108
#if INCLUDE_ALL_GCS
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   109
  if ((UseConcMarkSweepGC || UseG1GC || UseParallelGC) && (value > PLAB::max_size())) {
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   110
    CommandLineError::print(verbose,
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   111
                            "%s (" SIZE_FORMAT ") must be "
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   112
                            "less than or equal to ergonomic PLAB maximum size (" SIZE_FORMAT ")\n",
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   113
                            name, value, PLAB::max_size());
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   114
    return JVMFlag::VIOLATES_CONSTRAINT;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   115
  }
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   116
#endif // INCLUDE_ALL_GCS
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   117
  return JVMFlag::SUCCESS;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   118
}
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   119
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   120
static JVMFlag::Error MinMaxPLABSizeBounds(const char* name, size_t value, bool verbose) {
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   121
  JVMFlag::Error status = MinPLABSizeBounds(name, value, verbose);
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   122
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   123
  if (status == JVMFlag::SUCCESS) {
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   124
    return MaxPLABSizeBounds(name, value, verbose);
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   125
  }
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   126
  return status;
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   127
}
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   128
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   129
JVMFlag::Error YoungPLABSizeConstraintFunc(size_t value, bool verbose) {
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   130
  return MinMaxPLABSizeBounds("YoungPLABSize", value, verbose);
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   131
}
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   132
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   133
JVMFlag::Error OldPLABSizeConstraintFunc(size_t value, bool verbose) {
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   134
  JVMFlag::Error status = JVMFlag::SUCCESS;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   135
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   136
#if INCLUDE_ALL_GCS
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   137
  if (UseConcMarkSweepGC) {
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   138
    return OldPLABSizeConstraintFuncCMS(value, verbose);
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   139
  } else {
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   140
    status = MinMaxPLABSizeBounds("OldPLABSize", value, verbose);
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   141
  }
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   142
#endif
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   143
  return status;
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   144
}
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   145
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   146
JVMFlag::Error MinHeapFreeRatioConstraintFunc(uintx value, bool verbose) {
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   147
  if (value > MaxHeapFreeRatio) {
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   148
    CommandLineError::print(verbose,
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   149
                            "MinHeapFreeRatio (" UINTX_FORMAT ") must be "
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   150
                            "less than or equal to MaxHeapFreeRatio (" UINTX_FORMAT ")\n",
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   151
                            value, MaxHeapFreeRatio);
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   152
    return JVMFlag::VIOLATES_CONSTRAINT;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   153
  } else {
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   154
    return JVMFlag::SUCCESS;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   155
  }
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   156
}
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   157
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   158
JVMFlag::Error MaxHeapFreeRatioConstraintFunc(uintx value, bool verbose) {
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   159
  if (value < MinHeapFreeRatio) {
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   160
    CommandLineError::print(verbose,
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   161
                            "MaxHeapFreeRatio (" UINTX_FORMAT ") must be "
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   162
                            "greater than or equal to MinHeapFreeRatio (" UINTX_FORMAT ")\n",
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   163
                            value, MinHeapFreeRatio);
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   164
    return JVMFlag::VIOLATES_CONSTRAINT;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   165
  } else {
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   166
    return JVMFlag::SUCCESS;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   167
  }
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   168
}
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   169
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   170
static JVMFlag::Error CheckMaxHeapSizeAndSoftRefLRUPolicyMSPerMB(size_t maxHeap, intx softRef, bool verbose) {
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   171
  if ((softRef > 0) && ((maxHeap / M) > (max_uintx / softRef))) {
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   172
    CommandLineError::print(verbose,
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   173
                            "Desired lifetime of SoftReferences cannot be expressed correctly. "
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   174
                            "MaxHeapSize (" SIZE_FORMAT ") or SoftRefLRUPolicyMSPerMB "
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   175
                            "(" INTX_FORMAT ") is too large\n",
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   176
                            maxHeap, softRef);
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   177
    return JVMFlag::VIOLATES_CONSTRAINT;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   178
  } else {
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   179
    return JVMFlag::SUCCESS;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   180
  }
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   181
}
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   182
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   183
JVMFlag::Error SoftRefLRUPolicyMSPerMBConstraintFunc(intx value, bool verbose) {
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   184
  return CheckMaxHeapSizeAndSoftRefLRUPolicyMSPerMB(MaxHeapSize, value, verbose);
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   185
}
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   186
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   187
JVMFlag::Error MarkStackSizeConstraintFunc(size_t value, bool verbose) {
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   188
  if (value > MarkStackSizeMax) {
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   189
    CommandLineError::print(verbose,
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   190
                            "MarkStackSize (" SIZE_FORMAT ") must be "
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   191
                            "less than or equal to MarkStackSizeMax (" SIZE_FORMAT ")\n",
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   192
                            value, MarkStackSizeMax);
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   193
    return JVMFlag::VIOLATES_CONSTRAINT;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   194
  } else {
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   195
    return JVMFlag::SUCCESS;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   196
  }
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   197
}
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   198
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   199
JVMFlag::Error MinMetaspaceFreeRatioConstraintFunc(uintx value, bool verbose) {
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   200
  if (value > MaxMetaspaceFreeRatio) {
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   201
    CommandLineError::print(verbose,
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   202
                            "MinMetaspaceFreeRatio (" UINTX_FORMAT ") must be "
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   203
                            "less than or equal to MaxMetaspaceFreeRatio (" UINTX_FORMAT ")\n",
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   204
                            value, MaxMetaspaceFreeRatio);
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   205
    return JVMFlag::VIOLATES_CONSTRAINT;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   206
  } else {
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   207
    return JVMFlag::SUCCESS;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   208
  }
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   209
}
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   210
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   211
JVMFlag::Error MaxMetaspaceFreeRatioConstraintFunc(uintx value, bool verbose) {
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   212
  if (value < MinMetaspaceFreeRatio) {
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   213
    CommandLineError::print(verbose,
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   214
                            "MaxMetaspaceFreeRatio (" UINTX_FORMAT ") must be "
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   215
                            "greater than or equal to MinMetaspaceFreeRatio (" UINTX_FORMAT ")\n",
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   216
                            value, MinMetaspaceFreeRatio);
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   217
    return JVMFlag::VIOLATES_CONSTRAINT;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   218
  } else {
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   219
    return JVMFlag::SUCCESS;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   220
  }
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   221
}
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   222
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   223
JVMFlag::Error InitialTenuringThresholdConstraintFunc(uintx value, bool verbose) {
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   224
#if INCLUDE_ALL_GCS
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   225
  JVMFlag::Error status = InitialTenuringThresholdConstraintFuncParallel(value, verbose);
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   226
  if (status != JVMFlag::SUCCESS) {
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   227
    return status;
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   228
  }
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   229
#endif
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   230
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   231
  return JVMFlag::SUCCESS;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   232
}
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   233
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   234
JVMFlag::Error MaxTenuringThresholdConstraintFunc(uintx value, bool verbose) {
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   235
#if INCLUDE_ALL_GCS
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   236
  JVMFlag::Error status = MaxTenuringThresholdConstraintFuncParallel(value, verbose);
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   237
  if (status != JVMFlag::SUCCESS) {
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   238
    return status;
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   239
  }
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   240
#endif
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   241
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   242
  // MaxTenuringThreshold=0 means NeverTenure=false && AlwaysTenure=true
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   243
  if ((value == 0) && (NeverTenure || !AlwaysTenure)) {
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   244
    CommandLineError::print(verbose,
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   245
                            "MaxTenuringThreshold (0) should match to NeverTenure=false "
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   246
                            "&& AlwaysTenure=true. But we have NeverTenure=%s "
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   247
                            "AlwaysTenure=%s\n",
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   248
                            NeverTenure ? "true" : "false",
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   249
                            AlwaysTenure ? "true" : "false");
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   250
    return JVMFlag::VIOLATES_CONSTRAINT;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   251
  }
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   252
  return JVMFlag::SUCCESS;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   253
}
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   254
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   255
JVMFlag::Error MaxGCPauseMillisConstraintFunc(uintx value, bool verbose) {
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   256
#if INCLUDE_ALL_GCS
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   257
  JVMFlag::Error status = MaxGCPauseMillisConstraintFuncG1(value, verbose);
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   258
  if (status != JVMFlag::SUCCESS) {
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   259
    return status;
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   260
  }
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   261
#endif
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   262
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   263
  return JVMFlag::SUCCESS;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   264
}
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   265
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   266
JVMFlag::Error GCPauseIntervalMillisConstraintFunc(uintx value, bool verbose) {
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   267
#if INCLUDE_ALL_GCS
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   268
  JVMFlag::Error status = GCPauseIntervalMillisConstraintFuncG1(value, verbose);
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   269
  if (status != JVMFlag::SUCCESS) {
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   270
    return status;
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   271
  }
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   272
#endif
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   273
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   274
  return JVMFlag::SUCCESS;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   275
}
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   276
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   277
JVMFlag::Error InitialBootClassLoaderMetaspaceSizeConstraintFunc(size_t value, bool verbose) {
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   278
  size_t aligned_max = align_down(max_uintx/2, Metaspace::reserve_alignment_words());
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   279
  if (value > aligned_max) {
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   280
    CommandLineError::print(verbose,
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   281
                            "InitialBootClassLoaderMetaspaceSize (" SIZE_FORMAT ") must be "
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   282
                            "less than or equal to aligned maximum value (" SIZE_FORMAT ")\n",
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   283
                            value, aligned_max);
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   284
    return JVMFlag::VIOLATES_CONSTRAINT;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   285
  }
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   286
  return JVMFlag::SUCCESS;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   287
}
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   288
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   289
// To avoid an overflow by 'align_up(value, alignment)'.
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   290
static JVMFlag::Error MaxSizeForAlignment(const char* name, size_t value, size_t alignment, bool verbose) {
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   291
  size_t aligned_max = ((max_uintx - alignment) & ~(alignment-1));
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   292
  if (value > aligned_max) {
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   293
    CommandLineError::print(verbose,
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   294
                            "%s (" SIZE_FORMAT ") must be "
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   295
                            "less than or equal to aligned maximum value (" SIZE_FORMAT ")\n",
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   296
                            name, value, aligned_max);
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   297
    return JVMFlag::VIOLATES_CONSTRAINT;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   298
  }
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   299
  return JVMFlag::SUCCESS;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   300
}
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   301
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   302
static JVMFlag::Error MaxSizeForHeapAlignment(const char* name, size_t value, bool verbose) {
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   303
  size_t heap_alignment;
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   304
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   305
#if INCLUDE_ALL_GCS
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   306
  if (UseG1GC) {
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   307
    // For G1 GC, we don't know until G1CollectorPolicy is created.
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   308
    heap_alignment = MaxSizeForHeapAlignmentG1();
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   309
  } else
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   310
#endif
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   311
  {
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   312
    heap_alignment = CollectorPolicy::compute_heap_alignment();
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   313
  }
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   314
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   315
  return MaxSizeForAlignment(name, value, heap_alignment, verbose);
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   316
}
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   317
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   318
JVMFlag::Error InitialHeapSizeConstraintFunc(size_t value, bool verbose) {
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   319
  return MaxSizeForHeapAlignment("InitialHeapSize", value, verbose);
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   320
}
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   321
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   322
JVMFlag::Error MaxHeapSizeConstraintFunc(size_t value, bool verbose) {
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   323
  JVMFlag::Error status = MaxSizeForHeapAlignment("MaxHeapSize", value, verbose);
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   324
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   325
  if (status == JVMFlag::SUCCESS) {
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   326
    status = CheckMaxHeapSizeAndSoftRefLRUPolicyMSPerMB(value, SoftRefLRUPolicyMSPerMB, verbose);
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   327
  }
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   328
  return status;
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   329
}
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   330
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   331
JVMFlag::Error HeapBaseMinAddressConstraintFunc(size_t value, bool verbose) {
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   332
  // If an overflow happened in Arguments::set_heap_size(), MaxHeapSize will have too large a value.
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   333
  // Check for this by ensuring that MaxHeapSize plus the requested min base address still fit within max_uintx.
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   334
  if (UseCompressedOops && FLAG_IS_ERGO(MaxHeapSize) && (value > (max_uintx - MaxHeapSize))) {
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   335
    CommandLineError::print(verbose,
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   336
                            "HeapBaseMinAddress (" SIZE_FORMAT ") or MaxHeapSize (" SIZE_FORMAT ") is too large. "
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   337
                            "Sum of them must be less than or equal to maximum of size_t (" SIZE_FORMAT ")\n",
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   338
                            value, MaxHeapSize, max_uintx);
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   339
    return JVMFlag::VIOLATES_CONSTRAINT;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   340
  }
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   341
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   342
  return MaxSizeForHeapAlignment("HeapBaseMinAddress", value, verbose);
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   343
}
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   344
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   345
JVMFlag::Error NewSizeConstraintFunc(size_t value, bool verbose) {
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   346
#if INCLUDE_ALL_GCS
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   347
  JVMFlag::Error status = NewSizeConstraintFuncG1(value, verbose);
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   348
  if (status != JVMFlag::SUCCESS) {
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   349
    return status;
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   350
  }
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   351
#endif
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   352
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   353
  return JVMFlag::SUCCESS;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   354
}
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   355
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   356
JVMFlag::Error MinTLABSizeConstraintFunc(size_t value, bool verbose) {
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   357
  // At least, alignment reserve area is needed.
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   358
  if (value < ThreadLocalAllocBuffer::alignment_reserve_in_bytes()) {
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   359
    CommandLineError::print(verbose,
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   360
                            "MinTLABSize (" SIZE_FORMAT ") must be "
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   361
                            "greater than or equal to reserved area in TLAB (" SIZE_FORMAT ")\n",
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   362
                            value, ThreadLocalAllocBuffer::alignment_reserve_in_bytes());
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   363
    return JVMFlag::VIOLATES_CONSTRAINT;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   364
  }
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   365
  if (value > (ThreadLocalAllocBuffer::max_size() * HeapWordSize)) {
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   366
    CommandLineError::print(verbose,
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   367
                            "MinTLABSize (" SIZE_FORMAT ") must be "
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   368
                            "less than or equal to ergonomic TLAB maximum (" SIZE_FORMAT ")\n",
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   369
                            value, ThreadLocalAllocBuffer::max_size() * HeapWordSize);
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   370
    return JVMFlag::VIOLATES_CONSTRAINT;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   371
  }
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   372
  return JVMFlag::SUCCESS;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   373
}
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   374
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   375
JVMFlag::Error TLABSizeConstraintFunc(size_t value, bool verbose) {
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   376
  // Skip for default value of zero which means set ergonomically.
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   377
  if (FLAG_IS_CMDLINE(TLABSize)) {
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   378
    if (value < MinTLABSize) {
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   379
      CommandLineError::print(verbose,
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   380
                              "TLABSize (" SIZE_FORMAT ") must be "
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   381
                              "greater than or equal to MinTLABSize (" SIZE_FORMAT ")\n",
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   382
                              value, MinTLABSize);
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   383
      return JVMFlag::VIOLATES_CONSTRAINT;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   384
    }
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   385
    if (value > (ThreadLocalAllocBuffer::max_size() * HeapWordSize)) {
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   386
      CommandLineError::print(verbose,
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   387
                              "TLABSize (" SIZE_FORMAT ") must be "
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   388
                              "less than or equal to ergonomic TLAB maximum size (" SIZE_FORMAT ")\n",
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   389
                              value, (ThreadLocalAllocBuffer::max_size() * HeapWordSize));
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   390
      return JVMFlag::VIOLATES_CONSTRAINT;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   391
    }
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   392
  }
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   393
  return JVMFlag::SUCCESS;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   394
}
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   395
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   396
// We will protect overflow from ThreadLocalAllocBuffer::record_slow_allocation(),
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   397
// so AfterMemoryInit type is enough to check.
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   398
JVMFlag::Error TLABWasteIncrementConstraintFunc(uintx value, bool verbose) {
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   399
  if (UseTLAB) {
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   400
    size_t refill_waste_limit = Thread::current()->tlab().refill_waste_limit();
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   401
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   402
    // Compare with 'max_uintx' as ThreadLocalAllocBuffer::_refill_waste_limit is 'size_t'.
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   403
    if (refill_waste_limit > (max_uintx - value)) {
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   404
      CommandLineError::print(verbose,
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   405
                              "TLABWasteIncrement (" UINTX_FORMAT ") must be "
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   406
                              "less than or equal to ergonomic TLAB waste increment maximum size(" SIZE_FORMAT ")\n",
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   407
                              value, (max_uintx - refill_waste_limit));
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   408
      return JVMFlag::VIOLATES_CONSTRAINT;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   409
    }
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   410
  }
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   411
  return JVMFlag::SUCCESS;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   412
}
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   413
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   414
JVMFlag::Error SurvivorRatioConstraintFunc(uintx value, bool verbose) {
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   415
  if (FLAG_IS_CMDLINE(SurvivorRatio) &&
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   416
      (value > (MaxHeapSize / Universe::heap()->collector_policy()->space_alignment()))) {
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   417
    CommandLineError::print(verbose,
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   418
                            "SurvivorRatio (" UINTX_FORMAT ") must be "
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   419
                            "less than or equal to ergonomic SurvivorRatio maximum (" SIZE_FORMAT ")\n",
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   420
                            value,
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   421
                            (MaxHeapSize / Universe::heap()->collector_policy()->space_alignment()));
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   422
    return JVMFlag::VIOLATES_CONSTRAINT;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   423
  } else {
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   424
    return JVMFlag::SUCCESS;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   425
  }
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   426
}
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   427
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   428
JVMFlag::Error MetaspaceSizeConstraintFunc(size_t value, bool verbose) {
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   429
  if (value > MaxMetaspaceSize) {
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   430
    CommandLineError::print(verbose,
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   431
                            "MetaspaceSize (" SIZE_FORMAT ") must be "
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   432
                            "less than or equal to MaxMetaspaceSize (" SIZE_FORMAT ")\n",
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   433
                            value, MaxMetaspaceSize);
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   434
    return JVMFlag::VIOLATES_CONSTRAINT;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   435
  } else {
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   436
    return JVMFlag::SUCCESS;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   437
  }
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   438
}
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   439
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   440
JVMFlag::Error MaxMetaspaceSizeConstraintFunc(size_t value, bool verbose) {
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   441
  if (value < MetaspaceSize) {
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   442
    CommandLineError::print(verbose,
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   443
                            "MaxMetaspaceSize (" SIZE_FORMAT ") must be "
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   444
                            "greater than or equal to MetaspaceSize (" SIZE_FORMAT ")\n",
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   445
                            value, MaxMetaspaceSize);
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   446
    return JVMFlag::VIOLATES_CONSTRAINT;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   447
  } else {
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   448
    return JVMFlag::SUCCESS;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   449
  }
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   450
}
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   451
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   452
JVMFlag::Error SurvivorAlignmentInBytesConstraintFunc(intx value, bool verbose) {
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   453
  if (value != 0) {
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   454
    if (!is_power_of_2(value)) {
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   455
      CommandLineError::print(verbose,
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   456
                              "SurvivorAlignmentInBytes (" INTX_FORMAT ") must be "
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   457
                              "power of 2\n",
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   458
                              value);
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   459
      return JVMFlag::VIOLATES_CONSTRAINT;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   460
    }
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   461
    if (value < ObjectAlignmentInBytes) {
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   462
      CommandLineError::print(verbose,
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   463
                              "SurvivorAlignmentInBytes (" INTX_FORMAT ") must be "
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   464
                              "greater than or equal to ObjectAlignmentInBytes (" INTX_FORMAT ")\n",
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   465
                              value, ObjectAlignmentInBytes);
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   466
      return JVMFlag::VIOLATES_CONSTRAINT;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   467
    }
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   468
  }
49902
3661f31c6df4 8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents: 49860
diff changeset
   469
  return JVMFlag::SUCCESS;
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   470
}