hotspot/src/share/vm/runtime/commandLineFlagConstraintsCompiler.cpp
author thartmann
Tue, 03 Nov 2015 09:41:03 +0100
changeset 33628 09241459a8b8
parent 33163 9e128b399e48
child 33744 8dd886109959
permissions -rw-r--r--
8141132: JEP 254: Compact Strings Summary: Adopt a more space-efficient internal representation for strings. Reviewed-by: alanb, bdelsart, coleenp, iklam, jiangli, jrose, kevinw, naoto, pliden, roland, smarks, twisti Contributed-by: Brent Christian <brent.christian@oracle.com>, Vivek Deshpande <vivek.r.deshpande@intel.com>, Tobias Hartmann <tobias.hartmann@oracle.com>, Charlie Hunt <charlie.hunt@oracle.com>, Vladimir Kozlov <vladimir.kozlov@oracle.com>, Roger Riggs <roger.riggs@oracle.com>, Xueming Shen <xueming.shen@oracle.com>, Aleksey Shipilev <aleksey.shipilev@oracle.com>, Sandhya Viswanathan <sandhya.viswanathan@intel.com>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
     1
/*
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
     2
 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
     4
 *
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
     7
 * published by the Free Software Foundation.
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
     8
 *
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    13
 * accompanied this code).
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    14
 *
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    18
 *
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    21
 * questions.
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    22
 *
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    23
 */
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    24
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    25
#include "precompiled.hpp"
33163
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
    26
#include "oops/metadata.hpp"
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
    27
#include "runtime/os.hpp"
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
    28
#include "code/relocInfo.hpp"
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
    29
#include "interpreter/invocationCounter.hpp"
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    30
#include "runtime/arguments.hpp"
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    31
#include "runtime/commandLineFlagConstraintsCompiler.hpp"
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 32087
diff changeset
    32
#include "runtime/commandLineFlagRangeList.hpp"
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    33
#include "runtime/globals.hpp"
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    34
#include "utilities/defaultStream.hpp"
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    35
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 32087
diff changeset
    36
Flag::Error AliasLevelConstraintFunc(intx value, bool verbose) {
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 32087
diff changeset
    37
  if ((value <= 1) && (Arguments::mode() == Arguments::_comp)) {
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 32087
diff changeset
    38
    CommandLineError::print(verbose,
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 32087
diff changeset
    39
                            "AliasLevel (" INTX_FORMAT ") is not "
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 32087
diff changeset
    40
                            "compatible with -Xcomp \n",
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 32087
diff changeset
    41
                            value);
31995
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
    42
    return Flag::VIOLATES_CONSTRAINT;
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
    43
  } else {
aa4049b4184a 8130459: Add additional validation after heap creation
sangheki
parents: 31371
diff changeset
    44
    return Flag::SUCCESS;
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    45
  }
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    46
}
31959
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents: 31371
diff changeset
    47
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents: 31371
diff changeset
    48
/**
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents: 31371
diff changeset
    49
 * Validate the minimum number of compiler threads needed to run the
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents: 31371
diff changeset
    50
 * JVM. The following configurations are possible.
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents: 31371
diff changeset
    51
 *
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents: 31371
diff changeset
    52
 * 1) The JVM is build using an interpreter only. As a result, the minimum number of
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents: 31371
diff changeset
    53
 *    compiler threads is 0.
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents: 31371
diff changeset
    54
 * 2) The JVM is build using the compiler(s) and tiered compilation is disabled. As
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents: 31371
diff changeset
    55
 *    a result, either C1 or C2 is used, so the minimum number of compiler threads is 1.
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents: 31371
diff changeset
    56
 * 3) The JVM is build using the compiler(s) and tiered compilation is enabled. However,
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents: 31371
diff changeset
    57
 *    the option "TieredStopAtLevel < CompLevel_full_optimization". As a result, only
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents: 31371
diff changeset
    58
 *    C1 can be used, so the minimum number of compiler threads is 1.
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents: 31371
diff changeset
    59
 * 4) The JVM is build using the compilers and tiered compilation is enabled. The option
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents: 31371
diff changeset
    60
 *    'TieredStopAtLevel = CompLevel_full_optimization' (the default value). As a result,
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents: 31371
diff changeset
    61
 *    the minimum number of compiler threads is 2.
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents: 31371
diff changeset
    62
 */
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 32087
diff changeset
    63
Flag::Error CICompilerCountConstraintFunc(intx value, bool verbose) {
31959
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents: 31371
diff changeset
    64
  int min_number_of_compiler_threads = 0;
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 32351
diff changeset
    65
#if !defined(COMPILER1) && !defined(COMPILER2) && !defined(SHARK) && !INCLUDE_JVMCI
31959
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents: 31371
diff changeset
    66
  // case 1
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents: 31371
diff changeset
    67
#else
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents: 31371
diff changeset
    68
  if (!TieredCompilation || (TieredStopAtLevel < CompLevel_full_optimization)) {
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents: 31371
diff changeset
    69
    min_number_of_compiler_threads = 1; // case 2 or case 3
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents: 31371
diff changeset
    70
  } else {
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents: 31371
diff changeset
    71
    min_number_of_compiler_threads = 2;   // case 4 (tiered)
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents: 31371
diff changeset
    72
  }
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents: 31371
diff changeset
    73
#endif
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents: 31371
diff changeset
    74
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents: 31371
diff changeset
    75
  // The default CICompilerCount's value is CI_COMPILER_COUNT.
32083
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
    76
  // With a client VM, -XX:+TieredCompilation causes TieredCompilation
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
    77
  // to be true here (the option is validated later) and
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
    78
  // min_number_of_compiler_threads to exceed CI_COMPILER_COUNT.
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
    79
  min_number_of_compiler_threads = MIN2(min_number_of_compiler_threads, CI_COMPILER_COUNT);
31959
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents: 31371
diff changeset
    80
32351
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 32087
diff changeset
    81
  if (value < (intx)min_number_of_compiler_threads) {
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 32087
diff changeset
    82
    CommandLineError::print(verbose,
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 32087
diff changeset
    83
                            "CICompilerCount (" INTX_FORMAT ") must be "
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 32087
diff changeset
    84
                            "at least %d \n",
1da9b960b3d4 8112746: Followup to JDK-8059557 (JEP 245)
gziemski
parents: 32087
diff changeset
    85
                            value, min_number_of_compiler_threads);
31959
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents: 31371
diff changeset
    86
    return Flag::VIOLATES_CONSTRAINT;
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents: 31371
diff changeset
    87
  } else {
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents: 31371
diff changeset
    88
    return Flag::SUCCESS;
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents: 31371
diff changeset
    89
  }
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents: 31371
diff changeset
    90
}
33163
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
    91
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
    92
Flag::Error AllocatePrefetchDistanceConstraintFunc(intx value, bool verbose) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
    93
  if (value < 0) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
    94
    CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
    95
                            "Unable to determine system-specific value for AllocatePrefetchDistance. "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
    96
                            "Please provide appropriate value, if unsure, use 0 to disable prefetching\n");
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
    97
    return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
    98
  }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
    99
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   100
  return Flag::SUCCESS;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   101
}
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   102
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   103
Flag::Error AllocatePrefetchInstrConstraintFunc(intx value, bool verbose) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   104
  intx max_value = max_intx;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   105
#if defined(SPARC)
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   106
  max_value = 1;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   107
#elif defined(X86)
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   108
  max_value = 3;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   109
#endif
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   110
  if (value < 0 || value > max_value) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   111
    CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   112
                            "AllocatePrefetchInstr (" INTX_FORMAT ") must be "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   113
                            "between 0 and " INTX_FORMAT "\n", value, max_value);
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   114
    return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   115
  }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   116
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   117
  return Flag::SUCCESS;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   118
}
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   119
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   120
Flag::Error AllocatePrefetchStepSizeConstraintFunc(intx value, bool verbose) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   121
  if (value < 0 || value > max_jint) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   122
    CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   123
                            "AllocatePrefetchStepSize (" INTX_FORMAT ") "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   124
                            "must be between 0 and %d\n",
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   125
                            AllocatePrefetchStepSize,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   126
                            max_jint);
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   127
    return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   128
  }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   129
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   130
  if (AllocatePrefetchDistance % AllocatePrefetchStepSize != 0) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   131
     CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   132
                             "AllocatePrefetchDistance (" INTX_FORMAT ") "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   133
                             "%% AllocatePrefetchStepSize (" INTX_FORMAT ") "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   134
                             "= " INTX_FORMAT " "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   135
                             "must be 0\n",
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   136
                             AllocatePrefetchDistance, AllocatePrefetchStepSize,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   137
                             AllocatePrefetchDistance % AllocatePrefetchStepSize);
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   138
     return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   139
   }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   140
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   141
   return Flag::SUCCESS;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   142
}
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   143
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   144
Flag::Error CompileThresholdConstraintFunc(intx value, bool verbose) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   145
  if (value < 0 || value > INT_MAX >> InvocationCounter::count_shift) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   146
    CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   147
                            "CompileThreshold (" INTX_FORMAT ") "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   148
                            "must be between 0 and %d\n",
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   149
                            value,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   150
                            INT_MAX >> InvocationCounter::count_shift);
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   151
    return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   152
  }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   153
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   154
  return Flag::SUCCESS;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   155
}
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   156
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   157
Flag::Error OnStackReplacePercentageConstraintFunc(intx value, bool verbose) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   158
  int backward_branch_limit;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   159
  if (ProfileInterpreter) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   160
    if (OnStackReplacePercentage < InterpreterProfilePercentage) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   161
      CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   162
                              "OnStackReplacePercentage (" INTX_FORMAT ") must be "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   163
                              "larger than InterpreterProfilePercentage (" INTX_FORMAT ")\n",
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   164
                              OnStackReplacePercentage, InterpreterProfilePercentage);
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   165
      return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   166
    }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   167
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   168
    backward_branch_limit = ((CompileThreshold * (OnStackReplacePercentage - InterpreterProfilePercentage)) / 100)
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   169
                            << InvocationCounter::count_shift;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   170
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   171
    if (backward_branch_limit < 0) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   172
      CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   173
                              "CompileThreshold * (InterpreterProfilePercentage - OnStackReplacePercentage) / 100 = "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   174
                              INTX_FORMAT " "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   175
                              "must be between 0 and " INTX_FORMAT ", try changing "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   176
                              "CompileThreshold, InterpreterProfilePercentage, and/or OnStackReplacePercentage\n",
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   177
                              (CompileThreshold * (OnStackReplacePercentage - InterpreterProfilePercentage)) / 100,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   178
                              INT_MAX >> InvocationCounter::count_shift);
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   179
      return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   180
    }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   181
  } else {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   182
    if (OnStackReplacePercentage < 0 ) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   183
      CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   184
                              "OnStackReplacePercentage (" INTX_FORMAT ") must be "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   185
                              "non-negative\n", OnStackReplacePercentage);
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   186
      return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   187
    }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   188
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   189
    backward_branch_limit = ((CompileThreshold * OnStackReplacePercentage) / 100)
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   190
                            << InvocationCounter::count_shift;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   191
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   192
    if (backward_branch_limit < 0) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   193
      CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   194
                              "CompileThreshold * OnStackReplacePercentage / 100 = " INTX_FORMAT " "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   195
                              "must be between 0 and " INTX_FORMAT ", try changing "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   196
                              "CompileThreshold and/or OnStackReplacePercentage\n",
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   197
                              (CompileThreshold * OnStackReplacePercentage) / 100,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   198
                              INT_MAX >> InvocationCounter::count_shift);
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   199
      return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   200
    }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   201
  }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   202
  return Flag::SUCCESS;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   203
}
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   204
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   205
Flag::Error CodeCacheSegmentSizeConstraintFunc(uintx value, bool verbose) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   206
  if (CodeCacheSegmentSize < (uintx)CodeEntryAlignment) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   207
    CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   208
                            "CodeCacheSegmentSize  (" UINTX_FORMAT ") must be "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   209
                            "larger than or equal to CodeEntryAlignment (" INTX_FORMAT ")"
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   210
                            "to align entry points\n",
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   211
                            CodeCacheSegmentSize, CodeEntryAlignment);
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   212
    return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   213
  }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   214
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   215
  if (CodeCacheSegmentSize < sizeof(jdouble)) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   216
    CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   217
                            "CodeCacheSegmentSize  (" UINTX_FORMAT ") must be "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   218
                            "at least " SIZE_FORMAT " to align constants\n",
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   219
                            CodeCacheSegmentSize, sizeof(jdouble));
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   220
    return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   221
  }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   222
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   223
#ifdef COMPILER2
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   224
  if (CodeCacheSegmentSize < (uintx)OptoLoopAlignment) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   225
    CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   226
                            "CodeCacheSegmentSize  (" UINTX_FORMAT ") must be "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   227
                            "larger than or equal to OptoLoopAlignment (" INTX_FORMAT ")"
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   228
                            "to align inner loops\n",
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   229
                            CodeCacheSegmentSize, OptoLoopAlignment);
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   230
    return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   231
  }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   232
#endif
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   233
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   234
  return Flag::SUCCESS;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   235
}
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   236
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   237
Flag::Error CompilerThreadPriorityConstraintFunc(intx value, bool verbose) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   238
  if (value < min_jint || value > max_jint) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   239
    CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   240
                            "CompileThreadPriority (" INTX_FORMAT ") "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   241
                            "must be between %d and %d. "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   242
                            "Please also make sure to specify values that are "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   243
                            "meaningful to your operating system\n",
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   244
                            value, min_jint, max_jint);
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   245
    return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   246
  }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   247
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   248
  return Flag::SUCCESS;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   249
}
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   250
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   251
Flag::Error CodeEntryAlignmentConstraintFunc(intx value, bool verbose) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   252
#ifdef SPARC
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   253
  if (CodeEntryAlignment % relocInfo::addr_unit() != 0) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   254
    CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   255
                            "CodeEntryAlignment (" INTX_FORMAT ") must be "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   256
                            "multiple of NOP size\n", CodeEntryAlignment);
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   257
    return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   258
  }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   259
#endif
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   260
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   261
  if (!is_power_of_2(value)) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   262
    CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   263
                            "CodeEntryAlignment (" INTX_FORMAT ") must be "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   264
                            "a power of two\n", CodeEntryAlignment);
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   265
    return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   266
  }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   267
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   268
  if (CodeEntryAlignment < 16) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   269
      CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   270
                              "CodeEntryAlignment (" INTX_FORMAT ") must be "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   271
                              "greater than or equal to %d\n",
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   272
                              CodeEntryAlignment, 16);
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   273
      return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   274
  }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   275
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   276
  return Flag::SUCCESS;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   277
}
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   278
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   279
Flag::Error OptoLoopAlignmentConstraintFunc(intx value, bool verbose) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   280
  if (value < 0 || value > 16) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   281
    CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   282
                            "OptoLoopAlignment (" INTX_FORMAT ") "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   283
                            "must be between 0 and 16\n",
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   284
                            value);
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   285
    return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   286
  }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   287
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   288
  if (!is_power_of_2(value)) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   289
    CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   290
                            "OptoLoopAlignment (" INTX_FORMAT ") "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   291
                            "must be a power of two\n",
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   292
                            value);
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   293
    return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   294
  }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   295
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   296
#ifdef SPARC
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   297
  if (OptoLoopAlignment % relocInfo::addr_unit() != 0) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   298
    CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   299
                            "OptoLoopAlignment (" INTX_FORMAT ") must be "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   300
                            "multiple of NOP size\n");
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   301
    return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   302
  }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   303
#endif
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   304
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   305
  return Flag::SUCCESS;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   306
}
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   307
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   308
Flag::Error ArraycopyDstPrefetchDistanceConstraintFunc(uintx value, bool verbose) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   309
  if (value != 0) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   310
    CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   311
                            "ArraycopyDstPrefetchDistance (" INTX_FORMAT ") must be 0\n");
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   312
    return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   313
  }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   314
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   315
  return Flag::SUCCESS;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   316
}
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   317
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   318
Flag::Error ArraycopySrcPrefetchDistanceConstraintFunc(uintx value, bool verbose) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   319
  if (value != 0) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   320
    CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   321
                            "ArraycopySrcPrefetchDistance (" INTX_FORMAT ") must be 0\n");
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   322
    return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   323
  }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   324
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   325
  return Flag::SUCCESS;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   326
}
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   327
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   328
Flag::Error TypeProfileLevelConstraintFunc(uintx value, bool verbose) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   329
  for (int i = 0; i < 3; i++) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   330
    if (value % 10 > 2) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   331
      CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   332
                              "Invalid value (" UINTX_FORMAT ") "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   333
                              "in TypeProfileLevel at position %d\n", value, i);
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   334
      return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   335
    }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   336
    value = value / 10;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   337
  }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   338
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   339
  return Flag::SUCCESS;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   340
}
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   341
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   342
#ifdef COMPILER2
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   343
Flag::Error InteriorEntryAlignmentConstraintFunc(intx value, bool verbose) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   344
  if (InteriorEntryAlignment > CodeEntryAlignment) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   345
    CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   346
                           "InteriorEntryAlignment (" INTX_FORMAT ") must be "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   347
                           "less than or equal to CodeEntryAlignment (" INTX_FORMAT ")\n",
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   348
                           InteriorEntryAlignment, CodeEntryAlignment);
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   349
    return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   350
  }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   351
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   352
#ifdef SPARC
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   353
  if (InteriorEntryAlignment % relocInfo::addr_unit() != 0) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   354
    CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   355
                            "InteriorEntryAlignment (" INTX_FORMAT ") must be "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   356
                            "multiple of NOP size\n");
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   357
    return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   358
  }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   359
#endif
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   360
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   361
  if (!is_power_of_2(value)) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   362
     CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   363
                             "InteriorEntryAlignment (" INTX_FORMAT ") must be "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   364
                             "a power of two\n", InteriorEntryAlignment);
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   365
     return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   366
   }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   367
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   368
  int minimum_alignment = 16;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   369
#if defined(SPARC) || (defined(X86) && !defined(AMD64))
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   370
  minimum_alignment = 4;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   371
#endif
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   372
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   373
  if (InteriorEntryAlignment < minimum_alignment) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   374
    CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   375
                            "InteriorEntryAlignment (" INTX_FORMAT ") must be "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   376
                            "greater than or equal to %d\n",
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   377
                            InteriorEntryAlignment, minimum_alignment);
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   378
    return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   379
  }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   380
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   381
  return Flag::SUCCESS;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   382
}
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   383
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   384
Flag::Error NodeLimitFudgeFactorConstraintFunc(intx value, bool verbose) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   385
  if (value < MaxNodeLimit * 2 / 100 || value > MaxNodeLimit * 40 / 100) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   386
    CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   387
                            "NodeLimitFudgeFactor must be between 2%% and 40%% "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   388
                            "of MaxNodeLimit (" INTX_FORMAT ")\n",
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   389
                            MaxNodeLimit);
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   390
    return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   391
  }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   392
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   393
  return Flag::SUCCESS;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   394
}
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   395
#endif // COMPILER2