hotspot/src/share/vm/runtime/commandLineFlagConstraintsCompiler.cpp
author ddmitriev
Mon, 02 Nov 2015 11:32:26 +0300
changeset 33744 8dd886109959
parent 33163 9e128b399e48
child 35751 6a057f120b11
permissions -rw-r--r--
8141042: Typos and refactoring in Compiler constraints functions Reviewed-by: vlivanov, zmajo, kvn
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) {
33744
8dd886109959 8141042: Typos and refactoring in Compiler constraints functions
ddmitriev
parents: 33163
diff changeset
    37
  if ((value <= 1) && (Arguments::mode() == Arguments::_comp || Arguments::mode() == Arguments::_mixed)) {
32351
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 "
33744
8dd886109959 8141042: Typos and refactoring in Compiler constraints functions
ddmitriev
parents: 33163
diff changeset
    40
                            "compatible with -Xcomp or -Xmixed\n",
32351
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) {
33744
8dd886109959 8141042: Typos and refactoring in Compiler constraints functions
ddmitriev
parents: 33163
diff changeset
   121
  if (value < 1 || value > max_jint) {
33163
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 ") "
33744
8dd886109959 8141042: Typos and refactoring in Compiler constraints functions
ddmitriev
parents: 33163
diff changeset
   124
                            "must be between 1 and %d\n",
33163
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 "
33744
8dd886109959 8141042: Typos and refactoring in Compiler constraints functions
ddmitriev
parents: 33163
diff changeset
   209
                            "larger than or equal to CodeEntryAlignment (" INTX_FORMAT ") "
33163
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 "
33744
8dd886109959 8141042: Typos and refactoring in Compiler constraints functions
ddmitriev
parents: 33163
diff changeset
   227
                            "larger than or equal to OptoLoopAlignment (" INTX_FORMAT ") "
33163
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) {
33744
8dd886109959 8141042: Typos and refactoring in Compiler constraints functions
ddmitriev
parents: 33163
diff changeset
   238
#ifdef SOLARIS
8dd886109959 8141042: Typos and refactoring in Compiler constraints functions
ddmitriev
parents: 33163
diff changeset
   239
  if ((value < MinimumPriority || value > MaximumPriority) &&
8dd886109959 8141042: Typos and refactoring in Compiler constraints functions
ddmitriev
parents: 33163
diff changeset
   240
      (value != -1) && (value != -FXCriticalPriority)) {
33163
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   241
    CommandLineError::print(verbose,
33744
8dd886109959 8141042: Typos and refactoring in Compiler constraints functions
ddmitriev
parents: 33163
diff changeset
   242
                            "CompileThreadPriority (" INTX_FORMAT ") must be "
8dd886109959 8141042: Typos and refactoring in Compiler constraints functions
ddmitriev
parents: 33163
diff changeset
   243
                            "between %d and %d inclusively or -1 (means no change) "
8dd886109959 8141042: Typos and refactoring in Compiler constraints functions
ddmitriev
parents: 33163
diff changeset
   244
                            "or %d (special value for critical thread class/priority)\n",
8dd886109959 8141042: Typos and refactoring in Compiler constraints functions
ddmitriev
parents: 33163
diff changeset
   245
                            value, MinimumPriority, MaximumPriority, -FXCriticalPriority);
33163
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   246
    return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   247
  }
33744
8dd886109959 8141042: Typos and refactoring in Compiler constraints functions
ddmitriev
parents: 33163
diff changeset
   248
#endif
33163
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
  return Flag::SUCCESS;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   251
}
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   252
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   253
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
   254
#ifdef SPARC
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   255
  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
   256
    CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   257
                            "CodeEntryAlignment (" INTX_FORMAT ") must be "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   258
                            "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
   259
    return Flag::VIOLATES_CONSTRAINT;
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
#endif
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   262
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   263
  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
   264
    CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   265
                            "CodeEntryAlignment (" INTX_FORMAT ") must be "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   266
                            "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
   267
    return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   268
  }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   269
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   270
  if (CodeEntryAlignment < 16) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   271
      CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   272
                              "CodeEntryAlignment (" INTX_FORMAT ") must be "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   273
                              "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
   274
                              CodeEntryAlignment, 16);
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   275
      return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   276
  }
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
  return Flag::SUCCESS;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   279
}
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   280
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   281
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
   282
  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
   283
    CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   284
                            "OptoLoopAlignment (" INTX_FORMAT ") "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   285
                            "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
   286
                            value);
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   287
    return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   288
  }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   289
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   290
#ifdef SPARC
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   291
  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
   292
    CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   293
                            "OptoLoopAlignment (" INTX_FORMAT ") must be "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   294
                            "multiple of NOP size\n");
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   295
    return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   296
  }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   297
#endif
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   298
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   299
  return Flag::SUCCESS;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   300
}
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   301
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   302
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
   303
  if (value != 0) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   304
    CommandLineError::print(verbose,
33744
8dd886109959 8141042: Typos and refactoring in Compiler constraints functions
ddmitriev
parents: 33163
diff changeset
   305
                            "ArraycopyDstPrefetchDistance (" UINTX_FORMAT ") must be 0\n",
8dd886109959 8141042: Typos and refactoring in Compiler constraints functions
ddmitriev
parents: 33163
diff changeset
   306
                            value);
33163
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   307
    return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   308
  }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   309
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   310
  return Flag::SUCCESS;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   311
}
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   312
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   313
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
   314
  if (value != 0) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   315
    CommandLineError::print(verbose,
33744
8dd886109959 8141042: Typos and refactoring in Compiler constraints functions
ddmitriev
parents: 33163
diff changeset
   316
                            "ArraycopySrcPrefetchDistance (" UINTX_FORMAT ") must be 0\n",
8dd886109959 8141042: Typos and refactoring in Compiler constraints functions
ddmitriev
parents: 33163
diff changeset
   317
                            value);
33163
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   318
    return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   319
  }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   320
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   321
  return Flag::SUCCESS;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   322
}
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
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
   325
  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
   326
    if (value % 10 > 2) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   327
      CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   328
                              "Invalid value (" UINTX_FORMAT ") "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   329
                              "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
   330
      return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   331
    }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   332
    value = value / 10;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   333
  }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   334
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   335
  return Flag::SUCCESS;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   336
}
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
#ifdef COMPILER2
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   339
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
   340
  if (InteriorEntryAlignment > CodeEntryAlignment) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   341
    CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   342
                           "InteriorEntryAlignment (" INTX_FORMAT ") must be "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   343
                           "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
   344
                           InteriorEntryAlignment, CodeEntryAlignment);
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   345
    return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   346
  }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   347
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   348
#ifdef SPARC
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   349
  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
   350
    CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   351
                            "InteriorEntryAlignment (" INTX_FORMAT ") must be "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   352
                            "multiple of NOP size\n");
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   353
    return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   354
  }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   355
#endif
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   356
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   357
  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
   358
     CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   359
                             "InteriorEntryAlignment (" INTX_FORMAT ") must be "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   360
                             "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
   361
     return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   362
   }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   363
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   364
  int minimum_alignment = 16;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   365
#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
   366
  minimum_alignment = 4;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   367
#endif
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   368
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   369
  if (InteriorEntryAlignment < minimum_alignment) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   370
    CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   371
                            "InteriorEntryAlignment (" INTX_FORMAT ") must be "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   372
                            "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
   373
                            InteriorEntryAlignment, minimum_alignment);
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   374
    return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   375
  }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   376
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   377
  return Flag::SUCCESS;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   378
}
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
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
   381
  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
   382
    CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   383
                            "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
   384
                            "of MaxNodeLimit (" INTX_FORMAT ")\n",
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   385
                            MaxNodeLimit);
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   386
    return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   387
  }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   388
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   389
  return Flag::SUCCESS;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   390
}
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   391
#endif // COMPILER2