Path: blob/master/src/hotspot/share/compiler/compilerDefinitions.cpp
64440 views
/*1* Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#include "precompiled.hpp"25#include "code/codeCache.hpp"26#include "runtime/arguments.hpp"27#include "runtime/flags/jvmFlag.hpp"28#include "runtime/flags/jvmFlagAccess.hpp"29#include "runtime/flags/jvmFlagLimit.hpp"30#include "runtime/globals.hpp"31#include "runtime/globals_extension.hpp"32#include "compiler/compilerDefinitions.hpp"33#include "gc/shared/gcConfig.hpp"34#include "utilities/defaultStream.hpp"3536const char* compilertype2name_tab[compiler_number_of_types] = {37"",38"c1",39"c2",40"jvmci"41};4243CompilationModeFlag::Mode CompilationModeFlag::_mode = CompilationModeFlag::Mode::NORMAL;4445static void print_mode_unavailable(const char* mode_name, const char* reason) {46warning("%s compilation mode unavailable because %s.", mode_name, reason);47}4849bool CompilationModeFlag::initialize() {50_mode = Mode::NORMAL;51// During parsing we want to be very careful not to use any methods of CompilerConfig that depend on52// CompilationModeFlag.53if (CompilationMode != NULL) {54if (strcmp(CompilationMode, "default") == 0 || strcmp(CompilationMode, "normal") == 0) {55assert(_mode == Mode::NORMAL, "Precondition");56} else if (strcmp(CompilationMode, "quick-only") == 0) {57if (!CompilerConfig::has_c1()) {58print_mode_unavailable("quick-only", "there is no c1 present");59} else {60_mode = Mode::QUICK_ONLY;61}62} else if (strcmp(CompilationMode, "high-only") == 0) {63if (!CompilerConfig::has_c2() && !CompilerConfig::is_jvmci_compiler()) {64print_mode_unavailable("high-only", "there is no c2 or jvmci compiler present");65} else {66_mode = Mode::HIGH_ONLY;67}68} else if (strcmp(CompilationMode, "high-only-quick-internal") == 0) {69if (!CompilerConfig::has_c1() || !CompilerConfig::is_jvmci_compiler()) {70print_mode_unavailable("high-only-quick-internal", "there is no c1 and jvmci compiler present");71} else {72_mode = Mode::HIGH_ONLY_QUICK_INTERNAL;73}74} else {75print_error();76return false;77}78}7980// Now that the flag is parsed, we can use any methods of CompilerConfig.81if (normal()) {82if (CompilerConfig::is_c1_simple_only()) {83_mode = Mode::QUICK_ONLY;84} else if (CompilerConfig::is_c2_or_jvmci_compiler_only()) {85_mode = Mode::HIGH_ONLY;86} else if (CompilerConfig::is_jvmci_compiler_enabled() && CompilerConfig::is_c1_enabled() && !TieredCompilation) {87warning("Disabling tiered compilation with non-native JVMCI compiler is not recommended, "88"disabling intermediate compilation levels instead. ");89_mode = Mode::HIGH_ONLY_QUICK_INTERNAL;90}91}92return true;93}9495void CompilationModeFlag::print_error() {96jio_fprintf(defaultStream::error_stream(), "Unsupported compilation mode '%s', available modes are:", CompilationMode);97bool comma = false;98if (CompilerConfig::has_c1()) {99jio_fprintf(defaultStream::error_stream(), "%s quick-only", comma ? "," : "");100comma = true;101}102if (CompilerConfig::has_c2() || CompilerConfig::has_jvmci()) {103jio_fprintf(defaultStream::error_stream(), "%s high-only", comma ? "," : "");104comma = true;105}106if (CompilerConfig::has_c1() && CompilerConfig::has_jvmci()) {107jio_fprintf(defaultStream::error_stream(), "%s high-only-quick-internal", comma ? "," : "");108comma = true;109}110jio_fprintf(defaultStream::error_stream(), "\n");111}112113// Returns threshold scaled with CompileThresholdScaling114intx CompilerConfig::scaled_compile_threshold(intx threshold) {115return scaled_compile_threshold(threshold, CompileThresholdScaling);116}117118// Returns freq_log scaled with CompileThresholdScaling119intx CompilerConfig::scaled_freq_log(intx freq_log) {120return scaled_freq_log(freq_log, CompileThresholdScaling);121}122123// Returns threshold scaled with the value of scale.124// If scale < 0.0, threshold is returned without scaling.125intx CompilerConfig::scaled_compile_threshold(intx threshold, double scale) {126assert(threshold >= 0, "must be");127if (scale == 1.0 || scale < 0.0) {128return threshold;129} else {130double v = threshold * scale;131assert(v >= 0, "must be");132if (v > max_intx) {133return max_intx;134} else {135return (intx)(v);136}137}138}139140// Returns freq_log scaled with the value of scale.141// Returned values are in the range of [0, InvocationCounter::number_of_count_bits + 1].142// If scale < 0.0, freq_log is returned without scaling.143intx CompilerConfig::scaled_freq_log(intx freq_log, double scale) {144// Check if scaling is necessary or if negative value was specified.145if (scale == 1.0 || scale < 0.0) {146return freq_log;147}148// Check values to avoid calculating log2 of 0.149if (scale == 0.0 || freq_log == 0) {150return 0;151}152// Determine the maximum notification frequency value currently supported.153// The largest mask value that the interpreter/C1 can handle is154// of length InvocationCounter::number_of_count_bits. Mask values are always155// one bit shorter then the value of the notification frequency. Set156// max_freq_bits accordingly.157int max_freq_bits = InvocationCounter::number_of_count_bits + 1;158intx scaled_freq = scaled_compile_threshold((intx)1 << freq_log, scale);159160if (scaled_freq == 0) {161// Return 0 right away to avoid calculating log2 of 0.162return 0;163} else {164return MIN2(log2i(scaled_freq), max_freq_bits);165}166}167168void CompilerConfig::set_client_emulation_mode_flags() {169assert(has_c1(), "Must have C1 compiler present");170CompilationModeFlag::set_quick_only();171172FLAG_SET_ERGO(ProfileInterpreter, false);173#if INCLUDE_JVMCI174FLAG_SET_ERGO(EnableJVMCI, false);175FLAG_SET_ERGO(UseJVMCICompiler, false);176#endif177if (FLAG_IS_DEFAULT(NeverActAsServerClassMachine)) {178FLAG_SET_ERGO(NeverActAsServerClassMachine, true);179}180if (FLAG_IS_DEFAULT(InitialCodeCacheSize)) {181FLAG_SET_ERGO(InitialCodeCacheSize, 160*K);182}183if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) {184FLAG_SET_ERGO(ReservedCodeCacheSize, 32*M);185}186if (FLAG_IS_DEFAULT(NonProfiledCodeHeapSize)) {187FLAG_SET_ERGO(NonProfiledCodeHeapSize, 27*M);188}189if (FLAG_IS_DEFAULT(ProfiledCodeHeapSize)) {190FLAG_SET_ERGO(ProfiledCodeHeapSize, 0);191}192if (FLAG_IS_DEFAULT(NonNMethodCodeHeapSize)) {193FLAG_SET_ERGO(NonNMethodCodeHeapSize, 5*M);194}195if (FLAG_IS_DEFAULT(CodeCacheExpansionSize)) {196FLAG_SET_ERGO(CodeCacheExpansionSize, 32*K);197}198if (FLAG_IS_DEFAULT(MaxRAM)) {199// Do not use FLAG_SET_ERGO to update MaxRAM, as this will impact200// heap setting done based on available phys_mem (see Arguments::set_heap_size).201FLAG_SET_DEFAULT(MaxRAM, 1ULL*G);202}203if (FLAG_IS_DEFAULT(CICompilerCount)) {204FLAG_SET_ERGO(CICompilerCount, 1);205}206}207208bool CompilerConfig::is_compilation_mode_selected() {209return !FLAG_IS_DEFAULT(TieredCompilation) ||210!FLAG_IS_DEFAULT(TieredStopAtLevel) ||211!FLAG_IS_DEFAULT(CompilationMode)212JVMCI_ONLY(|| !FLAG_IS_DEFAULT(EnableJVMCI)213|| !FLAG_IS_DEFAULT(UseJVMCICompiler));214}215216bool CompilerConfig::is_interpreter_only() {217return Arguments::is_interpreter_only() || TieredStopAtLevel == CompLevel_none;218}219220static bool check_legacy_flags() {221JVMFlag* compile_threshold_flag = JVMFlag::flag_from_enum(FLAG_MEMBER_ENUM(CompileThreshold));222if (JVMFlagAccess::check_constraint(compile_threshold_flag, JVMFlagLimit::get_constraint(compile_threshold_flag)->constraint_func(), false) != JVMFlag::SUCCESS) {223return false;224}225JVMFlag* on_stack_replace_percentage_flag = JVMFlag::flag_from_enum(FLAG_MEMBER_ENUM(OnStackReplacePercentage));226if (JVMFlagAccess::check_constraint(on_stack_replace_percentage_flag, JVMFlagLimit::get_constraint(on_stack_replace_percentage_flag)->constraint_func(), false) != JVMFlag::SUCCESS) {227return false;228}229JVMFlag* interpreter_profile_percentage_flag = JVMFlag::flag_from_enum(FLAG_MEMBER_ENUM(InterpreterProfilePercentage));230if (JVMFlagAccess::check_range(interpreter_profile_percentage_flag, false) != JVMFlag::SUCCESS) {231return false;232}233return true;234}235236void CompilerConfig::set_legacy_emulation_flags() {237// Any legacy flags set?238if (!FLAG_IS_DEFAULT(CompileThreshold) ||239!FLAG_IS_DEFAULT(OnStackReplacePercentage) ||240!FLAG_IS_DEFAULT(InterpreterProfilePercentage)) {241if (CompilerConfig::is_c1_only() || CompilerConfig::is_c2_or_jvmci_compiler_only()) {242// This function is called before these flags are validated. In order to not confuse the user with extraneous243// error messages, we check the validity of these flags here and bail out if any of them are invalid.244if (!check_legacy_flags()) {245return;246}247// Note, we do not scale CompileThreshold before this because the tiered flags are248// all going to be scaled further in set_compilation_policy_flags().249const intx threshold = CompileThreshold;250const intx profile_threshold = threshold * InterpreterProfilePercentage / 100;251const intx osr_threshold = threshold * OnStackReplacePercentage / 100;252const intx osr_profile_threshold = osr_threshold * InterpreterProfilePercentage / 100;253254const intx threshold_log = log2i_graceful(CompilerConfig::is_c1_only() ? threshold : profile_threshold);255const intx osr_threshold_log = log2i_graceful(CompilerConfig::is_c1_only() ? osr_threshold : osr_profile_threshold);256257if (Tier0InvokeNotifyFreqLog > threshold_log) {258FLAG_SET_ERGO(Tier0InvokeNotifyFreqLog, MAX2<intx>(0, threshold_log));259}260261// Note: Emulation oddity. The legacy policy limited the amount of callbacks from the262// interpreter for backedge events to once every 1024 counter increments.263// We simulate this behavior by limiting the backedge notification frequency to be264// at least 2^10.265if (Tier0BackedgeNotifyFreqLog > osr_threshold_log) {266FLAG_SET_ERGO(Tier0BackedgeNotifyFreqLog, MAX2<intx>(10, osr_threshold_log));267}268// Adjust the tiered policy flags to approximate the legacy behavior.269FLAG_SET_ERGO(Tier3InvocationThreshold, threshold);270FLAG_SET_ERGO(Tier3MinInvocationThreshold, threshold);271FLAG_SET_ERGO(Tier3CompileThreshold, threshold);272FLAG_SET_ERGO(Tier3BackEdgeThreshold, osr_threshold);273if (CompilerConfig::is_c2_or_jvmci_compiler_only()) {274FLAG_SET_ERGO(Tier4InvocationThreshold, threshold);275FLAG_SET_ERGO(Tier4MinInvocationThreshold, threshold);276FLAG_SET_ERGO(Tier4CompileThreshold, threshold);277FLAG_SET_ERGO(Tier4BackEdgeThreshold, osr_threshold);278FLAG_SET_ERGO(Tier0ProfilingStartPercentage, InterpreterProfilePercentage);279}280} else {281// Normal tiered mode, ignore legacy flags282}283}284// Scale CompileThreshold285// CompileThresholdScaling == 0.0 is equivalent to -Xint and leaves CompileThreshold unchanged.286if (!FLAG_IS_DEFAULT(CompileThresholdScaling) && CompileThresholdScaling > 0.0 && CompileThreshold > 0) {287FLAG_SET_ERGO(CompileThreshold, scaled_compile_threshold(CompileThreshold));288}289}290291292void CompilerConfig::set_compilation_policy_flags() {293if (is_tiered()) {294// Increase the code cache size - tiered compiles a lot more.295if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) {296FLAG_SET_ERGO(ReservedCodeCacheSize,297MIN2(CODE_CACHE_DEFAULT_LIMIT, (size_t)ReservedCodeCacheSize * 5));298}299// Enable SegmentedCodeCache if tiered compilation is enabled, ReservedCodeCacheSize >= 240M300// and the code cache contains at least 8 pages (segmentation disables advantage of huge pages).301if (FLAG_IS_DEFAULT(SegmentedCodeCache) && ReservedCodeCacheSize >= 240*M &&3028 * CodeCache::page_size() <= ReservedCodeCacheSize) {303FLAG_SET_ERGO(SegmentedCodeCache, true);304}305if (Arguments::is_compiler_only()) { // -Xcomp306// Be much more aggressive in tiered mode with -Xcomp and exercise C2 more.307// We will first compile a level 3 version (C1 with full profiling), then do one invocation of it and308// compile a level 4 (C2) and then continue executing it.309if (FLAG_IS_DEFAULT(Tier3InvokeNotifyFreqLog)) {310FLAG_SET_CMDLINE(Tier3InvokeNotifyFreqLog, 0);311}312if (FLAG_IS_DEFAULT(Tier4InvocationThreshold)) {313FLAG_SET_CMDLINE(Tier4InvocationThreshold, 0);314}315}316}317318319if (CompileThresholdScaling < 0) {320vm_exit_during_initialization("Negative value specified for CompileThresholdScaling", NULL);321}322323if (CompilationModeFlag::disable_intermediate()) {324if (FLAG_IS_DEFAULT(Tier0ProfilingStartPercentage)) {325FLAG_SET_DEFAULT(Tier0ProfilingStartPercentage, 33);326}327328if (FLAG_IS_DEFAULT(Tier4InvocationThreshold)) {329FLAG_SET_DEFAULT(Tier4InvocationThreshold, 5000);330}331if (FLAG_IS_DEFAULT(Tier4MinInvocationThreshold)) {332FLAG_SET_DEFAULT(Tier4MinInvocationThreshold, 600);333}334if (FLAG_IS_DEFAULT(Tier4CompileThreshold)) {335FLAG_SET_DEFAULT(Tier4CompileThreshold, 10000);336}337if (FLAG_IS_DEFAULT(Tier4BackEdgeThreshold)) {338FLAG_SET_DEFAULT(Tier4BackEdgeThreshold, 15000);339}340341if (FLAG_IS_DEFAULT(Tier3InvocationThreshold)) {342FLAG_SET_DEFAULT(Tier3InvocationThreshold, Tier4InvocationThreshold);343}344if (FLAG_IS_DEFAULT(Tier3MinInvocationThreshold)) {345FLAG_SET_DEFAULT(Tier3MinInvocationThreshold, Tier4MinInvocationThreshold);346}347if (FLAG_IS_DEFAULT(Tier3CompileThreshold)) {348FLAG_SET_DEFAULT(Tier3CompileThreshold, Tier4CompileThreshold);349}350if (FLAG_IS_DEFAULT(Tier3BackEdgeThreshold)) {351FLAG_SET_DEFAULT(Tier3BackEdgeThreshold, Tier4BackEdgeThreshold);352}353354}355356// Scale tiered compilation thresholds.357// CompileThresholdScaling == 0.0 is equivalent to -Xint and leaves compilation thresholds unchanged.358if (!FLAG_IS_DEFAULT(CompileThresholdScaling) && CompileThresholdScaling > 0.0) {359FLAG_SET_ERGO(Tier0InvokeNotifyFreqLog, scaled_freq_log(Tier0InvokeNotifyFreqLog));360FLAG_SET_ERGO(Tier0BackedgeNotifyFreqLog, scaled_freq_log(Tier0BackedgeNotifyFreqLog));361362FLAG_SET_ERGO(Tier3InvocationThreshold, scaled_compile_threshold(Tier3InvocationThreshold));363FLAG_SET_ERGO(Tier3MinInvocationThreshold, scaled_compile_threshold(Tier3MinInvocationThreshold));364FLAG_SET_ERGO(Tier3CompileThreshold, scaled_compile_threshold(Tier3CompileThreshold));365FLAG_SET_ERGO(Tier3BackEdgeThreshold, scaled_compile_threshold(Tier3BackEdgeThreshold));366367// Tier2{Invocation,MinInvocation,Compile,Backedge}Threshold should be scaled here368// once these thresholds become supported.369370FLAG_SET_ERGO(Tier2InvokeNotifyFreqLog, scaled_freq_log(Tier2InvokeNotifyFreqLog));371FLAG_SET_ERGO(Tier2BackedgeNotifyFreqLog, scaled_freq_log(Tier2BackedgeNotifyFreqLog));372373FLAG_SET_ERGO(Tier3InvokeNotifyFreqLog, scaled_freq_log(Tier3InvokeNotifyFreqLog));374FLAG_SET_ERGO(Tier3BackedgeNotifyFreqLog, scaled_freq_log(Tier3BackedgeNotifyFreqLog));375376FLAG_SET_ERGO(Tier23InlineeNotifyFreqLog, scaled_freq_log(Tier23InlineeNotifyFreqLog));377378FLAG_SET_ERGO(Tier4InvocationThreshold, scaled_compile_threshold(Tier4InvocationThreshold));379FLAG_SET_ERGO(Tier4MinInvocationThreshold, scaled_compile_threshold(Tier4MinInvocationThreshold));380FLAG_SET_ERGO(Tier4CompileThreshold, scaled_compile_threshold(Tier4CompileThreshold));381FLAG_SET_ERGO(Tier4BackEdgeThreshold, scaled_compile_threshold(Tier4BackEdgeThreshold));382}383384#ifdef COMPILER1385// Reduce stack usage due to inlining of methods which require much stack.386// (High tier compiler can inline better based on profiling information.)387if (FLAG_IS_DEFAULT(C1InlineStackLimit) &&388TieredStopAtLevel == CompLevel_full_optimization && !CompilerConfig::is_c1_only()) {389FLAG_SET_DEFAULT(C1InlineStackLimit, 5);390}391#endif392393if (CompilerConfig::is_tiered() && CompilerConfig::is_c2_enabled()) {394#ifdef COMPILER2395// Some inlining tuning396#ifdef X86397if (FLAG_IS_DEFAULT(InlineSmallCode)) {398FLAG_SET_DEFAULT(InlineSmallCode, 2500);399}400#endif401402#if defined AARCH64403if (FLAG_IS_DEFAULT(InlineSmallCode)) {404FLAG_SET_DEFAULT(InlineSmallCode, 2500);405}406#endif407#endif // COMPILER2408}409410}411412#if INCLUDE_JVMCI413void CompilerConfig::set_jvmci_specific_flags() {414if (UseJVMCICompiler) {415if (FLAG_IS_DEFAULT(TypeProfileWidth)) {416FLAG_SET_DEFAULT(TypeProfileWidth, 8);417}418if (FLAG_IS_DEFAULT(TypeProfileLevel)) {419FLAG_SET_DEFAULT(TypeProfileLevel, 0);420}421422if (UseJVMCINativeLibrary) {423// SVM compiled code requires more stack space424if (FLAG_IS_DEFAULT(CompilerThreadStackSize)) {425// Duplicate logic in the implementations of os::create_thread426// so that we can then double the computed stack size. Once427// the stack size requirements of SVM are better understood,428// this logic can be pushed down into os::create_thread.429int stack_size = CompilerThreadStackSize;430if (stack_size == 0) {431stack_size = VMThreadStackSize;432}433if (stack_size != 0) {434FLAG_SET_DEFAULT(CompilerThreadStackSize, stack_size * 2);435}436}437} else {438// JVMCI needs values not less than defaults439if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) {440FLAG_SET_DEFAULT(ReservedCodeCacheSize, MAX2(64*M, ReservedCodeCacheSize));441}442if (FLAG_IS_DEFAULT(InitialCodeCacheSize)) {443FLAG_SET_DEFAULT(InitialCodeCacheSize, MAX2(16*M, InitialCodeCacheSize));444}445if (FLAG_IS_DEFAULT(NewSizeThreadIncrease)) {446FLAG_SET_DEFAULT(NewSizeThreadIncrease, MAX2(4*K, NewSizeThreadIncrease));447}448if (FLAG_IS_DEFAULT(Tier3DelayOn)) {449// This effectively prevents the compile broker scheduling tier 2450// (i.e., limited C1 profiling) compilations instead of tier 3451// (i.e., full C1 profiling) compilations when the tier 4 queue452// backs up (which is quite likely when using a non-AOT compiled JVMCI453// compiler). The observation based on jargraal is that the downside454// of skipping full profiling is much worse for performance than the455// queue backing up.456FLAG_SET_DEFAULT(Tier3DelayOn, 100000);457}458} // !UseJVMCINativeLibrary459} // UseJVMCICompiler460}461#endif // INCLUDE_JVMCI462463bool CompilerConfig::check_args_consistency(bool status) {464// Check lower bounds of the code cache465// Template Interpreter code is approximately 3X larger in debug builds.466uint min_code_cache_size = CodeCacheMinimumUseSpace DEBUG_ONLY(* 3);467if (ReservedCodeCacheSize < InitialCodeCacheSize) {468jio_fprintf(defaultStream::error_stream(),469"Invalid ReservedCodeCacheSize: %dK. Must be at least InitialCodeCacheSize=%dK.\n",470ReservedCodeCacheSize/K, InitialCodeCacheSize/K);471status = false;472} else if (ReservedCodeCacheSize < min_code_cache_size) {473jio_fprintf(defaultStream::error_stream(),474"Invalid ReservedCodeCacheSize=%dK. Must be at least %uK.\n", ReservedCodeCacheSize/K,475min_code_cache_size/K);476status = false;477} else if (ReservedCodeCacheSize > CODE_CACHE_SIZE_LIMIT) {478// Code cache size larger than CODE_CACHE_SIZE_LIMIT is not supported.479jio_fprintf(defaultStream::error_stream(),480"Invalid ReservedCodeCacheSize=%dM. Must be at most %uM.\n", ReservedCodeCacheSize/M,481CODE_CACHE_SIZE_LIMIT/M);482status = false;483} else if (NonNMethodCodeHeapSize < min_code_cache_size) {484jio_fprintf(defaultStream::error_stream(),485"Invalid NonNMethodCodeHeapSize=%dK. Must be at least %uK.\n", NonNMethodCodeHeapSize/K,486min_code_cache_size/K);487status = false;488}489490#ifdef _LP64491if (!FLAG_IS_DEFAULT(CICompilerCount) && !FLAG_IS_DEFAULT(CICompilerCountPerCPU) && CICompilerCountPerCPU) {492warning("The VM option CICompilerCountPerCPU overrides CICompilerCount.");493}494#endif495496if (BackgroundCompilation && ReplayCompiles) {497if (!FLAG_IS_DEFAULT(BackgroundCompilation)) {498warning("BackgroundCompilation disabled due to ReplayCompiles option.");499}500FLAG_SET_CMDLINE(BackgroundCompilation, false);501}502503#ifdef COMPILER2504if (PostLoopMultiversioning && !RangeCheckElimination) {505if (!FLAG_IS_DEFAULT(PostLoopMultiversioning)) {506warning("PostLoopMultiversioning disabled because RangeCheckElimination is disabled.");507}508FLAG_SET_CMDLINE(PostLoopMultiversioning, false);509}510#endif // COMPILER2511512if (CompilerConfig::is_interpreter_only()) {513if (UseCompiler) {514if (!FLAG_IS_DEFAULT(UseCompiler)) {515warning("UseCompiler disabled due to -Xint.");516}517FLAG_SET_CMDLINE(UseCompiler, false);518}519if (ProfileInterpreter) {520if (!FLAG_IS_DEFAULT(ProfileInterpreter)) {521warning("ProfileInterpreter disabled due to -Xint.");522}523FLAG_SET_CMDLINE(ProfileInterpreter, false);524}525if (TieredCompilation) {526if (!FLAG_IS_DEFAULT(TieredCompilation)) {527warning("TieredCompilation disabled due to -Xint.");528}529FLAG_SET_CMDLINE(TieredCompilation, false);530}531#if INCLUDE_JVMCI532if (EnableJVMCI) {533if (!FLAG_IS_DEFAULT(EnableJVMCI) || !FLAG_IS_DEFAULT(UseJVMCICompiler)) {534warning("JVMCI Compiler disabled due to -Xint.");535}536FLAG_SET_CMDLINE(EnableJVMCI, false);537FLAG_SET_CMDLINE(UseJVMCICompiler, false);538}539#endif540} else {541#if INCLUDE_JVMCI542status = status && JVMCIGlobals::check_jvmci_flags_are_consistent();543#endif544}545546return status;547}548549void CompilerConfig::ergo_initialize() {550#if !COMPILER1_OR_COMPILER2551return;552#endif553554if (has_c1()) {555if (!is_compilation_mode_selected()) {556#if defined(_WINDOWS) && !defined(_LP64)557if (FLAG_IS_DEFAULT(NeverActAsServerClassMachine)) {558FLAG_SET_ERGO(NeverActAsServerClassMachine, true);559}560#endif561if (NeverActAsServerClassMachine) {562set_client_emulation_mode_flags();563}564} else if (!has_c2() && !is_jvmci_compiler()) {565set_client_emulation_mode_flags();566}567}568569set_legacy_emulation_flags();570set_compilation_policy_flags();571572#if INCLUDE_JVMCI573// Check that JVMCI supports selected GC.574// Should be done after GCConfig::initialize() was called.575JVMCIGlobals::check_jvmci_supported_gc();576577// Do JVMCI specific settings578set_jvmci_specific_flags();579#endif580581if (FLAG_IS_DEFAULT(SweeperThreshold)) {582if ((SweeperThreshold * ReservedCodeCacheSize / 100) > (1.2 * M)) {583// Cap default SweeperThreshold value to an equivalent of 1.2 Mb584FLAG_SET_ERGO(SweeperThreshold, (1.2 * M * 100) / ReservedCodeCacheSize);585}586}587588if (UseOnStackReplacement && !UseLoopCounter) {589warning("On-stack-replacement requires loop counters; enabling loop counters");590FLAG_SET_DEFAULT(UseLoopCounter, true);591}592593if (ProfileInterpreter && CompilerConfig::is_c1_simple_only()) {594if (!FLAG_IS_DEFAULT(ProfileInterpreter)) {595warning("ProfileInterpreter disabled due to client emulation mode");596}597FLAG_SET_CMDLINE(ProfileInterpreter, false);598}599600#ifdef COMPILER2601if (!EliminateLocks) {602EliminateNestedLocks = false;603}604if (!Inline || !IncrementalInline) {605IncrementalInline = false;606IncrementalInlineMH = false;607IncrementalInlineVirtual = false;608}609#ifndef PRODUCT610if (!IncrementalInline) {611AlwaysIncrementalInline = false;612}613if (FLAG_IS_CMDLINE(PrintIdealGraph) && !PrintIdealGraph) {614FLAG_SET_ERGO(PrintIdealGraphLevel, -1);615}616#endif617if (!UseTypeSpeculation && FLAG_IS_DEFAULT(TypeProfileLevel)) {618// nothing to use the profiling, turn if off619FLAG_SET_DEFAULT(TypeProfileLevel, 0);620}621if (!FLAG_IS_DEFAULT(OptoLoopAlignment) && FLAG_IS_DEFAULT(MaxLoopPad)) {622FLAG_SET_DEFAULT(MaxLoopPad, OptoLoopAlignment-1);623}624if (FLAG_IS_DEFAULT(LoopStripMiningIterShortLoop)) {625// blind guess626LoopStripMiningIterShortLoop = LoopStripMiningIter / 10;627}628#endif // COMPILER2629}630631632633