src/hotspot/share/compiler/compilerDefinitions.cpp
changeset 58894 b95bead30957
parent 58367 b3ca57ddfc92
child 58926 ecb801342b8c
equal deleted inserted replaced
58893:ec954ef6caf1 58894:b95bead30957
    35   "c1",
    35   "c1",
    36   "c2",
    36   "c2",
    37   "jvmci"
    37   "jvmci"
    38 };
    38 };
    39 
    39 
       
    40 #ifdef TIERED
       
    41 bool CompilationModeFlag::_quick_only = false;
       
    42 bool CompilationModeFlag::_high_only = false;
       
    43 bool CompilationModeFlag::_high_only_quick_internal = false;
       
    44 
       
    45 
       
    46 bool CompilationModeFlag::initialize() {
       
    47   if (CompilationMode != NULL) {
       
    48     if (strcmp(CompilationMode, "default") == 0) {
       
    49       // Do nothing, just support the "default" keyword.
       
    50     } else if (strcmp(CompilationMode, "quick-only") == 0) {
       
    51       _quick_only = true;
       
    52     } else if (strcmp(CompilationMode, "high-only") == 0) {
       
    53       _high_only = true;
       
    54     } else if (strcmp(CompilationMode, "high-only-quick-internal") == 0) {
       
    55       _high_only_quick_internal = true;
       
    56     } else {
       
    57         jio_fprintf(defaultStream::error_stream(), "Unsupported compilation mode '%s', supported modes are: quick-only, high-only, high-only-quick-internal\n", CompilationMode);
       
    58         return false;
       
    59       }
       
    60     }
       
    61   return true;
       
    62 }
       
    63 
       
    64 #endif
       
    65 
    40 #if defined(COMPILER2)
    66 #if defined(COMPILER2)
    41 CompLevel  CompLevel_highest_tier      = CompLevel_full_optimization;  // pure C2 and tiered or JVMCI and tiered
    67 CompLevel  CompLevel_highest_tier      = CompLevel_full_optimization;  // pure C2 and tiered or JVMCI and tiered
    42 #elif defined(COMPILER1)
    68 #elif defined(COMPILER1)
    43 CompLevel  CompLevel_highest_tier      = CompLevel_simple;             // pure C1 or JVMCI
    69 CompLevel  CompLevel_highest_tier      = CompLevel_simple;             // pure C1 or JVMCI
    44 #else
    70 #else
   206 
   232 
   207   if (CompileThresholdScaling < 0) {
   233   if (CompileThresholdScaling < 0) {
   208     vm_exit_during_initialization("Negative value specified for CompileThresholdScaling", NULL);
   234     vm_exit_during_initialization("Negative value specified for CompileThresholdScaling", NULL);
   209   }
   235   }
   210 
   236 
       
   237   if (CompilationModeFlag::disable_intermediate()) {
       
   238     if (FLAG_IS_DEFAULT(Tier0ProfilingStartPercentage)) {
       
   239       FLAG_SET_DEFAULT(Tier0ProfilingStartPercentage, 33);
       
   240     }
       
   241   }
       
   242 
   211   // Scale tiered compilation thresholds.
   243   // Scale tiered compilation thresholds.
   212   // CompileThresholdScaling == 0.0 is equivalent to -Xint and leaves compilation thresholds unchanged.
   244   // CompileThresholdScaling == 0.0 is equivalent to -Xint and leaves compilation thresholds unchanged.
   213   if (!FLAG_IS_DEFAULT(CompileThresholdScaling) && CompileThresholdScaling > 0.0) {
   245   if (!FLAG_IS_DEFAULT(CompileThresholdScaling) && CompileThresholdScaling > 0.0) {
   214     FLAG_SET_ERGO(Tier0InvokeNotifyFreqLog, scaled_freq_log(Tier0InvokeNotifyFreqLog));
   246     FLAG_SET_ERGO(Tier0InvokeNotifyFreqLog, scaled_freq_log(Tier0InvokeNotifyFreqLog));
   215     FLAG_SET_ERGO(Tier0BackedgeNotifyFreqLog, scaled_freq_log(Tier0BackedgeNotifyFreqLog));
   247     FLAG_SET_ERGO(Tier0BackedgeNotifyFreqLog, scaled_freq_log(Tier0BackedgeNotifyFreqLog));
   232 
   264 
   233     FLAG_SET_ERGO(Tier4InvocationThreshold, scaled_compile_threshold(Tier4InvocationThreshold));
   265     FLAG_SET_ERGO(Tier4InvocationThreshold, scaled_compile_threshold(Tier4InvocationThreshold));
   234     FLAG_SET_ERGO(Tier4MinInvocationThreshold, scaled_compile_threshold(Tier4MinInvocationThreshold));
   266     FLAG_SET_ERGO(Tier4MinInvocationThreshold, scaled_compile_threshold(Tier4MinInvocationThreshold));
   235     FLAG_SET_ERGO(Tier4CompileThreshold, scaled_compile_threshold(Tier4CompileThreshold));
   267     FLAG_SET_ERGO(Tier4CompileThreshold, scaled_compile_threshold(Tier4CompileThreshold));
   236     FLAG_SET_ERGO(Tier4BackEdgeThreshold, scaled_compile_threshold(Tier4BackEdgeThreshold));
   268     FLAG_SET_ERGO(Tier4BackEdgeThreshold, scaled_compile_threshold(Tier4BackEdgeThreshold));
       
   269 
       
   270     if (CompilationModeFlag::disable_intermediate()) {
       
   271       FLAG_SET_ERGO(Tier40InvocationThreshold, scaled_compile_threshold(Tier40InvocationThreshold));
       
   272       FLAG_SET_ERGO(Tier40MinInvocationThreshold, scaled_compile_threshold(Tier40MinInvocationThreshold));
       
   273       FLAG_SET_ERGO(Tier40CompileThreshold, scaled_compile_threshold(Tier40CompileThreshold));
       
   274       FLAG_SET_ERGO(Tier40BackEdgeThreshold, scaled_compile_threshold(Tier40BackEdgeThreshold));
       
   275     }
       
   276 
       
   277 #if INCLUDE_AOT
       
   278     if (UseAOT) {
       
   279       FLAG_SET_ERGO(Tier3AOTInvocationThreshold, scaled_compile_threshold(Tier3AOTInvocationThreshold));
       
   280       FLAG_SET_ERGO(Tier3AOTMinInvocationThreshold, scaled_compile_threshold(Tier3AOTMinInvocationThreshold));
       
   281       FLAG_SET_ERGO(Tier3AOTCompileThreshold, scaled_compile_threshold(Tier3AOTCompileThreshold));
       
   282       FLAG_SET_ERGO(Tier3AOTBackEdgeThreshold, scaled_compile_threshold(Tier3AOTBackEdgeThreshold));
       
   283 
       
   284       if (CompilationModeFlag::disable_intermediate()) {
       
   285         FLAG_SET_ERGO(Tier0AOTInvocationThreshold, scaled_compile_threshold(Tier0AOTInvocationThreshold));
       
   286         FLAG_SET_ERGO(Tier0AOTMinInvocationThreshold, scaled_compile_threshold(Tier0AOTMinInvocationThreshold));
       
   287         FLAG_SET_ERGO(Tier0AOTCompileThreshold, scaled_compile_threshold(Tier0AOTCompileThreshold));
       
   288         FLAG_SET_ERGO(Tier0AOTBackEdgeThreshold, scaled_compile_threshold(Tier0AOTBackEdgeThreshold));
       
   289       }
       
   290     }
       
   291 #endif // INCLUDE_AOT
   237   }
   292   }
   238 }
   293 }
   239 
   294 
   240 #if INCLUDE_JVMCI
   295 #if INCLUDE_JVMCI
   241 void set_jvmci_specific_flags() {
   296 void set_jvmci_specific_flags() {
   242   if (UseJVMCICompiler) {
   297   if (UseJVMCICompiler) {
   243     Compilation_mode = CompMode_server;
   298     Compilation_mode = CompMode_server;
   244 
   299 
   245     if (FLAG_IS_DEFAULT(TypeProfileWidth)) {
   300     if (FLAG_IS_DEFAULT(TypeProfileWidth)) {
   246       FLAG_SET_DEFAULT(TypeProfileWidth, 8);
   301       FLAG_SET_DEFAULT(TypeProfileWidth, 8);
   247     }
       
   248     if (TieredStopAtLevel != CompLevel_full_optimization) {
       
   249       // Currently JVMCI compiler can only work at the full optimization level
       
   250       warning("forcing TieredStopAtLevel to full optimization because JVMCI is enabled");
       
   251       FLAG_SET_ERGO(TieredStopAtLevel, CompLevel_full_optimization);
       
   252     }
   302     }
   253     if (FLAG_IS_DEFAULT(TypeProfileLevel)) {
   303     if (FLAG_IS_DEFAULT(TypeProfileLevel)) {
   254       FLAG_SET_DEFAULT(TypeProfileLevel, 0);
   304       FLAG_SET_DEFAULT(TypeProfileLevel, 0);
   255     }
   305     }
   256 
   306 
   268         if (stack_size != 0) {
   318         if (stack_size != 0) {
   269           FLAG_SET_DEFAULT(CompilerThreadStackSize, stack_size * 2);
   319           FLAG_SET_DEFAULT(CompilerThreadStackSize, stack_size * 2);
   270         }
   320         }
   271       }
   321       }
   272     } else {
   322     } else {
       
   323 #ifdef TIERED
       
   324       if (!TieredCompilation) {
       
   325          warning("Disabling tiered compilation with non-native JVMCI compiler is not recommended. "
       
   326                  "Turning on tiered compilation and disabling intermediate compilation levels instead. ");
       
   327          FLAG_SET_ERGO(TieredCompilation, true);
       
   328          if (CompilationModeFlag::normal()) {
       
   329            CompilationModeFlag::set_high_only_quick_internal(true);
       
   330          }
       
   331          if (CICompilerCount < 2 && CompilationModeFlag::quick_internal()) {
       
   332             warning("Increasing number of compiler threads for JVMCI compiler.");
       
   333             FLAG_SET_ERGO(CICompilerCount, 2);
       
   334          }
       
   335       }
       
   336 #else // TIERED
   273       // Adjust the on stack replacement percentage to avoid early
   337       // Adjust the on stack replacement percentage to avoid early
   274       // OSR compilations while JVMCI itself is warming up
   338       // OSR compilations while JVMCI itself is warming up
   275       if (FLAG_IS_DEFAULT(OnStackReplacePercentage)) {
   339       if (FLAG_IS_DEFAULT(OnStackReplacePercentage)) {
   276         FLAG_SET_DEFAULT(OnStackReplacePercentage, 933);
   340         FLAG_SET_DEFAULT(OnStackReplacePercentage, 933);
   277       }
   341       }
       
   342 #endif // !TIERED
   278       // JVMCI needs values not less than defaults
   343       // JVMCI needs values not less than defaults
   279       if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) {
   344       if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) {
   280         FLAG_SET_DEFAULT(ReservedCodeCacheSize, MAX2(64*M, ReservedCodeCacheSize));
   345         FLAG_SET_DEFAULT(ReservedCodeCacheSize, MAX2(64*M, ReservedCodeCacheSize));
   281       }
   346       }
   282       if (FLAG_IS_DEFAULT(InitialCodeCacheSize)) {
   347       if (FLAG_IS_DEFAULT(InitialCodeCacheSize)) {