src/hotspot/share/compiler/compilerDefinitions.cpp
author redestad
Sun, 20 Jan 2019 16:55:21 +0100
changeset 53406 1ffcf6074569
parent 52934 8deeb7bba516
child 53592 8da08ded586f
permissions -rw-r--r--
8217387: Remove dead develop flag CIFireOOMAt Reviewed-by: shade, kbarrett
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
42040
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
     1
/*
50589
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
     2
 * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
42040
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
     4
 *
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
     7
 * published by the Free Software Foundation.
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
     8
 *
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    13
 * accompanied this code).
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    14
 *
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    18
 *
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    21
 * questions.
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    22
 *
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    23
 */
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    24
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    25
#include "precompiled.hpp"
52870
a76b7884b59a 8208277: Code cache heap (-XX:ReservedCodeCacheSize) doesn't work with 1GB LargePages
thartmann
parents: 51002
diff changeset
    26
#include "code/codeCache.hpp"
43455
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
    27
#include "runtime/globals.hpp"
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
    28
#include "runtime/globals_extension.hpp"
42040
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    29
#include "compiler/compilerDefinitions.hpp"
50589
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
    30
#include "gc/shared/gcConfig.hpp"
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
    31
#include "utilities/defaultStream.hpp"
42040
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    32
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    33
const char* compilertype2name_tab[compiler_number_of_types] = {
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    34
  "",
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    35
  "c1",
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    36
  "c2",
47687
fb290fd1f9d4 8171853: Remove Shark compiler
rkennke
parents: 47216
diff changeset
    37
  "jvmci"
42040
70ec5a09a0d5 8166377: is_compiled_by_jvmci hot in some profiles - improve nmethod compiler type detection
neliasso
parents:
diff changeset
    38
};
43455
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
    39
47687
fb290fd1f9d4 8171853: Remove Shark compiler
rkennke
parents: 47216
diff changeset
    40
#if defined(COMPILER2)
43455
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
    41
CompLevel  CompLevel_highest_tier      = CompLevel_full_optimization;  // pure C2 and tiered or JVMCI and tiered
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
    42
#elif defined(COMPILER1)
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
    43
CompLevel  CompLevel_highest_tier      = CompLevel_simple;             // pure C1 or JVMCI
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
    44
#else
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
    45
CompLevel  CompLevel_highest_tier      = CompLevel_none;
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
    46
#endif
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
    47
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
    48
#if defined(TIERED)
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
    49
CompLevel  CompLevel_initial_compile   = CompLevel_full_profile;        // tiered
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
    50
#elif defined(COMPILER1) || INCLUDE_JVMCI
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
    51
CompLevel  CompLevel_initial_compile   = CompLevel_simple;              // pure C1 or JVMCI
47687
fb290fd1f9d4 8171853: Remove Shark compiler
rkennke
parents: 47216
diff changeset
    52
#elif defined(COMPILER2)
43455
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
    53
CompLevel  CompLevel_initial_compile   = CompLevel_full_optimization;   // pure C2
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
    54
#else
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
    55
CompLevel  CompLevel_initial_compile   = CompLevel_none;
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
    56
#endif
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
    57
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
    58
#if defined(COMPILER2)
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
    59
CompMode  Compilation_mode             = CompMode_server;
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
    60
#elif defined(COMPILER1)
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
    61
CompMode  Compilation_mode             = CompMode_client;
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
    62
#else
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
    63
CompMode  Compilation_mode             = CompMode_none;
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
    64
#endif
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
    65
50589
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
    66
// Returns threshold scaled with CompileThresholdScaling
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
    67
intx CompilerConfig::scaled_compile_threshold(intx threshold) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
    68
  return scaled_compile_threshold(threshold, CompileThresholdScaling);
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
    69
}
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
    70
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
    71
// Returns freq_log scaled with CompileThresholdScaling
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
    72
intx CompilerConfig::scaled_freq_log(intx freq_log) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
    73
  return scaled_freq_log(freq_log, CompileThresholdScaling);
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
    74
}
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
    75
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
    76
// Returns threshold scaled with the value of scale.
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
    77
// If scale < 0.0, threshold is returned without scaling.
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
    78
intx CompilerConfig::scaled_compile_threshold(intx threshold, double scale) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
    79
  if (scale == 1.0 || scale < 0.0) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
    80
    return threshold;
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
    81
  } else {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
    82
    return (intx)(threshold * scale);
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
    83
  }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
    84
}
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
    85
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
    86
// Returns freq_log scaled with the value of scale.
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
    87
// Returned values are in the range of [0, InvocationCounter::number_of_count_bits + 1].
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
    88
// If scale < 0.0, freq_log is returned without scaling.
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
    89
intx CompilerConfig::scaled_freq_log(intx freq_log, double scale) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
    90
  // Check if scaling is necessary or if negative value was specified.
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
    91
  if (scale == 1.0 || scale < 0.0) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
    92
    return freq_log;
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
    93
  }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
    94
  // Check values to avoid calculating log2 of 0.
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
    95
  if (scale == 0.0 || freq_log == 0) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
    96
    return 0;
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
    97
  }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
    98
  // Determine the maximum notification frequency value currently supported.
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
    99
  // The largest mask value that the interpreter/C1 can handle is
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   100
  // of length InvocationCounter::number_of_count_bits. Mask values are always
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   101
  // one bit shorter then the value of the notification frequency. Set
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   102
  // max_freq_bits accordingly.
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   103
  intx max_freq_bits = InvocationCounter::number_of_count_bits + 1;
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   104
  intx scaled_freq = scaled_compile_threshold((intx)1 << freq_log, scale);
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   105
  if (scaled_freq == 0) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   106
    // Return 0 right away to avoid calculating log2 of 0.
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   107
    return 0;
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   108
  } else if (scaled_freq > nth_bit(max_freq_bits)) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   109
    return max_freq_bits;
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   110
  } else {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   111
    return log2_intptr(scaled_freq);
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   112
  }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   113
}
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   114
43455
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   115
#ifdef TIERED
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   116
void set_client_compilation_mode() {
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   117
  Compilation_mode = CompMode_client;
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   118
  CompLevel_highest_tier = CompLevel_simple;
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   119
  CompLevel_initial_compile = CompLevel_simple;
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   120
  FLAG_SET_ERGO(bool, TieredCompilation, false);
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   121
  FLAG_SET_ERGO(bool, ProfileInterpreter, false);
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   122
#if INCLUDE_JVMCI
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   123
  FLAG_SET_ERGO(bool, EnableJVMCI, false);
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   124
  FLAG_SET_ERGO(bool, UseJVMCICompiler, false);
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   125
#endif
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   126
#if INCLUDE_AOT
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   127
  FLAG_SET_ERGO(bool, UseAOT, false);
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   128
#endif
43473
3beee3e324cf 8173037: V [jvm.dll+0x2343fc] GraphBuilder::args_list_for_profiling+0x8c
jcm
parents: 43455
diff changeset
   129
  if (FLAG_IS_DEFAULT(NeverActAsServerClassMachine)) {
3beee3e324cf 8173037: V [jvm.dll+0x2343fc] GraphBuilder::args_list_for_profiling+0x8c
jcm
parents: 43455
diff changeset
   130
    FLAG_SET_ERGO(bool, NeverActAsServerClassMachine, true);
3beee3e324cf 8173037: V [jvm.dll+0x2343fc] GraphBuilder::args_list_for_profiling+0x8c
jcm
parents: 43455
diff changeset
   131
  }
43455
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   132
  if (FLAG_IS_DEFAULT(InitialCodeCacheSize)) {
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   133
    FLAG_SET_ERGO(uintx, InitialCodeCacheSize, 160*K);
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   134
  }
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   135
  if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) {
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   136
    FLAG_SET_ERGO(uintx, ReservedCodeCacheSize, 32*M);
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   137
  }
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   138
  if (FLAG_IS_DEFAULT(NonProfiledCodeHeapSize)) {
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   139
    FLAG_SET_ERGO(uintx, NonProfiledCodeHeapSize, 27*M);
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   140
  }
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   141
  if (FLAG_IS_DEFAULT(ProfiledCodeHeapSize)) {
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   142
    FLAG_SET_ERGO(uintx, ProfiledCodeHeapSize, 0);
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   143
  }
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   144
  if (FLAG_IS_DEFAULT(NonNMethodCodeHeapSize)) {
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   145
    FLAG_SET_ERGO(uintx, NonNMethodCodeHeapSize, 5*M);
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   146
  }
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   147
  if (FLAG_IS_DEFAULT(CodeCacheExpansionSize)) {
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   148
    FLAG_SET_ERGO(uintx, CodeCacheExpansionSize, 32*K);
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   149
  }
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   150
  if (FLAG_IS_DEFAULT(MetaspaceSize)) {
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   151
    FLAG_SET_ERGO(size_t, MetaspaceSize, 12*M);
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   152
  }
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   153
  if (FLAG_IS_DEFAULT(MaxRAM)) {
44320
27047c8fa964 8176573: Do not use FLAG_SET_ERGO to update MaxRAM for emulated client
jcm
parents: 43473
diff changeset
   154
    // Do not use FLAG_SET_ERGO to update MaxRAM, as this will impact
27047c8fa964 8176573: Do not use FLAG_SET_ERGO to update MaxRAM for emulated client
jcm
parents: 43473
diff changeset
   155
    // heap setting done based on available phys_mem (see Arguments::set_heap_size).
27047c8fa964 8176573: Do not use FLAG_SET_ERGO to update MaxRAM for emulated client
jcm
parents: 43473
diff changeset
   156
    FLAG_SET_DEFAULT(MaxRAM, 1ULL*G);
43455
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   157
  }
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   158
  if (FLAG_IS_DEFAULT(CompileThreshold)) {
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   159
    FLAG_SET_ERGO(intx, CompileThreshold, 1500);
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   160
  }
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   161
  if (FLAG_IS_DEFAULT(OnStackReplacePercentage)) {
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   162
    FLAG_SET_ERGO(intx, OnStackReplacePercentage, 933);
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   163
  }
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   164
  if (FLAG_IS_DEFAULT(CICompilerCount)) {
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   165
    FLAG_SET_ERGO(intx, CICompilerCount, 1);
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   166
  }
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   167
}
50589
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   168
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   169
bool compilation_mode_selected() {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   170
  return !FLAG_IS_DEFAULT(TieredCompilation) ||
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   171
         !FLAG_IS_DEFAULT(TieredStopAtLevel) ||
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   172
         !FLAG_IS_DEFAULT(UseAOT)
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   173
         JVMCI_ONLY(|| !FLAG_IS_DEFAULT(EnableJVMCI)
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   174
                    || !FLAG_IS_DEFAULT(UseJVMCICompiler));
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   175
}
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   176
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   177
void select_compilation_mode_ergonomically() {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   178
#if defined(_WINDOWS) && !defined(_LP64)
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   179
  if (FLAG_IS_DEFAULT(NeverActAsServerClassMachine)) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   180
    FLAG_SET_ERGO(bool, NeverActAsServerClassMachine, true);
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   181
  }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   182
#endif
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   183
  if (NeverActAsServerClassMachine) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   184
    set_client_compilation_mode();
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   185
  }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   186
}
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   187
43455
96560cffef4d 8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents: 42040
diff changeset
   188
#endif // TIERED
50589
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   189
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   190
void CompilerConfig::set_tiered_flags() {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   191
  // With tiered, set default policy to SimpleThresholdPolicy, which is 2.
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   192
  if (FLAG_IS_DEFAULT(CompilationPolicyChoice)) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   193
    FLAG_SET_DEFAULT(CompilationPolicyChoice, 2);
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   194
  }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   195
  if (CompilationPolicyChoice < 2) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   196
    vm_exit_during_initialization(
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   197
      "Incompatible compilation policy selected", NULL);
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   198
  }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   199
  // Increase the code cache size - tiered compiles a lot more.
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   200
  if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   201
    FLAG_SET_ERGO(uintx, ReservedCodeCacheSize,
50676
8c0a5b51559b 8203030: Zero s390 31 bit size_t type conflicts in shared code
chrisphi
parents: 50589
diff changeset
   202
                  MIN2(CODE_CACHE_DEFAULT_LIMIT, (size_t)ReservedCodeCacheSize * 5));
50589
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   203
  }
52870
a76b7884b59a 8208277: Code cache heap (-XX:ReservedCodeCacheSize) doesn't work with 1GB LargePages
thartmann
parents: 51002
diff changeset
   204
  // Enable SegmentedCodeCache if TieredCompilation is enabled, ReservedCodeCacheSize >= 240M
a76b7884b59a 8208277: Code cache heap (-XX:ReservedCodeCacheSize) doesn't work with 1GB LargePages
thartmann
parents: 51002
diff changeset
   205
  // and the code cache contains at least 8 pages (segmentation disables advantage of huge pages).
a76b7884b59a 8208277: Code cache heap (-XX:ReservedCodeCacheSize) doesn't work with 1GB LargePages
thartmann
parents: 51002
diff changeset
   206
  if (FLAG_IS_DEFAULT(SegmentedCodeCache) && ReservedCodeCacheSize >= 240*M &&
a76b7884b59a 8208277: Code cache heap (-XX:ReservedCodeCacheSize) doesn't work with 1GB LargePages
thartmann
parents: 51002
diff changeset
   207
      8 * CodeCache::page_size() <= ReservedCodeCacheSize) {
50589
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   208
    FLAG_SET_ERGO(bool, SegmentedCodeCache, true);
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   209
  }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   210
  if (!UseInterpreter) { // -Xcomp
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   211
    Tier3InvokeNotifyFreqLog = 0;
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   212
    Tier4InvocationThreshold = 0;
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   213
  }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   214
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   215
  if (CompileThresholdScaling < 0) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   216
    vm_exit_during_initialization("Negative value specified for CompileThresholdScaling", NULL);
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   217
  }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   218
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   219
  // Scale tiered compilation thresholds.
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   220
  // CompileThresholdScaling == 0.0 is equivalent to -Xint and leaves compilation thresholds unchanged.
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   221
  if (!FLAG_IS_DEFAULT(CompileThresholdScaling) && CompileThresholdScaling > 0.0) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   222
    FLAG_SET_ERGO(intx, Tier0InvokeNotifyFreqLog, scaled_freq_log(Tier0InvokeNotifyFreqLog));
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   223
    FLAG_SET_ERGO(intx, Tier0BackedgeNotifyFreqLog, scaled_freq_log(Tier0BackedgeNotifyFreqLog));
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   224
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   225
    FLAG_SET_ERGO(intx, Tier3InvocationThreshold, scaled_compile_threshold(Tier3InvocationThreshold));
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   226
    FLAG_SET_ERGO(intx, Tier3MinInvocationThreshold, scaled_compile_threshold(Tier3MinInvocationThreshold));
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   227
    FLAG_SET_ERGO(intx, Tier3CompileThreshold, scaled_compile_threshold(Tier3CompileThreshold));
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   228
    FLAG_SET_ERGO(intx, Tier3BackEdgeThreshold, scaled_compile_threshold(Tier3BackEdgeThreshold));
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   229
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   230
    // Tier2{Invocation,MinInvocation,Compile,Backedge}Threshold should be scaled here
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   231
    // once these thresholds become supported.
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   232
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   233
    FLAG_SET_ERGO(intx, Tier2InvokeNotifyFreqLog, scaled_freq_log(Tier2InvokeNotifyFreqLog));
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   234
    FLAG_SET_ERGO(intx, Tier2BackedgeNotifyFreqLog, scaled_freq_log(Tier2BackedgeNotifyFreqLog));
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   235
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   236
    FLAG_SET_ERGO(intx, Tier3InvokeNotifyFreqLog, scaled_freq_log(Tier3InvokeNotifyFreqLog));
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   237
    FLAG_SET_ERGO(intx, Tier3BackedgeNotifyFreqLog, scaled_freq_log(Tier3BackedgeNotifyFreqLog));
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   238
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   239
    FLAG_SET_ERGO(intx, Tier23InlineeNotifyFreqLog, scaled_freq_log(Tier23InlineeNotifyFreqLog));
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   240
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   241
    FLAG_SET_ERGO(intx, Tier4InvocationThreshold, scaled_compile_threshold(Tier4InvocationThreshold));
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   242
    FLAG_SET_ERGO(intx, Tier4MinInvocationThreshold, scaled_compile_threshold(Tier4MinInvocationThreshold));
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   243
    FLAG_SET_ERGO(intx, Tier4CompileThreshold, scaled_compile_threshold(Tier4CompileThreshold));
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   244
    FLAG_SET_ERGO(intx, Tier4BackEdgeThreshold, scaled_compile_threshold(Tier4BackEdgeThreshold));
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   245
  }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   246
}
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   247
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   248
#if INCLUDE_JVMCI
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   249
void set_jvmci_specific_flags() {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   250
  if (UseJVMCICompiler) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   251
    Compilation_mode = CompMode_server;
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   252
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   253
    if (FLAG_IS_DEFAULT(TypeProfileWidth)) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   254
      FLAG_SET_DEFAULT(TypeProfileWidth, 8);
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   255
    }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   256
    if (FLAG_IS_DEFAULT(OnStackReplacePercentage)) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   257
      FLAG_SET_DEFAULT(OnStackReplacePercentage, 933);
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   258
    }
51002
0665a966cac6 8193126: Incorrect setting of MetaspaceSize and NewSizeThreadIncrease when using JVMCI compiler
kvn
parents: 50676
diff changeset
   259
    // JVMCI needs values not less than defaults
50589
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   260
    if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) {
51002
0665a966cac6 8193126: Incorrect setting of MetaspaceSize and NewSizeThreadIncrease when using JVMCI compiler
kvn
parents: 50676
diff changeset
   261
      FLAG_SET_DEFAULT(ReservedCodeCacheSize, MAX2(64*M, ReservedCodeCacheSize));
50589
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   262
    }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   263
    if (FLAG_IS_DEFAULT(InitialCodeCacheSize)) {
51002
0665a966cac6 8193126: Incorrect setting of MetaspaceSize and NewSizeThreadIncrease when using JVMCI compiler
kvn
parents: 50676
diff changeset
   264
      FLAG_SET_DEFAULT(InitialCodeCacheSize, MAX2(16*M, InitialCodeCacheSize));
50589
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   265
    }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   266
    if (FLAG_IS_DEFAULT(MetaspaceSize)) {
51002
0665a966cac6 8193126: Incorrect setting of MetaspaceSize and NewSizeThreadIncrease when using JVMCI compiler
kvn
parents: 50676
diff changeset
   267
      FLAG_SET_DEFAULT(MetaspaceSize, MAX2(12*M, MetaspaceSize));
50589
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   268
    }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   269
    if (FLAG_IS_DEFAULT(NewSizeThreadIncrease)) {
51002
0665a966cac6 8193126: Incorrect setting of MetaspaceSize and NewSizeThreadIncrease when using JVMCI compiler
kvn
parents: 50676
diff changeset
   270
      FLAG_SET_DEFAULT(NewSizeThreadIncrease, MAX2(4*K, NewSizeThreadIncrease));
50589
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   271
    }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   272
    if (TieredStopAtLevel != CompLevel_full_optimization) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   273
      // Currently JVMCI compiler can only work at the full optimization level
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   274
      warning("forcing TieredStopAtLevel to full optimization because JVMCI is enabled");
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   275
      FLAG_SET_ERGO(intx, TieredStopAtLevel, CompLevel_full_optimization);
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   276
    }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   277
    if (FLAG_IS_DEFAULT(TypeProfileLevel)) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   278
      FLAG_SET_DEFAULT(TypeProfileLevel, 0);
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   279
    }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   280
  }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   281
}
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   282
#endif // INCLUDE_JVMCI
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   283
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   284
bool CompilerConfig::check_args_consistency(bool status) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   285
  // Check lower bounds of the code cache
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   286
  // Template Interpreter code is approximately 3X larger in debug builds.
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   287
  uint min_code_cache_size = CodeCacheMinimumUseSpace DEBUG_ONLY(* 3);
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   288
  if (ReservedCodeCacheSize < InitialCodeCacheSize) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   289
    jio_fprintf(defaultStream::error_stream(),
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   290
                "Invalid ReservedCodeCacheSize: %dK. Must be at least InitialCodeCacheSize=%dK.\n",
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   291
                ReservedCodeCacheSize/K, InitialCodeCacheSize/K);
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   292
    status = false;
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   293
  } else if (ReservedCodeCacheSize < min_code_cache_size) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   294
    jio_fprintf(defaultStream::error_stream(),
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   295
                "Invalid ReservedCodeCacheSize=%dK. Must be at least %uK.\n", ReservedCodeCacheSize/K,
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   296
                min_code_cache_size/K);
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   297
    status = false;
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   298
  } else if (ReservedCodeCacheSize > CODE_CACHE_SIZE_LIMIT) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   299
    // Code cache size larger than CODE_CACHE_SIZE_LIMIT is not supported.
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   300
    jio_fprintf(defaultStream::error_stream(),
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   301
                "Invalid ReservedCodeCacheSize=%dM. Must be at most %uM.\n", ReservedCodeCacheSize/M,
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   302
                CODE_CACHE_SIZE_LIMIT/M);
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   303
    status = false;
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   304
  } else if (NonNMethodCodeHeapSize < min_code_cache_size) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   305
    jio_fprintf(defaultStream::error_stream(),
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   306
                "Invalid NonNMethodCodeHeapSize=%dK. Must be at least %uK.\n", NonNMethodCodeHeapSize/K,
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   307
                min_code_cache_size/K);
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   308
    status = false;
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   309
  }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   310
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   311
#ifdef _LP64
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   312
  if (!FLAG_IS_DEFAULT(CICompilerCount) && !FLAG_IS_DEFAULT(CICompilerCountPerCPU) && CICompilerCountPerCPU) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   313
    warning("The VM option CICompilerCountPerCPU overrides CICompilerCount.");
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   314
  }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   315
#endif
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   316
52934
8deeb7bba516 8214917: CTW testlibrary shouldn't ignore errors raised by the library itself
iignatyev
parents: 52870
diff changeset
   317
  if (BackgroundCompilation && ReplayCompiles) {
50589
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   318
    if (!FLAG_IS_DEFAULT(BackgroundCompilation)) {
52934
8deeb7bba516 8214917: CTW testlibrary shouldn't ignore errors raised by the library itself
iignatyev
parents: 52870
diff changeset
   319
      warning("BackgroundCompilation disabled due to ReplayCompiles option.");
50589
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   320
    }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   321
    FLAG_SET_CMDLINE(bool, BackgroundCompilation, false);
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   322
  }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   323
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   324
#ifdef COMPILER2
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   325
  if (PostLoopMultiversioning && !RangeCheckElimination) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   326
    if (!FLAG_IS_DEFAULT(PostLoopMultiversioning)) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   327
      warning("PostLoopMultiversioning disabled because RangeCheckElimination is disabled.");
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   328
    }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   329
    FLAG_SET_CMDLINE(bool, PostLoopMultiversioning, false);
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   330
  }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   331
  if (UseCountedLoopSafepoints && LoopStripMiningIter == 0) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   332
    if (!FLAG_IS_DEFAULT(UseCountedLoopSafepoints) || !FLAG_IS_DEFAULT(LoopStripMiningIter)) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   333
      warning("When counted loop safepoints are enabled, LoopStripMiningIter must be at least 1 (a safepoint every 1 iteration): setting it to 1");
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   334
    }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   335
    LoopStripMiningIter = 1;
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   336
  } else if (!UseCountedLoopSafepoints && LoopStripMiningIter > 0) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   337
    if (!FLAG_IS_DEFAULT(UseCountedLoopSafepoints) || !FLAG_IS_DEFAULT(LoopStripMiningIter)) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   338
      warning("Disabling counted safepoints implies no loop strip mining: setting LoopStripMiningIter to 0");
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   339
    }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   340
    LoopStripMiningIter = 0;
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   341
  }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   342
#endif // COMPILER2
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   343
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   344
  if (Arguments::is_interpreter_only()) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   345
    if (UseCompiler) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   346
      if (!FLAG_IS_DEFAULT(UseCompiler)) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   347
        warning("UseCompiler disabled due to -Xint.");
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   348
      }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   349
      FLAG_SET_CMDLINE(bool, UseCompiler, false);
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   350
    }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   351
    if (ProfileInterpreter) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   352
      if (!FLAG_IS_DEFAULT(ProfileInterpreter)) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   353
        warning("ProfileInterpreter disabled due to -Xint.");
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   354
      }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   355
      FLAG_SET_CMDLINE(bool, ProfileInterpreter, false);
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   356
    }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   357
    if (TieredCompilation) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   358
      if (!FLAG_IS_DEFAULT(TieredCompilation)) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   359
        warning("TieredCompilation disabled due to -Xint.");
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   360
      }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   361
      FLAG_SET_CMDLINE(bool, TieredCompilation, false);
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   362
    }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   363
#if INCLUDE_JVMCI
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   364
    if (EnableJVMCI) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   365
      if (!FLAG_IS_DEFAULT(EnableJVMCI) || !FLAG_IS_DEFAULT(UseJVMCICompiler)) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   366
        warning("JVMCI Compiler disabled due to -Xint.");
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   367
      }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   368
      FLAG_SET_CMDLINE(bool, EnableJVMCI, false);
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   369
      FLAG_SET_CMDLINE(bool, UseJVMCICompiler, false);
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   370
    }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   371
#endif
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   372
  } else {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   373
#if INCLUDE_JVMCI
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   374
    status = status && JVMCIGlobals::check_jvmci_flags_are_consistent();
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   375
#endif
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   376
  }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   377
  return status;
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   378
}
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   379
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   380
void CompilerConfig::ergo_initialize() {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   381
  if (Arguments::is_interpreter_only()) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   382
    return; // Nothing to do.
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   383
  }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   384
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   385
#ifdef TIERED
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   386
  if (!compilation_mode_selected()) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   387
    select_compilation_mode_ergonomically();
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   388
  }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   389
#endif
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   390
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   391
#if INCLUDE_JVMCI
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   392
  // Check that JVMCI compiler supports selested GC.
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   393
  // Should be done after GCConfig::initialize() was called.
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   394
  JVMCIGlobals::check_jvmci_supported_gc();
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   395
  set_jvmci_specific_flags();
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   396
#endif
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   397
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   398
  if (TieredCompilation) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   399
    set_tiered_flags();
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   400
  } else {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   401
    int max_compilation_policy_choice = 1;
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   402
#ifdef COMPILER2
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   403
    if (is_server_compilation_mode_vm()) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   404
      max_compilation_policy_choice = 2;
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   405
    }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   406
#endif
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   407
    // Check if the policy is valid.
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   408
    if (CompilationPolicyChoice >= max_compilation_policy_choice) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   409
      vm_exit_during_initialization(
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   410
        "Incompatible compilation policy selected", NULL);
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   411
    }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   412
    // Scale CompileThreshold
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   413
    // CompileThresholdScaling == 0.0 is equivalent to -Xint and leaves CompileThreshold unchanged.
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   414
    if (!FLAG_IS_DEFAULT(CompileThresholdScaling) && CompileThresholdScaling > 0.0) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   415
      FLAG_SET_ERGO(intx, CompileThreshold, scaled_compile_threshold(CompileThreshold));
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   416
    }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   417
  }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   418
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   419
  if (UseOnStackReplacement && !UseLoopCounter) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   420
    warning("On-stack-replacement requires loop counters; enabling loop counters");
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   421
    FLAG_SET_DEFAULT(UseLoopCounter, true);
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   422
  }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   423
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   424
#ifdef COMPILER2
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   425
  if (!EliminateLocks) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   426
    EliminateNestedLocks = false;
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   427
  }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   428
  if (!Inline) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   429
    IncrementalInline = false;
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   430
  }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   431
#ifndef PRODUCT
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   432
  if (!IncrementalInline) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   433
    AlwaysIncrementalInline = false;
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   434
  }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   435
  if (PrintIdealGraphLevel > 0) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   436
    FLAG_SET_ERGO(bool, PrintIdealGraph, true);
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   437
  }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   438
#endif
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   439
  if (!UseTypeSpeculation && FLAG_IS_DEFAULT(TypeProfileLevel)) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   440
    // nothing to use the profiling, turn if off
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   441
    FLAG_SET_DEFAULT(TypeProfileLevel, 0);
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   442
  }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   443
  if (!FLAG_IS_DEFAULT(OptoLoopAlignment) && FLAG_IS_DEFAULT(MaxLoopPad)) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   444
    FLAG_SET_DEFAULT(MaxLoopPad, OptoLoopAlignment-1);
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   445
  }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   446
  if (FLAG_IS_DEFAULT(LoopStripMiningIterShortLoop)) {
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   447
    // blind guess
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   448
    LoopStripMiningIterShortLoop = LoopStripMiningIter / 10;
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   449
  }
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   450
#endif // COMPILER2
e5d741569070 8184349: There should be some verification that EnableJVMCI is disabled if a GC not supporting JVMCI is selected
kvn
parents: 47687
diff changeset
   451
}