src/hotspot/share/compiler/compilerDefinitions.cpp
Index Unified diffs Context diffs Sdiffs Frames Patch New Old Previous File Next File open Sdiff src/hotspot/share/compiler

src/hotspot/share/compiler/compilerDefinitions.cpp

Print this page




 236     FLAG_SET_ERGO(intx, Tier3InvokeNotifyFreqLog, scaled_freq_log(Tier3InvokeNotifyFreqLog));
 237     FLAG_SET_ERGO(intx, Tier3BackedgeNotifyFreqLog, scaled_freq_log(Tier3BackedgeNotifyFreqLog));
 238 
 239     FLAG_SET_ERGO(intx, Tier23InlineeNotifyFreqLog, scaled_freq_log(Tier23InlineeNotifyFreqLog));
 240 
 241     FLAG_SET_ERGO(intx, Tier4InvocationThreshold, scaled_compile_threshold(Tier4InvocationThreshold));
 242     FLAG_SET_ERGO(intx, Tier4MinInvocationThreshold, scaled_compile_threshold(Tier4MinInvocationThreshold));
 243     FLAG_SET_ERGO(intx, Tier4CompileThreshold, scaled_compile_threshold(Tier4CompileThreshold));
 244     FLAG_SET_ERGO(intx, Tier4BackEdgeThreshold, scaled_compile_threshold(Tier4BackEdgeThreshold));
 245   }
 246 }
 247 
 248 #if INCLUDE_JVMCI
 249 void set_jvmci_specific_flags() {
 250   if (UseJVMCICompiler) {
 251     Compilation_mode = CompMode_server;
 252 
 253     if (FLAG_IS_DEFAULT(TypeProfileWidth)) {
 254       FLAG_SET_DEFAULT(TypeProfileWidth, 8);
 255     }

















 256     if (FLAG_IS_DEFAULT(OnStackReplacePercentage)) {
 257       FLAG_SET_DEFAULT(OnStackReplacePercentage, 933);
 258     }
 259     // JVMCI needs values not less than defaults
 260     if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) {
 261       FLAG_SET_DEFAULT(ReservedCodeCacheSize, MAX2(64*M, ReservedCodeCacheSize));
 262     }
 263     if (FLAG_IS_DEFAULT(InitialCodeCacheSize)) {
 264       FLAG_SET_DEFAULT(InitialCodeCacheSize, MAX2(16*M, InitialCodeCacheSize));
 265     }
 266     if (FLAG_IS_DEFAULT(MetaspaceSize)) {
 267       FLAG_SET_DEFAULT(MetaspaceSize, MIN2(MAX2(12*M, MetaspaceSize), MaxMetaspaceSize));
 268     }
 269     if (FLAG_IS_DEFAULT(NewSizeThreadIncrease)) {
 270       FLAG_SET_DEFAULT(NewSizeThreadIncrease, MAX2(4*K, NewSizeThreadIncrease));
 271     }
 272     if (TieredStopAtLevel != CompLevel_full_optimization) {
 273       // Currently JVMCI compiler can only work at the full optimization level
 274       warning("forcing TieredStopAtLevel to full optimization because JVMCI is enabled");
 275       FLAG_SET_ERGO(intx, TieredStopAtLevel, CompLevel_full_optimization);
 276     }
 277     if (FLAG_IS_DEFAULT(TypeProfileLevel)) {
 278       FLAG_SET_DEFAULT(TypeProfileLevel, 0);
 279     }
 280   }
 281 }
 282 #endif // INCLUDE_JVMCI
 283 
 284 bool CompilerConfig::check_args_consistency(bool status) {
 285   // Check lower bounds of the code cache
 286   // Template Interpreter code is approximately 3X larger in debug builds.
 287   uint min_code_cache_size = CodeCacheMinimumUseSpace DEBUG_ONLY(* 3);
 288   if (ReservedCodeCacheSize < InitialCodeCacheSize) {
 289     jio_fprintf(defaultStream::error_stream(),
 290                 "Invalid ReservedCodeCacheSize: %dK. Must be at least InitialCodeCacheSize=%dK.\n",
 291                 ReservedCodeCacheSize/K, InitialCodeCacheSize/K);
 292     status = false;
 293   } else if (ReservedCodeCacheSize < min_code_cache_size) {
 294     jio_fprintf(defaultStream::error_stream(),
 295                 "Invalid ReservedCodeCacheSize=%dK. Must be at least %uK.\n", ReservedCodeCacheSize/K,
 296                 min_code_cache_size/K);
 297     status = false;
 298   } else if (ReservedCodeCacheSize > CODE_CACHE_SIZE_LIMIT) {
 299     // Code cache size larger than CODE_CACHE_SIZE_LIMIT is not supported.
 300     jio_fprintf(defaultStream::error_stream(),


 375 #endif
 376   }
 377   return status;
 378 }
 379 
 380 void CompilerConfig::ergo_initialize() {
 381   if (Arguments::is_interpreter_only()) {
 382     return; // Nothing to do.
 383   }
 384 
 385 #ifdef TIERED
 386   if (!compilation_mode_selected()) {
 387     select_compilation_mode_ergonomically();
 388   }
 389 #endif
 390 
 391 #if INCLUDE_JVMCI
 392   // Check that JVMCI compiler supports selested GC.
 393   // Should be done after GCConfig::initialize() was called.
 394   JVMCIGlobals::check_jvmci_supported_gc();


 395   set_jvmci_specific_flags();
 396 #endif
 397 
 398   if (TieredCompilation) {
 399     set_tiered_flags();
 400   } else {
 401     int max_compilation_policy_choice = 1;
 402 #ifdef COMPILER2
 403     if (is_server_compilation_mode_vm()) {
 404       max_compilation_policy_choice = 2;
 405     }
 406 #endif
 407     // Check if the policy is valid.
 408     if (CompilationPolicyChoice >= max_compilation_policy_choice) {
 409       vm_exit_during_initialization(
 410         "Incompatible compilation policy selected", NULL);
 411     }
 412     // Scale CompileThreshold
 413     // CompileThresholdScaling == 0.0 is equivalent to -Xint and leaves CompileThreshold unchanged.
 414     if (!FLAG_IS_DEFAULT(CompileThresholdScaling) && CompileThresholdScaling > 0.0) {




 236     FLAG_SET_ERGO(intx, Tier3InvokeNotifyFreqLog, scaled_freq_log(Tier3InvokeNotifyFreqLog));
 237     FLAG_SET_ERGO(intx, Tier3BackedgeNotifyFreqLog, scaled_freq_log(Tier3BackedgeNotifyFreqLog));
 238 
 239     FLAG_SET_ERGO(intx, Tier23InlineeNotifyFreqLog, scaled_freq_log(Tier23InlineeNotifyFreqLog));
 240 
 241     FLAG_SET_ERGO(intx, Tier4InvocationThreshold, scaled_compile_threshold(Tier4InvocationThreshold));
 242     FLAG_SET_ERGO(intx, Tier4MinInvocationThreshold, scaled_compile_threshold(Tier4MinInvocationThreshold));
 243     FLAG_SET_ERGO(intx, Tier4CompileThreshold, scaled_compile_threshold(Tier4CompileThreshold));
 244     FLAG_SET_ERGO(intx, Tier4BackEdgeThreshold, scaled_compile_threshold(Tier4BackEdgeThreshold));
 245   }
 246 }
 247 
 248 #if INCLUDE_JVMCI
 249 void set_jvmci_specific_flags() {
 250   if (UseJVMCICompiler) {
 251     Compilation_mode = CompMode_server;
 252 
 253     if (FLAG_IS_DEFAULT(TypeProfileWidth)) {
 254       FLAG_SET_DEFAULT(TypeProfileWidth, 8);
 255     }
 256     if (TieredStopAtLevel != CompLevel_full_optimization) {
 257       // Currently JVMCI compiler can only work at the full optimization level
 258       warning("forcing TieredStopAtLevel to full optimization because JVMCI is enabled");
 259       FLAG_SET_ERGO(intx, TieredStopAtLevel, CompLevel_full_optimization);
 260     }
 261     if (FLAG_IS_DEFAULT(TypeProfileLevel)) {
 262       FLAG_SET_DEFAULT(TypeProfileLevel, 0);
 263     }
 264 
 265     if (UseJVMCINativeLibrary) {
 266       // SVM compiled code requires more stack space
 267       if (FLAG_IS_DEFAULT(CompilerThreadStackSize)) {
 268         FLAG_SET_DEFAULT(CompilerThreadStackSize, 2*M);
 269       }
 270     } else {
 271       // Adjust the on stack replacement percentage to avoid early
 272       // OSR compilations while JVMCI itself is warming up
 273       if (FLAG_IS_DEFAULT(OnStackReplacePercentage)) {
 274         FLAG_SET_DEFAULT(OnStackReplacePercentage, 933);
 275       }
 276       // JVMCI needs values not less than defaults
 277       if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) {
 278         FLAG_SET_DEFAULT(ReservedCodeCacheSize, MAX2(64*M, ReservedCodeCacheSize));
 279       }
 280       if (FLAG_IS_DEFAULT(InitialCodeCacheSize)) {
 281         FLAG_SET_DEFAULT(InitialCodeCacheSize, MAX2(16*M, InitialCodeCacheSize));
 282       }
 283       if (FLAG_IS_DEFAULT(MetaspaceSize)) {
 284         FLAG_SET_DEFAULT(MetaspaceSize, MIN2(MAX2(12*M, MetaspaceSize), MaxMetaspaceSize));
 285       }
 286       if (FLAG_IS_DEFAULT(NewSizeThreadIncrease)) {
 287         FLAG_SET_DEFAULT(NewSizeThreadIncrease, MAX2(4*K, NewSizeThreadIncrease));
 288       }
 289     } // !UseJVMCINativeLibrary
 290   } // UseJVMCICompiler







 291 }
 292 #endif // INCLUDE_JVMCI
 293 
 294 bool CompilerConfig::check_args_consistency(bool status) {
 295   // Check lower bounds of the code cache
 296   // Template Interpreter code is approximately 3X larger in debug builds.
 297   uint min_code_cache_size = CodeCacheMinimumUseSpace DEBUG_ONLY(* 3);
 298   if (ReservedCodeCacheSize < InitialCodeCacheSize) {
 299     jio_fprintf(defaultStream::error_stream(),
 300                 "Invalid ReservedCodeCacheSize: %dK. Must be at least InitialCodeCacheSize=%dK.\n",
 301                 ReservedCodeCacheSize/K, InitialCodeCacheSize/K);
 302     status = false;
 303   } else if (ReservedCodeCacheSize < min_code_cache_size) {
 304     jio_fprintf(defaultStream::error_stream(),
 305                 "Invalid ReservedCodeCacheSize=%dK. Must be at least %uK.\n", ReservedCodeCacheSize/K,
 306                 min_code_cache_size/K);
 307     status = false;
 308   } else if (ReservedCodeCacheSize > CODE_CACHE_SIZE_LIMIT) {
 309     // Code cache size larger than CODE_CACHE_SIZE_LIMIT is not supported.
 310     jio_fprintf(defaultStream::error_stream(),


 385 #endif
 386   }
 387   return status;
 388 }
 389 
 390 void CompilerConfig::ergo_initialize() {
 391   if (Arguments::is_interpreter_only()) {
 392     return; // Nothing to do.
 393   }
 394 
 395 #ifdef TIERED
 396   if (!compilation_mode_selected()) {
 397     select_compilation_mode_ergonomically();
 398   }
 399 #endif
 400 
 401 #if INCLUDE_JVMCI
 402   // Check that JVMCI compiler supports selested GC.
 403   // Should be done after GCConfig::initialize() was called.
 404   JVMCIGlobals::check_jvmci_supported_gc();
 405 
 406   // Do JVMCI specific settings
 407   set_jvmci_specific_flags();
 408 #endif
 409 
 410   if (TieredCompilation) {
 411     set_tiered_flags();
 412   } else {
 413     int max_compilation_policy_choice = 1;
 414 #ifdef COMPILER2
 415     if (is_server_compilation_mode_vm()) {
 416       max_compilation_policy_choice = 2;
 417     }
 418 #endif
 419     // Check if the policy is valid.
 420     if (CompilationPolicyChoice >= max_compilation_policy_choice) {
 421       vm_exit_during_initialization(
 422         "Incompatible compilation policy selected", NULL);
 423     }
 424     // Scale CompileThreshold
 425     // CompileThresholdScaling == 0.0 is equivalent to -Xint and leaves CompileThreshold unchanged.
 426     if (!FLAG_IS_DEFAULT(CompileThresholdScaling) && CompileThresholdScaling > 0.0) {


src/hotspot/share/compiler/compilerDefinitions.cpp
Index Unified diffs Context diffs Sdiffs Frames Patch New Old Previous File Next File