hotspot/src/share/vm/runtime/commandLineFlagConstraintsRuntime.cpp
author dcubed
Thu, 07 Apr 2016 12:54:48 -0700
changeset 37429 5b1720e87eda
parent 37212 eee5234b860e
child 44631 c2d275ef8f69
permissions -rw-r--r--
Merge
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
/*
37212
eee5234b860e 8143958: CDS Shared flags need constraint function
gziemski
parents: 33222
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"
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    26
#include "runtime/arguments.hpp"
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    27
#include "runtime/commandLineFlagConstraintsRuntime.hpp"
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31371
diff changeset
    28
#include "runtime/commandLineFlagRangeList.hpp"
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    29
#include "runtime/globals.hpp"
33222
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
    30
#include "runtime/task.hpp"
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    31
#include "utilities/defaultStream.hpp"
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    32
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31371
diff changeset
    33
Flag::Error ObjectAlignmentInBytesConstraintFunc(intx value, bool verbose) {
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31371
diff changeset
    34
  if (!is_power_of_2(value)) {
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31371
diff changeset
    35
    CommandLineError::print(verbose,
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31371
diff changeset
    36
                            "ObjectAlignmentInBytes (" INTX_FORMAT ") must be "
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31371
diff changeset
    37
                            "power of 2\n",
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31371
diff changeset
    38
                            value);
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    39
    return Flag::VIOLATES_CONSTRAINT;
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    40
  }
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    41
  // In case page size is very small.
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31371
diff changeset
    42
  if (value >= (intx)os::vm_page_size()) {
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31371
diff changeset
    43
    CommandLineError::print(verbose,
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31371
diff changeset
    44
                            "ObjectAlignmentInBytes (" INTX_FORMAT ") must be "
33222
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
    45
                            "less than page size (" INTX_FORMAT ")\n",
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31371
diff changeset
    46
                            value, (intx)os::vm_page_size());
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    47
    return Flag::VIOLATES_CONSTRAINT;
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    48
  }
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    49
  return Flag::SUCCESS;
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    50
}
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    51
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    52
// Need to enforce the padding not to break the existing field alignments.
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    53
// It is sufficient to check against the largest type size.
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31371
diff changeset
    54
Flag::Error ContendedPaddingWidthConstraintFunc(intx value, bool verbose) {
33222
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
    55
  if ((value % BytesPerLong) != 0) {
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31371
diff changeset
    56
    CommandLineError::print(verbose,
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31371
diff changeset
    57
                            "ContendedPaddingWidth (" INTX_FORMAT ") must be "
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31371
diff changeset
    58
                            "a multiple of %d\n",
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 31371
diff changeset
    59
                            value, BytesPerLong);
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    60
    return Flag::VIOLATES_CONSTRAINT;
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    61
  } else {
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    62
    return Flag::SUCCESS;
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    63
  }
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    64
}
33222
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
    65
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
    66
Flag::Error BiasedLockingBulkRebiasThresholdFunc(intx value, bool verbose) {
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
    67
  if (value > BiasedLockingBulkRevokeThreshold) {
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
    68
    CommandLineError::print(verbose,
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
    69
                            "BiasedLockingBulkRebiasThreshold (" INTX_FORMAT ") must be "
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
    70
                            "less than or equal to BiasedLockingBulkRevokeThreshold (" INTX_FORMAT ")\n",
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
    71
                            value, BiasedLockingBulkRevokeThreshold);
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
    72
    return Flag::VIOLATES_CONSTRAINT;
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
    73
  } else {
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
    74
    return Flag::SUCCESS;
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
    75
  }
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
    76
}
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
    77
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
    78
Flag::Error BiasedLockingStartupDelayFunc(intx value, bool verbose) {
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
    79
  if ((value % PeriodicTask::interval_gran) != 0) {
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
    80
    CommandLineError::print(verbose,
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
    81
                            "BiasedLockingStartupDelay (" INTX_FORMAT ") must be "
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
    82
                            "evenly divisible by PeriodicTask::interval_gran (" INTX_FORMAT ")\n",
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
    83
                            value, PeriodicTask::interval_gran);
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
    84
    return Flag::VIOLATES_CONSTRAINT;
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
    85
  } else {
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
    86
    return Flag::SUCCESS;
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
    87
  }
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
    88
}
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
    89
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
    90
Flag::Error BiasedLockingBulkRevokeThresholdFunc(intx value, bool verbose) {
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
    91
  if (value < BiasedLockingBulkRebiasThreshold) {
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
    92
    CommandLineError::print(verbose,
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
    93
                            "BiasedLockingBulkRevokeThreshold (" INTX_FORMAT ") must be "
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
    94
                            "greater than or equal to BiasedLockingBulkRebiasThreshold (" INTX_FORMAT ")\n",
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
    95
                            value, BiasedLockingBulkRebiasThreshold);
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
    96
    return Flag::VIOLATES_CONSTRAINT;
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
    97
  } else if ((double)value/(double)BiasedLockingDecayTime > 0.1) {
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
    98
    CommandLineError::print(verbose,
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
    99
                            "The ratio of BiasedLockingBulkRevokeThreshold (" INTX_FORMAT ")"
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
   100
                            " to BiasedLockingDecayTime (" INTX_FORMAT ") must be "
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
   101
                            "less than or equal to 0.1\n",
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
   102
                            value, BiasedLockingBulkRebiasThreshold);
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
   103
    return Flag::VIOLATES_CONSTRAINT;
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
   104
  } else {
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
   105
    return Flag::SUCCESS;
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
   106
  }
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
   107
}
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
   108
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
   109
Flag::Error BiasedLockingDecayTimeFunc(intx value, bool verbose) {
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
   110
  if (BiasedLockingBulkRebiasThreshold/(double)value > 0.1) {
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
   111
    CommandLineError::print(verbose,
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
   112
                            "The ratio of BiasedLockingBulkRebiasThreshold (" INTX_FORMAT ")"
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
   113
                            " to BiasedLockingDecayTime (" INTX_FORMAT ") must be "
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
   114
                            "less than or equal to 0.1\n",
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
   115
                            BiasedLockingBulkRebiasThreshold, value);
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
   116
    return Flag::VIOLATES_CONSTRAINT;
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
   117
  } else {
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
   118
    return Flag::SUCCESS;
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
   119
  }
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
   120
}
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
   121
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
   122
Flag::Error PerfDataSamplingIntervalFunc(intx value, bool verbose) {
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
   123
  if ((value % PeriodicTask::interval_gran != 0)) {
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
   124
    CommandLineError::print(verbose,
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
   125
                            "PerfDataSamplingInterval (" INTX_FORMAT ") must be "
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
   126
                            "evenly divisible by PeriodicTask::interval_gran (" INTX_FORMAT ")\n",
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
   127
                            value, PeriodicTask::interval_gran);
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
   128
    return Flag::VIOLATES_CONSTRAINT;
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
   129
  } else {
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
   130
    return Flag::SUCCESS;
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
   131
  }
e0a340f4ab6e 8078556: Runtime: implement ranges (optionally constraints) for those flags that have them missing.
gziemski
parents: 32351
diff changeset
   132
}
37212
eee5234b860e 8143958: CDS Shared flags need constraint function
gziemski
parents: 33222
diff changeset
   133
eee5234b860e 8143958: CDS Shared flags need constraint function
gziemski
parents: 33222
diff changeset
   134
static inline Flag::Error sharedConstraintFunc(const char *name, size_t value, size_t taken, bool verbose) {
eee5234b860e 8143958: CDS Shared flags need constraint function
gziemski
parents: 33222
diff changeset
   135
  size_t available = (MAX_SHARED_DELTA-(taken+SHARED_PAGE));
eee5234b860e 8143958: CDS Shared flags need constraint function
gziemski
parents: 33222
diff changeset
   136
  if (value > available) {
eee5234b860e 8143958: CDS Shared flags need constraint function
gziemski
parents: 33222
diff changeset
   137
    CommandLineError::print(verbose,
eee5234b860e 8143958: CDS Shared flags need constraint function
gziemski
parents: 33222
diff changeset
   138
                            "%s (" SIZE_FORMAT ") must be "
eee5234b860e 8143958: CDS Shared flags need constraint function
gziemski
parents: 33222
diff changeset
   139
                            "smaller than or equal to (" SIZE_FORMAT ")\n",
eee5234b860e 8143958: CDS Shared flags need constraint function
gziemski
parents: 33222
diff changeset
   140
                            name, value, available);
eee5234b860e 8143958: CDS Shared flags need constraint function
gziemski
parents: 33222
diff changeset
   141
    return Flag::VIOLATES_CONSTRAINT;
eee5234b860e 8143958: CDS Shared flags need constraint function
gziemski
parents: 33222
diff changeset
   142
  } else {
eee5234b860e 8143958: CDS Shared flags need constraint function
gziemski
parents: 33222
diff changeset
   143
    return Flag::SUCCESS;
eee5234b860e 8143958: CDS Shared flags need constraint function
gziemski
parents: 33222
diff changeset
   144
  }
eee5234b860e 8143958: CDS Shared flags need constraint function
gziemski
parents: 33222
diff changeset
   145
}
eee5234b860e 8143958: CDS Shared flags need constraint function
gziemski
parents: 33222
diff changeset
   146
eee5234b860e 8143958: CDS Shared flags need constraint function
gziemski
parents: 33222
diff changeset
   147
Flag::Error SharedReadWriteSizeConstraintFunc(size_t value, bool verbose) {
eee5234b860e 8143958: CDS Shared flags need constraint function
gziemski
parents: 33222
diff changeset
   148
  size_t taken = (SharedReadOnlySize+SharedMiscDataSize+SharedMiscCodeSize);
eee5234b860e 8143958: CDS Shared flags need constraint function
gziemski
parents: 33222
diff changeset
   149
  return sharedConstraintFunc("SharedReadWriteSize", value, taken, verbose);
eee5234b860e 8143958: CDS Shared flags need constraint function
gziemski
parents: 33222
diff changeset
   150
}
eee5234b860e 8143958: CDS Shared flags need constraint function
gziemski
parents: 33222
diff changeset
   151
eee5234b860e 8143958: CDS Shared flags need constraint function
gziemski
parents: 33222
diff changeset
   152
Flag::Error SharedReadOnlySizeConstraintFunc(size_t value, bool verbose) {
eee5234b860e 8143958: CDS Shared flags need constraint function
gziemski
parents: 33222
diff changeset
   153
  size_t taken = (SharedReadWriteSize+SharedMiscDataSize+SharedMiscCodeSize);
eee5234b860e 8143958: CDS Shared flags need constraint function
gziemski
parents: 33222
diff changeset
   154
  return sharedConstraintFunc("SharedReadOnlySize", value, taken, verbose);
eee5234b860e 8143958: CDS Shared flags need constraint function
gziemski
parents: 33222
diff changeset
   155
}
eee5234b860e 8143958: CDS Shared flags need constraint function
gziemski
parents: 33222
diff changeset
   156
eee5234b860e 8143958: CDS Shared flags need constraint function
gziemski
parents: 33222
diff changeset
   157
Flag::Error SharedMiscDataSizeConstraintFunc(size_t value, bool verbose) {
eee5234b860e 8143958: CDS Shared flags need constraint function
gziemski
parents: 33222
diff changeset
   158
  size_t taken = (SharedReadWriteSize+SharedReadOnlySize+SharedMiscCodeSize);
eee5234b860e 8143958: CDS Shared flags need constraint function
gziemski
parents: 33222
diff changeset
   159
  return sharedConstraintFunc("SharedMiscDataSize", value, taken, verbose);
eee5234b860e 8143958: CDS Shared flags need constraint function
gziemski
parents: 33222
diff changeset
   160
}
eee5234b860e 8143958: CDS Shared flags need constraint function
gziemski
parents: 33222
diff changeset
   161
eee5234b860e 8143958: CDS Shared flags need constraint function
gziemski
parents: 33222
diff changeset
   162
Flag::Error SharedMiscCodeSizeConstraintFunc(size_t value, bool verbose) {
eee5234b860e 8143958: CDS Shared flags need constraint function
gziemski
parents: 33222
diff changeset
   163
  size_t taken = (SharedReadWriteSize+SharedReadOnlySize+SharedMiscDataSize);
eee5234b860e 8143958: CDS Shared flags need constraint function
gziemski
parents: 33222
diff changeset
   164
  return sharedConstraintFunc("SharedMiscCodeSize", value, taken, verbose);
eee5234b860e 8143958: CDS Shared flags need constraint function
gziemski
parents: 33222
diff changeset
   165
}