hotspot/src/share/vm/runtime/commandLineFlagConstraintsCompiler.cpp
author never
Wed, 25 Jan 2017 19:18:43 -0800
changeset 43484 9c95dd31d0da
parent 42063 dca9294d9f59
child 45804 41b19cb98a96
child 46422 6ecc7cc67619
permissions -rw-r--r--
8173309: jvmtiDeferredLocalVariableSet may update the wrong frame Reviewed-by: 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
/*
42063
dca9294d9f59 8166561: [s390] Adaptions needed for s390 port in C1 and C2.
goetz
parents: 38220
diff changeset
     2
 * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
31371
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
     4
 *
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
     7
 * published by the Free Software Foundation.
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
     8
 *
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    13
 * accompanied this code).
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    14
 *
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    18
 *
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    21
 * questions.
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    22
 *
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    23
 */
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    24
311143309e73 8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
diff changeset
    25
#include "precompiled.hpp"
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) {
38220
8d86b82e0ac7 8153340: Disallow misconfiguration and improve the consistency of allocation prefetching
zmajo
parents: 36554
diff changeset
    93
  if (value < 0 || value > 512) {
33163
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
    94
    CommandLineError::print(verbose,
38220
8d86b82e0ac7 8153340: Disallow misconfiguration and improve the consistency of allocation prefetching
zmajo
parents: 36554
diff changeset
    95
                            "AllocatePrefetchDistance (" INTX_FORMAT ") must be "
8d86b82e0ac7 8153340: Disallow misconfiguration and improve the consistency of allocation prefetching
zmajo
parents: 36554
diff changeset
    96
                            "between 0 and " INTX_FORMAT "\n",
8d86b82e0ac7 8153340: Disallow misconfiguration and improve the consistency of allocation prefetching
zmajo
parents: 36554
diff changeset
    97
                            AllocatePrefetchDistance, 512);
33163
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
    98
    return Flag::VIOLATES_CONSTRAINT;
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
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   101
  return Flag::SUCCESS;
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
38220
8d86b82e0ac7 8153340: Disallow misconfiguration and improve the consistency of allocation prefetching
zmajo
parents: 36554
diff changeset
   104
Flag::Error AllocatePrefetchStepSizeConstraintFunc(intx value, bool verbose) {
8d86b82e0ac7 8153340: Disallow misconfiguration and improve the consistency of allocation prefetching
zmajo
parents: 36554
diff changeset
   105
  if (AllocatePrefetchStyle == 3) {
8d86b82e0ac7 8153340: Disallow misconfiguration and improve the consistency of allocation prefetching
zmajo
parents: 36554
diff changeset
   106
    if (value % wordSize != 0) {
8d86b82e0ac7 8153340: Disallow misconfiguration and improve the consistency of allocation prefetching
zmajo
parents: 36554
diff changeset
   107
      CommandLineError::print(verbose,
8d86b82e0ac7 8153340: Disallow misconfiguration and improve the consistency of allocation prefetching
zmajo
parents: 36554
diff changeset
   108
                              "AllocatePrefetchStepSize (" INTX_FORMAT ") must be multiple of %d\n",
8d86b82e0ac7 8153340: Disallow misconfiguration and improve the consistency of allocation prefetching
zmajo
parents: 36554
diff changeset
   109
                              value, wordSize);
8d86b82e0ac7 8153340: Disallow misconfiguration and improve the consistency of allocation prefetching
zmajo
parents: 36554
diff changeset
   110
      return Flag::VIOLATES_CONSTRAINT;
8d86b82e0ac7 8153340: Disallow misconfiguration and improve the consistency of allocation prefetching
zmajo
parents: 36554
diff changeset
   111
    }
8d86b82e0ac7 8153340: Disallow misconfiguration and improve the consistency of allocation prefetching
zmajo
parents: 36554
diff changeset
   112
  }
8d86b82e0ac7 8153340: Disallow misconfiguration and improve the consistency of allocation prefetching
zmajo
parents: 36554
diff changeset
   113
  return Flag::SUCCESS;
8d86b82e0ac7 8153340: Disallow misconfiguration and improve the consistency of allocation prefetching
zmajo
parents: 36554
diff changeset
   114
}
8d86b82e0ac7 8153340: Disallow misconfiguration and improve the consistency of allocation prefetching
zmajo
parents: 36554
diff changeset
   115
33163
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   116
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
   117
  intx max_value = max_intx;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   118
#if defined(SPARC)
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   119
  max_value = 1;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   120
#elif defined(X86)
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   121
  max_value = 3;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   122
#endif
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   123
  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
   124
    CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   125
                            "AllocatePrefetchInstr (" INTX_FORMAT ") must be "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   126
                            "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
   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
  return Flag::SUCCESS;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   131
}
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   132
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   133
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
   134
  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
   135
    CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   136
                            "CompileThreshold (" INTX_FORMAT ") "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   137
                            "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
   138
                            value,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   139
                            INT_MAX >> InvocationCounter::count_shift);
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   140
    return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   141
  }
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
  return Flag::SUCCESS;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   144
}
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   145
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   146
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
   147
  int backward_branch_limit;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   148
  if (ProfileInterpreter) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   149
    if (OnStackReplacePercentage < InterpreterProfilePercentage) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   150
      CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   151
                              "OnStackReplacePercentage (" INTX_FORMAT ") must be "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   152
                              "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
   153
                              OnStackReplacePercentage, InterpreterProfilePercentage);
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   154
      return Flag::VIOLATES_CONSTRAINT;
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
    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
   158
                            << InvocationCounter::count_shift;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   159
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   160
    if (backward_branch_limit < 0) {
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
                              "CompileThreshold * (InterpreterProfilePercentage - OnStackReplacePercentage) / 100 = "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   163
                              INTX_FORMAT " "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   164
                              "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
   165
                              "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
   166
                              (CompileThreshold * (OnStackReplacePercentage - InterpreterProfilePercentage)) / 100,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   167
                              INT_MAX >> InvocationCounter::count_shift);
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   168
      return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   169
    }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   170
  } else {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   171
    if (OnStackReplacePercentage < 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
                              "OnStackReplacePercentage (" INTX_FORMAT ") must be "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   174
                              "non-negative\n", OnStackReplacePercentage);
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   175
      return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   176
    }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   177
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   178
    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
   179
                            << InvocationCounter::count_shift;
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
    if (backward_branch_limit < 0) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   182
      CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   183
                              "CompileThreshold * OnStackReplacePercentage / 100 = " INTX_FORMAT " "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   184
                              "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
   185
                              "CompileThreshold and/or OnStackReplacePercentage\n",
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   186
                              (CompileThreshold * OnStackReplacePercentage) / 100,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   187
                              INT_MAX >> InvocationCounter::count_shift);
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   188
      return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   189
    }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   190
  }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   191
  return Flag::SUCCESS;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   192
}
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   193
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   194
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
   195
  if (CodeCacheSegmentSize < (uintx)CodeEntryAlignment) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   196
    CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   197
                            "CodeCacheSegmentSize  (" UINTX_FORMAT ") must be "
33744
8dd886109959 8141042: Typos and refactoring in Compiler constraints functions
ddmitriev
parents: 33163
diff changeset
   198
                            "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
   199
                            "to align entry points\n",
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   200
                            CodeCacheSegmentSize, CodeEntryAlignment);
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   201
    return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   202
  }
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
  if (CodeCacheSegmentSize < sizeof(jdouble)) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   205
    CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   206
                            "CodeCacheSegmentSize  (" UINTX_FORMAT ") must be "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   207
                            "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
   208
                            CodeCacheSegmentSize, sizeof(jdouble));
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   209
    return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   210
  }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   211
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   212
#ifdef COMPILER2
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   213
  if (CodeCacheSegmentSize < (uintx)OptoLoopAlignment) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   214
    CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   215
                            "CodeCacheSegmentSize  (" UINTX_FORMAT ") must be "
33744
8dd886109959 8141042: Typos and refactoring in Compiler constraints functions
ddmitriev
parents: 33163
diff changeset
   216
                            "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
   217
                            "to align inner loops\n",
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   218
                            CodeCacheSegmentSize, OptoLoopAlignment);
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   219
    return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   220
  }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   221
#endif
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
  return Flag::SUCCESS;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   224
}
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   225
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   226
Flag::Error CompilerThreadPriorityConstraintFunc(intx value, bool verbose) {
33744
8dd886109959 8141042: Typos and refactoring in Compiler constraints functions
ddmitriev
parents: 33163
diff changeset
   227
#ifdef SOLARIS
8dd886109959 8141042: Typos and refactoring in Compiler constraints functions
ddmitriev
parents: 33163
diff changeset
   228
  if ((value < MinimumPriority || value > MaximumPriority) &&
8dd886109959 8141042: Typos and refactoring in Compiler constraints functions
ddmitriev
parents: 33163
diff changeset
   229
      (value != -1) && (value != -FXCriticalPriority)) {
33163
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   230
    CommandLineError::print(verbose,
33744
8dd886109959 8141042: Typos and refactoring in Compiler constraints functions
ddmitriev
parents: 33163
diff changeset
   231
                            "CompileThreadPriority (" INTX_FORMAT ") must be "
8dd886109959 8141042: Typos and refactoring in Compiler constraints functions
ddmitriev
parents: 33163
diff changeset
   232
                            "between %d and %d inclusively or -1 (means no change) "
8dd886109959 8141042: Typos and refactoring in Compiler constraints functions
ddmitriev
parents: 33163
diff changeset
   233
                            "or %d (special value for critical thread class/priority)\n",
8dd886109959 8141042: Typos and refactoring in Compiler constraints functions
ddmitriev
parents: 33163
diff changeset
   234
                            value, MinimumPriority, MaximumPriority, -FXCriticalPriority);
33163
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   235
    return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   236
  }
33744
8dd886109959 8141042: Typos and refactoring in Compiler constraints functions
ddmitriev
parents: 33163
diff changeset
   237
#endif
33163
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   238
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   239
  return Flag::SUCCESS;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   240
}
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   241
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   242
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
   243
#ifdef SPARC
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   244
  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
   245
    CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   246
                            "CodeEntryAlignment (" INTX_FORMAT ") must be "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   247
                            "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
   248
    return Flag::VIOLATES_CONSTRAINT;
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
#endif
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
  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
   253
    CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   254
                            "CodeEntryAlignment (" INTX_FORMAT ") must be "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   255
                            "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
   256
    return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   257
  }
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
  if (CodeEntryAlignment < 16) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   260
      CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   261
                              "CodeEntryAlignment (" INTX_FORMAT ") must be "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   262
                              "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
   263
                              CodeEntryAlignment, 16);
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   264
      return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   265
  }
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
  return Flag::SUCCESS;
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
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
   271
  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
   272
    CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   273
                            "OptoLoopAlignment (" INTX_FORMAT ") "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   274
                            "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
   275
                            value);
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   276
    return Flag::VIOLATES_CONSTRAINT;
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
#ifdef SPARC
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   280
  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
   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 ") must be "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   283
                            "multiple of NOP size\n");
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   284
    return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   285
  }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   286
#endif
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
  return Flag::SUCCESS;
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
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   291
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
   292
  if (value != 0) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   293
    CommandLineError::print(verbose,
33744
8dd886109959 8141042: Typos and refactoring in Compiler constraints functions
ddmitriev
parents: 33163
diff changeset
   294
                            "ArraycopyDstPrefetchDistance (" UINTX_FORMAT ") must be 0\n",
8dd886109959 8141042: Typos and refactoring in Compiler constraints functions
ddmitriev
parents: 33163
diff changeset
   295
                            value);
33163
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   296
    return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   297
  }
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 ArraycopySrcPrefetchDistanceConstraintFunc(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
                            "ArraycopySrcPrefetchDistance (" 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 TypeProfileLevelConstraintFunc(uintx value, bool verbose) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   314
  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
   315
    if (value % 10 > 2) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   316
      CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   317
                              "Invalid value (" UINTX_FORMAT ") "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   318
                              "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
   319
      return Flag::VIOLATES_CONSTRAINT;
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
    value = value / 10;
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
  return Flag::SUCCESS;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   325
}
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   326
36554
a7eb9ee4680c 8146801: Allocating short arrays of non-constant size is slow
shade
parents: 35751
diff changeset
   327
Flag::Error InitArrayShortSizeConstraintFunc(intx value, bool verbose) {
a7eb9ee4680c 8146801: Allocating short arrays of non-constant size is slow
shade
parents: 35751
diff changeset
   328
  if (value % BytesPerLong != 0) {
a7eb9ee4680c 8146801: Allocating short arrays of non-constant size is slow
shade
parents: 35751
diff changeset
   329
    return Flag::VIOLATES_CONSTRAINT;
a7eb9ee4680c 8146801: Allocating short arrays of non-constant size is slow
shade
parents: 35751
diff changeset
   330
  } else {
a7eb9ee4680c 8146801: Allocating short arrays of non-constant size is slow
shade
parents: 35751
diff changeset
   331
    return Flag::SUCCESS;
a7eb9ee4680c 8146801: Allocating short arrays of non-constant size is slow
shade
parents: 35751
diff changeset
   332
  }
a7eb9ee4680c 8146801: Allocating short arrays of non-constant size is slow
shade
parents: 35751
diff changeset
   333
}
a7eb9ee4680c 8146801: Allocating short arrays of non-constant size is slow
shade
parents: 35751
diff changeset
   334
33163
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   335
#ifdef COMPILER2
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   336
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
   337
  if (InteriorEntryAlignment > CodeEntryAlignment) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   338
    CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   339
                           "InteriorEntryAlignment (" INTX_FORMAT ") must be "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   340
                           "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
   341
                           InteriorEntryAlignment, CodeEntryAlignment);
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   342
    return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   343
  }
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   344
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   345
#ifdef SPARC
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   346
  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
   347
    CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   348
                            "InteriorEntryAlignment (" INTX_FORMAT ") must be "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   349
                            "multiple of NOP size\n");
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   350
    return Flag::VIOLATES_CONSTRAINT;
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
#endif
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   353
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   354
  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
   355
     CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   356
                             "InteriorEntryAlignment (" INTX_FORMAT ") must be "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   357
                             "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
   358
     return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   359
   }
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
  int minimum_alignment = 16;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   362
#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
   363
  minimum_alignment = 4;
42063
dca9294d9f59 8166561: [s390] Adaptions needed for s390 port in C1 and C2.
goetz
parents: 38220
diff changeset
   364
#elif defined(S390)
dca9294d9f59 8166561: [s390] Adaptions needed for s390 port in C1 and C2.
goetz
parents: 38220
diff changeset
   365
  minimum_alignment = 2;
33163
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   366
#endif
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
  if (InteriorEntryAlignment < minimum_alignment) {
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   369
    CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   370
                            "InteriorEntryAlignment (" INTX_FORMAT ") must be "
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   371
                            "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
   372
                            InteriorEntryAlignment, minimum_alignment);
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   373
    return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   374
  }
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
  return Flag::SUCCESS;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   377
}
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
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
   380
  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
   381
    CommandLineError::print(verbose,
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   382
                            "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
   383
                            "of MaxNodeLimit (" INTX_FORMAT ")\n",
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   384
                            MaxNodeLimit);
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   385
    return Flag::VIOLATES_CONSTRAINT;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   386
  }
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
  return Flag::SUCCESS;
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   389
}
9e128b399e48 8078554: Compiler: implement ranges (optionally constraints) for those flags that have them missing
zmajo
parents: 33160
diff changeset
   390
#endif // COMPILER2