Path: blob/master/src/hotspot/share/compiler/compilerDefinitions.cpp
40930 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) {126if (scale == 1.0 || scale < 0.0) {127return threshold;128} else {129return (intx)(threshold * scale);130}131}132133// Returns freq_log scaled with the value of scale.134// Returned values are in the range of [0, InvocationCounter::number_of_count_bits + 1].135// If scale < 0.0, freq_log is returned without scaling.136intx CompilerConfig::scaled_freq_log(intx freq_log, double scale) {137// Check if scaling is necessary or if negative value was specified.138if (scale == 1.0 || scale < 0.0) {139return freq_log;140}141// Check values to avoid calculating log2 of 0.142if (scale == 0.0 || freq_log == 0) {143return 0;144}145// Determine the maximum notification frequency value currently supported.146// The largest mask value that the interpreter/C1 can handle is147// of length InvocationCounter::number_of_count_bits. Mask values are always148// one bit shorter then the value of the notification frequency. Set149// max_freq_bits accordingly.150int max_freq_bits = InvocationCounter::number_of_count_bits + 1;151intx scaled_freq = scaled_compile_threshold((intx)1 << freq_log, scale);152153if (scaled_freq == 0) {154// Return 0 right away to avoid calculating log2 of 0.155return 0;156} else {157return MIN2(log2i(scaled_freq), max_freq_bits);158}159}160161void CompilerConfig::set_client_emulation_mode_flags() {162assert(has_c1(), "Must have C1 compiler present");163CompilationModeFlag::set_quick_only();164165FLAG_SET_ERGO(ProfileInterpreter, false);166#if INCLUDE_JVMCI167FLAG_SET_ERGO(EnableJVMCI, false);168FLAG_SET_ERGO(UseJVMCICompiler, false);169#endif170if (FLAG_IS_DEFAULT(NeverActAsServerClassMachine)) {171FLAG_SET_ERGO(NeverActAsServerClassMachine, true);172}173if (FLAG_IS_DEFAULT(InitialCodeCacheSize)) {174FLAG_SET_ERGO(InitialCodeCacheSize, 160*K);175}176if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) {177FLAG_SET_ERGO(ReservedCodeCacheSize, 32*M);178}179if (FLAG_IS_DEFAULT(NonProfiledCodeHeapSize)) {180FLAG_SET_ERGO(NonProfiledCodeHeapSize, 27*M);181}182if (FLAG_IS_DEFAULT(ProfiledCodeHeapSize)) {183FLAG_SET_ERGO(ProfiledCodeHeapSize, 0);184}185if (FLAG_IS_DEFAULT(NonNMethodCodeHeapSize)) {186FLAG_SET_ERGO(NonNMethodCodeHeapSize, 5*M);187}188if (FLAG_IS_DEFAULT(CodeCacheExpansionSize)) {189FLAG_SET_ERGO(CodeCacheExpansionSize, 32*K);190}191if (FLAG_IS_DEFAULT(MaxRAM)) {192// Do not use FLAG_SET_ERGO to update MaxRAM, as this will impact193// heap setting done based on available phys_mem (see Arguments::set_heap_size).194FLAG_SET_DEFAULT(MaxRAM, 1ULL*G);195}196if (FLAG_IS_DEFAULT(CICompilerCount)) {197FLAG_SET_ERGO(CICompilerCount, 1);198}199}200201bool CompilerConfig::is_compilation_mode_selected() {202return !FLAG_IS_DEFAULT(TieredCompilation) ||203!FLAG_IS_DEFAULT(TieredStopAtLevel) ||204!FLAG_IS_DEFAULT(CompilationMode)205JVMCI_ONLY(|| !FLAG_IS_DEFAULT(EnableJVMCI)206|| !FLAG_IS_DEFAULT(UseJVMCICompiler));207}208209bool CompilerConfig::is_interpreter_only() {210return Arguments::is_interpreter_only() || TieredStopAtLevel == CompLevel_none;211}212213static bool check_legacy_flags() {214JVMFlag* compile_threshold_flag = JVMFlag::flag_from_enum(FLAG_MEMBER_ENUM(CompileThreshold));215if (JVMFlagAccess::check_constraint(compile_threshold_flag, JVMFlagLimit::get_constraint(compile_threshold_flag)->constraint_func(), false) != JVMFlag::SUCCESS) {216return false;217}218JVMFlag* on_stack_replace_percentage_flag = JVMFlag::flag_from_enum(FLAG_MEMBER_ENUM(OnStackReplacePercentage));219if (JVMFlagAccess::check_constraint(on_stack_replace_percentage_flag, JVMFlagLimit::get_constraint(on_stack_replace_percentage_flag)->constraint_func(), false) != JVMFlag::SUCCESS) {220return false;221}222JVMFlag* interpreter_profile_percentage_flag = JVMFlag::flag_from_enum(FLAG_MEMBER_ENUM(InterpreterProfilePercentage));223if (JVMFlagAccess::check_range(interpreter_profile_percentage_flag, false) != JVMFlag::SUCCESS) {224return false;225}226return true;227}228229void CompilerConfig::set_legacy_emulation_flags() {230// Any legacy flags set?231if (!FLAG_IS_DEFAULT(CompileThreshold) ||232!FLAG_IS_DEFAULT(OnStackReplacePercentage) ||233!FLAG_IS_DEFAULT(InterpreterProfilePercentage)) {234if (CompilerConfig::is_c1_only() || CompilerConfig::is_c2_or_jvmci_compiler_only()) {235// This function is called before these flags are validated. In order to not confuse the user with extraneous236// error messages, we check the validity of these flags here and bail out if any of them are invalid.237if (!check_legacy_flags()) {238return;239}240// Note, we do not scale CompileThreshold before this because the tiered flags are241// all going to be scaled further in set_compilation_policy_flags().242const intx threshold = CompileThreshold;243const intx profile_threshold = threshold * InterpreterProfilePercentage / 100;244const intx osr_threshold = threshold * OnStackReplacePercentage / 100;245const intx osr_profile_threshold = osr_threshold * InterpreterProfilePercentage / 100;246247const intx threshold_log = log2i_graceful(CompilerConfig::is_c1_only() ? threshold : profile_threshold);248const intx osr_threshold_log = log2i_graceful(CompilerConfig::is_c1_only() ? osr_threshold : osr_profile_threshold);249250if (Tier0InvokeNotifyFreqLog > threshold_log) {251FLAG_SET_ERGO(Tier0InvokeNotifyFreqLog, MAX2<intx>(0, threshold_log));252}253254// Note: Emulation oddity. The legacy policy limited the amount of callbacks from the255// interpreter for backedge events to once every 1024 counter increments.256// We simulate this behavior by limiting the backedge notification frequency to be257// at least 2^10.258if (Tier0BackedgeNotifyFreqLog > osr_threshold_log) {259FLAG_SET_ERGO(Tier0BackedgeNotifyFreqLog, MAX2<intx>(10, osr_threshold_log));260}261// Adjust the tiered policy flags to approximate the legacy behavior.262if (CompilerConfig::is_c1_only()) {263FLAG_SET_ERGO(Tier3InvocationThreshold, threshold);264FLAG_SET_ERGO(Tier3MinInvocationThreshold, threshold);265FLAG_SET_ERGO(Tier3CompileThreshold, threshold);266FLAG_SET_ERGO(Tier3BackEdgeThreshold, osr_threshold);267} else {268FLAG_SET_ERGO(Tier4InvocationThreshold, threshold);269FLAG_SET_ERGO(Tier4MinInvocationThreshold, threshold);270FLAG_SET_ERGO(Tier4CompileThreshold, threshold);271FLAG_SET_ERGO(Tier4BackEdgeThreshold, osr_threshold);272FLAG_SET_ERGO(Tier0ProfilingStartPercentage, InterpreterProfilePercentage);273}274} else {275// Normal tiered mode, ignore legacy flags276}277}278// Scale CompileThreshold279// CompileThresholdScaling == 0.0 is equivalent to -Xint and leaves CompileThreshold unchanged.280if (!FLAG_IS_DEFAULT(CompileThresholdScaling) && CompileThresholdScaling > 0.0 && CompileThreshold > 0) {281FLAG_SET_ERGO(CompileThreshold, scaled_compile_threshold(CompileThreshold));282}283}284285286void CompilerConfig::set_compilation_policy_flags() {287if (is_tiered()) {288// Increase the code cache size - tiered compiles a lot more.289if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) {290FLAG_SET_ERGO(ReservedCodeCacheSize,291MIN2(CODE_CACHE_DEFAULT_LIMIT, (size_t)ReservedCodeCacheSize * 5));292}293// Enable SegmentedCodeCache if tiered compilation is enabled, ReservedCodeCacheSize >= 240M294// and the code cache contains at least 8 pages (segmentation disables advantage of huge pages).295if (FLAG_IS_DEFAULT(SegmentedCodeCache) && ReservedCodeCacheSize >= 240*M &&2968 * CodeCache::page_size() <= ReservedCodeCacheSize) {297FLAG_SET_ERGO(SegmentedCodeCache, true);298}299if (Arguments::is_compiler_only()) { // -Xcomp300// Be much more aggressive in tiered mode with -Xcomp and exercise C2 more.301// We will first compile a level 3 version (C1 with full profiling), then do one invocation of it and302// compile a level 4 (C2) and then continue executing it.303if (FLAG_IS_DEFAULT(Tier3InvokeNotifyFreqLog)) {304FLAG_SET_CMDLINE(Tier3InvokeNotifyFreqLog, 0);305}306if (FLAG_IS_DEFAULT(Tier4InvocationThreshold)) {307FLAG_SET_CMDLINE(Tier4InvocationThreshold, 0);308}309}310}311312313if (CompileThresholdScaling < 0) {314vm_exit_during_initialization("Negative value specified for CompileThresholdScaling", NULL);315}316317if (CompilationModeFlag::disable_intermediate()) {318if (FLAG_IS_DEFAULT(Tier0ProfilingStartPercentage)) {319FLAG_SET_DEFAULT(Tier0ProfilingStartPercentage, 33);320}321322if (FLAG_IS_DEFAULT(Tier4InvocationThreshold)) {323FLAG_SET_DEFAULT(Tier4InvocationThreshold, 5000);324}325if (FLAG_IS_DEFAULT(Tier4MinInvocationThreshold)) {326FLAG_SET_DEFAULT(Tier4MinInvocationThreshold, 600);327}328if (FLAG_IS_DEFAULT(Tier4CompileThreshold)) {329FLAG_SET_DEFAULT(Tier4CompileThreshold, 10000);330}331if (FLAG_IS_DEFAULT(Tier4BackEdgeThreshold)) {332FLAG_SET_DEFAULT(Tier4BackEdgeThreshold, 15000);333}334}335336// Scale tiered compilation thresholds.337// CompileThresholdScaling == 0.0 is equivalent to -Xint and leaves compilation thresholds unchanged.338if (!FLAG_IS_DEFAULT(CompileThresholdScaling) && CompileThresholdScaling > 0.0) {339FLAG_SET_ERGO(Tier0InvokeNotifyFreqLog, scaled_freq_log(Tier0InvokeNotifyFreqLog));340FLAG_SET_ERGO(Tier0BackedgeNotifyFreqLog, scaled_freq_log(Tier0BackedgeNotifyFreqLog));341342FLAG_SET_ERGO(Tier3InvocationThreshold, scaled_compile_threshold(Tier3InvocationThreshold));343FLAG_SET_ERGO(Tier3MinInvocationThreshold, scaled_compile_threshold(Tier3MinInvocationThreshold));344FLAG_SET_ERGO(Tier3CompileThreshold, scaled_compile_threshold(Tier3CompileThreshold));345FLAG_SET_ERGO(Tier3BackEdgeThreshold, scaled_compile_threshold(Tier3BackEdgeThreshold));346347// Tier2{Invocation,MinInvocation,Compile,Backedge}Threshold should be scaled here348// once these thresholds become supported.349350FLAG_SET_ERGO(Tier2InvokeNotifyFreqLog, scaled_freq_log(Tier2InvokeNotifyFreqLog));351FLAG_SET_ERGO(Tier2BackedgeNotifyFreqLog, scaled_freq_log(Tier2BackedgeNotifyFreqLog));352353FLAG_SET_ERGO(Tier3InvokeNotifyFreqLog, scaled_freq_log(Tier3InvokeNotifyFreqLog));354FLAG_SET_ERGO(Tier3BackedgeNotifyFreqLog, scaled_freq_log(Tier3BackedgeNotifyFreqLog));355356FLAG_SET_ERGO(Tier23InlineeNotifyFreqLog, scaled_freq_log(Tier23InlineeNotifyFreqLog));357358FLAG_SET_ERGO(Tier4InvocationThreshold, scaled_compile_threshold(Tier4InvocationThreshold));359FLAG_SET_ERGO(Tier4MinInvocationThreshold, scaled_compile_threshold(Tier4MinInvocationThreshold));360FLAG_SET_ERGO(Tier4CompileThreshold, scaled_compile_threshold(Tier4CompileThreshold));361FLAG_SET_ERGO(Tier4BackEdgeThreshold, scaled_compile_threshold(Tier4BackEdgeThreshold));362}363364#ifdef COMPILER1365// Reduce stack usage due to inlining of methods which require much stack.366// (High tier compiler can inline better based on profiling information.)367if (FLAG_IS_DEFAULT(C1InlineStackLimit) &&368TieredStopAtLevel == CompLevel_full_optimization && !CompilerConfig::is_c1_only()) {369FLAG_SET_DEFAULT(C1InlineStackLimit, 5);370}371#endif372373if (CompilerConfig::is_tiered() && CompilerConfig::is_c2_enabled()) {374#ifdef COMPILER2375// Some inlining tuning376#ifdef X86377if (FLAG_IS_DEFAULT(InlineSmallCode)) {378FLAG_SET_DEFAULT(InlineSmallCode, 2500);379}380#endif381382#if defined AARCH64383if (FLAG_IS_DEFAULT(InlineSmallCode)) {384FLAG_SET_DEFAULT(InlineSmallCode, 2500);385}386#endif387#endif // COMPILER2388}389390}391392#if INCLUDE_JVMCI393void CompilerConfig::set_jvmci_specific_flags() {394if (UseJVMCICompiler) {395if (FLAG_IS_DEFAULT(TypeProfileWidth)) {396FLAG_SET_DEFAULT(TypeProfileWidth, 8);397}398if (FLAG_IS_DEFAULT(TypeProfileLevel)) {399FLAG_SET_DEFAULT(TypeProfileLevel, 0);400}401402if (UseJVMCINativeLibrary) {403// SVM compiled code requires more stack space404if (FLAG_IS_DEFAULT(CompilerThreadStackSize)) {405// Duplicate logic in the implementations of os::create_thread406// so that we can then double the computed stack size. Once407// the stack size requirements of SVM are better understood,408// this logic can be pushed down into os::create_thread.409int stack_size = CompilerThreadStackSize;410if (stack_size == 0) {411stack_size = VMThreadStackSize;412}413if (stack_size != 0) {414FLAG_SET_DEFAULT(CompilerThreadStackSize, stack_size * 2);415}416}417} else {418// JVMCI needs values not less than defaults419if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) {420FLAG_SET_DEFAULT(ReservedCodeCacheSize, MAX2(64*M, ReservedCodeCacheSize));421}422if (FLAG_IS_DEFAULT(InitialCodeCacheSize)) {423FLAG_SET_DEFAULT(InitialCodeCacheSize, MAX2(16*M, InitialCodeCacheSize));424}425if (FLAG_IS_DEFAULT(NewSizeThreadIncrease)) {426FLAG_SET_DEFAULT(NewSizeThreadIncrease, MAX2(4*K, NewSizeThreadIncrease));427}428if (FLAG_IS_DEFAULT(Tier3DelayOn)) {429// This effectively prevents the compile broker scheduling tier 2430// (i.e., limited C1 profiling) compilations instead of tier 3431// (i.e., full C1 profiling) compilations when the tier 4 queue432// backs up (which is quite likely when using a non-AOT compiled JVMCI433// compiler). The observation based on jargraal is that the downside434// of skipping full profiling is much worse for performance than the435// queue backing up.436FLAG_SET_DEFAULT(Tier3DelayOn, 100000);437}438} // !UseJVMCINativeLibrary439} // UseJVMCICompiler440}441#endif // INCLUDE_JVMCI442443bool CompilerConfig::check_args_consistency(bool status) {444// Check lower bounds of the code cache445// Template Interpreter code is approximately 3X larger in debug builds.446uint min_code_cache_size = CodeCacheMinimumUseSpace DEBUG_ONLY(* 3);447if (ReservedCodeCacheSize < InitialCodeCacheSize) {448jio_fprintf(defaultStream::error_stream(),449"Invalid ReservedCodeCacheSize: %dK. Must be at least InitialCodeCacheSize=%dK.\n",450ReservedCodeCacheSize/K, InitialCodeCacheSize/K);451status = false;452} else if (ReservedCodeCacheSize < min_code_cache_size) {453jio_fprintf(defaultStream::error_stream(),454"Invalid ReservedCodeCacheSize=%dK. Must be at least %uK.\n", ReservedCodeCacheSize/K,455min_code_cache_size/K);456status = false;457} else if (ReservedCodeCacheSize > CODE_CACHE_SIZE_LIMIT) {458// Code cache size larger than CODE_CACHE_SIZE_LIMIT is not supported.459jio_fprintf(defaultStream::error_stream(),460"Invalid ReservedCodeCacheSize=%dM. Must be at most %uM.\n", ReservedCodeCacheSize/M,461CODE_CACHE_SIZE_LIMIT/M);462status = false;463} else if (NonNMethodCodeHeapSize < min_code_cache_size) {464jio_fprintf(defaultStream::error_stream(),465"Invalid NonNMethodCodeHeapSize=%dK. Must be at least %uK.\n", NonNMethodCodeHeapSize/K,466min_code_cache_size/K);467status = false;468}469470#ifdef _LP64471if (!FLAG_IS_DEFAULT(CICompilerCount) && !FLAG_IS_DEFAULT(CICompilerCountPerCPU) && CICompilerCountPerCPU) {472warning("The VM option CICompilerCountPerCPU overrides CICompilerCount.");473}474#endif475476if (BackgroundCompilation && ReplayCompiles) {477if (!FLAG_IS_DEFAULT(BackgroundCompilation)) {478warning("BackgroundCompilation disabled due to ReplayCompiles option.");479}480FLAG_SET_CMDLINE(BackgroundCompilation, false);481}482483#ifdef COMPILER2484if (PostLoopMultiversioning && !RangeCheckElimination) {485if (!FLAG_IS_DEFAULT(PostLoopMultiversioning)) {486warning("PostLoopMultiversioning disabled because RangeCheckElimination is disabled.");487}488FLAG_SET_CMDLINE(PostLoopMultiversioning, false);489}490#endif // COMPILER2491492if (CompilerConfig::is_interpreter_only()) {493if (UseCompiler) {494if (!FLAG_IS_DEFAULT(UseCompiler)) {495warning("UseCompiler disabled due to -Xint.");496}497FLAG_SET_CMDLINE(UseCompiler, false);498}499if (ProfileInterpreter) {500if (!FLAG_IS_DEFAULT(ProfileInterpreter)) {501warning("ProfileInterpreter disabled due to -Xint.");502}503FLAG_SET_CMDLINE(ProfileInterpreter, false);504}505if (TieredCompilation) {506if (!FLAG_IS_DEFAULT(TieredCompilation)) {507warning("TieredCompilation disabled due to -Xint.");508}509FLAG_SET_CMDLINE(TieredCompilation, false);510}511#if INCLUDE_JVMCI512if (EnableJVMCI) {513if (!FLAG_IS_DEFAULT(EnableJVMCI) || !FLAG_IS_DEFAULT(UseJVMCICompiler)) {514warning("JVMCI Compiler disabled due to -Xint.");515}516FLAG_SET_CMDLINE(EnableJVMCI, false);517FLAG_SET_CMDLINE(UseJVMCICompiler, false);518}519#endif520} else {521#if INCLUDE_JVMCI522status = status && JVMCIGlobals::check_jvmci_flags_are_consistent();523#endif524}525526return status;527}528529void CompilerConfig::ergo_initialize() {530#if !COMPILER1_OR_COMPILER2531return;532#endif533534if (has_c1()) {535if (!is_compilation_mode_selected()) {536#if defined(_WINDOWS) && !defined(_LP64)537if (FLAG_IS_DEFAULT(NeverActAsServerClassMachine)) {538FLAG_SET_ERGO(NeverActAsServerClassMachine, true);539}540#endif541if (NeverActAsServerClassMachine) {542set_client_emulation_mode_flags();543}544} else if (!has_c2() && !is_jvmci_compiler()) {545set_client_emulation_mode_flags();546}547}548549set_legacy_emulation_flags();550set_compilation_policy_flags();551552#if INCLUDE_JVMCI553// Check that JVMCI supports selected GC.554// Should be done after GCConfig::initialize() was called.555JVMCIGlobals::check_jvmci_supported_gc();556557// Do JVMCI specific settings558set_jvmci_specific_flags();559#endif560561if (FLAG_IS_DEFAULT(SweeperThreshold)) {562if ((SweeperThreshold * ReservedCodeCacheSize / 100) > (1.2 * M)) {563// Cap default SweeperThreshold value to an equivalent of 1.2 Mb564FLAG_SET_ERGO(SweeperThreshold, (1.2 * M * 100) / ReservedCodeCacheSize);565}566}567568if (UseOnStackReplacement && !UseLoopCounter) {569warning("On-stack-replacement requires loop counters; enabling loop counters");570FLAG_SET_DEFAULT(UseLoopCounter, true);571}572573if (ProfileInterpreter && CompilerConfig::is_c1_simple_only()) {574if (!FLAG_IS_DEFAULT(ProfileInterpreter)) {575warning("ProfileInterpreter disabled due to client emulation mode");576}577FLAG_SET_CMDLINE(ProfileInterpreter, false);578}579580#ifdef COMPILER2581if (!EliminateLocks) {582EliminateNestedLocks = false;583}584if (!Inline || !IncrementalInline) {585IncrementalInline = false;586IncrementalInlineMH = false;587IncrementalInlineVirtual = false;588}589#ifndef PRODUCT590if (!IncrementalInline) {591AlwaysIncrementalInline = false;592}593if (FLAG_IS_CMDLINE(PrintIdealGraph) && !PrintIdealGraph) {594FLAG_SET_ERGO(PrintIdealGraphLevel, -1);595}596#endif597if (!UseTypeSpeculation && FLAG_IS_DEFAULT(TypeProfileLevel)) {598// nothing to use the profiling, turn if off599FLAG_SET_DEFAULT(TypeProfileLevel, 0);600}601if (!FLAG_IS_DEFAULT(OptoLoopAlignment) && FLAG_IS_DEFAULT(MaxLoopPad)) {602FLAG_SET_DEFAULT(MaxLoopPad, OptoLoopAlignment-1);603}604if (FLAG_IS_DEFAULT(LoopStripMiningIterShortLoop)) {605// blind guess606LoopStripMiningIterShortLoop = LoopStripMiningIter / 10;607}608#endif // COMPILER2609}610611612613