--- old/src/hotspot/share/c1/c1_LIRGenerator.cpp 2018-05-03 12:25:33.000000000 -0700 +++ new/src/hotspot/share/c1/c1_LIRGenerator.cpp 2018-05-03 12:25:33.000000000 -0700 @@ -3248,7 +3248,7 @@ int freq_log = Tier23InlineeNotifyFreqLog; double scale; if (_method->has_option_value("CompileThresholdScaling", scale)) { - freq_log = Arguments::scaled_freq_log(freq_log, scale); + freq_log = CompilerConfig::scaled_freq_log(freq_log, scale); } increment_event_counter_impl(info, x->inlinee(), right_n_bits(freq_log), InvocationEntryBci, false, true); } @@ -3267,7 +3267,7 @@ // Increment the appropriate invocation/backedge counter and notify the runtime. double scale; if (_method->has_option_value("CompileThresholdScaling", scale)) { - freq_log = Arguments::scaled_freq_log(freq_log, scale); + freq_log = CompilerConfig::scaled_freq_log(freq_log, scale); } increment_event_counter_impl(info, info->scope()->method(), right_n_bits(freq_log), bci, backedge, true); } --- old/src/hotspot/share/code/codeBlob.hpp 2018-05-03 12:25:34.000000000 -0700 +++ new/src/hotspot/share/code/codeBlob.hpp 2018-05-03 12:25:34.000000000 -0700 @@ -26,7 +26,7 @@ #define SHARE_VM_CODE_CODEBLOB_HPP #include "asm/codeBuffer.hpp" -#include "compiler/compilerDefinitions.hpp" +#include "compiler/compilerConfig.hpp" #include "compiler/oopMap.hpp" #include "runtime/frame.hpp" #include "runtime/handles.hpp" --- old/src/hotspot/share/compiler/abstractCompiler.hpp 2018-05-03 12:25:35.000000000 -0700 +++ new/src/hotspot/share/compiler/abstractCompiler.hpp 2018-05-03 12:25:35.000000000 -0700 @@ -26,7 +26,7 @@ #define SHARE_VM_COMPILER_ABSTRACTCOMPILER_HPP #include "ci/compilerInterface.hpp" -#include "compiler/compilerDefinitions.hpp" +#include "compiler/compilerConfig.hpp" #include "compiler/compilerDirectives.hpp" typedef void (*initializer)(void); --- old/src/hotspot/share/jvmci/jvmci_globals.cpp 2018-05-03 12:25:36.000000000 -0700 +++ new/src/hotspot/share/jvmci/jvmci_globals.cpp 2018-05-03 12:25:35.000000000 -0700 @@ -25,6 +25,7 @@ #include "precompiled.hpp" #include "jvm.h" #include "jvmci/jvmci_globals.hpp" +#include "gc/shared/gcConfig.hpp" #include "utilities/defaultStream.hpp" #include "runtime/globals_extension.hpp" @@ -113,3 +114,14 @@ #undef CHECK_NOT_SET return true; } + +void JVMCIGlobals::check_jvmci_supported_gc() { + if (EnableJVMCI) { + // Check that used GC is supported by JVMCI and Java compiler + if (!(UseSerialGC || UseParallelGC || UseParallelOldGC || UseG1GC)) { + vm_exit_during_initialization("JVMCI Compiler does not support selected GC", GCConfig::hs_err_name()); + FLAG_SET_DEFAULT(EnableJVMCI, false); + FLAG_SET_DEFAULT(UseJVMCICompiler, false); + } + } +} --- old/src/hotspot/share/jvmci/jvmci_globals.hpp 2018-05-03 12:25:37.000000000 -0700 +++ new/src/hotspot/share/jvmci/jvmci_globals.hpp 2018-05-03 12:25:36.000000000 -0700 @@ -121,5 +121,9 @@ // an error message describing the inconsistency is printed before // returning false. static bool check_jvmci_flags_are_consistent(); + + // Check that jvci supports selected GC. + // Exit VM with error if GC is not supported. + static void check_jvmci_supported_gc(); }; #endif // SHARE_VM_JVMCI_JVMCIGLOBALS_HPP --- old/src/hotspot/share/oops/method.hpp 2018-05-03 12:25:38.000000000 -0700 +++ new/src/hotspot/share/oops/method.hpp 2018-05-03 12:25:37.000000000 -0700 @@ -27,7 +27,7 @@ #include "classfile/vmSymbols.hpp" #include "code/compressedStream.hpp" -#include "compiler/compilerDefinitions.hpp" +#include "compiler/compilerConfig.hpp" #include "compiler/oopMap.hpp" #include "interpreter/invocationCounter.hpp" #include "oops/annotations.hpp" --- old/src/hotspot/share/oops/methodCounters.hpp 2018-05-03 12:25:38.000000000 -0700 +++ new/src/hotspot/share/oops/methodCounters.hpp 2018-05-03 12:25:38.000000000 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,7 @@ #define SHARE_VM_OOPS_METHODCOUNTERS_HPP #include "oops/metadata.hpp" +#include "compiler/compilerConfig.hpp" #include "compiler/compilerOracle.hpp" #include "interpreter/invocationCounter.hpp" #include "runtime/arguments.hpp" @@ -96,7 +97,7 @@ double scale = 1.0; CompilerOracle::has_option_value(mh, "CompileThresholdScaling", scale); - int compile_threshold = Arguments::scaled_compile_threshold(CompileThreshold, scale); + int compile_threshold = CompilerConfig::scaled_compile_threshold(CompileThreshold, scale); _interpreter_invocation_limit = compile_threshold << InvocationCounter::count_shift; if (ProfileInterpreter) { // If interpreter profiling is enabled, the backward branch limit @@ -107,8 +108,8 @@ _interpreter_backward_branch_limit = ((compile_threshold * OnStackReplacePercentage) / 100) << InvocationCounter::count_shift; } _interpreter_profile_limit = ((compile_threshold * InterpreterProfilePercentage) / 100) << InvocationCounter::count_shift; - _invoke_mask = right_n_bits(Arguments::scaled_freq_log(Tier0InvokeNotifyFreqLog, scale)) << InvocationCounter::count_shift; - _backedge_mask = right_n_bits(Arguments::scaled_freq_log(Tier0BackedgeNotifyFreqLog, scale)) << InvocationCounter::count_shift; + _invoke_mask = right_n_bits(CompilerConfig::scaled_freq_log(Tier0InvokeNotifyFreqLog, scale)) << InvocationCounter::count_shift; + _backedge_mask = right_n_bits(CompilerConfig::scaled_freq_log(Tier0BackedgeNotifyFreqLog, scale)) << InvocationCounter::count_shift; } public: --- old/src/hotspot/share/oops/methodData.cpp 2018-05-03 12:25:40.000000000 -0700 +++ new/src/hotspot/share/oops/methodData.cpp 2018-05-03 12:25:40.000000000 -0700 @@ -1223,8 +1223,8 @@ // Set per-method invoke- and backedge mask. double scale = 1.0; CompilerOracle::has_option_value(_method, "CompileThresholdScaling", scale); - _invoke_mask = right_n_bits(Arguments::scaled_freq_log(Tier0InvokeNotifyFreqLog, scale)) << InvocationCounter::count_shift; - _backedge_mask = right_n_bits(Arguments::scaled_freq_log(Tier0BackedgeNotifyFreqLog, scale)) << InvocationCounter::count_shift; + _invoke_mask = right_n_bits(CompilerConfig::scaled_freq_log(Tier0InvokeNotifyFreqLog, scale)) << InvocationCounter::count_shift; + _backedge_mask = right_n_bits(CompilerConfig::scaled_freq_log(Tier0BackedgeNotifyFreqLog, scale)) << InvocationCounter::count_shift; _tenure_traps = 0; _num_loops = 0; --- old/src/hotspot/share/runtime/arguments.cpp 2018-05-03 12:25:41.000000000 -0700 +++ new/src/hotspot/share/runtime/arguments.cpp 2018-05-03 12:25:41.000000000 -0700 @@ -1565,101 +1565,6 @@ } } -// Returns threshold scaled with the value of scale. -// If scale < 0.0, threshold is returned without scaling. -intx Arguments::scaled_compile_threshold(intx threshold, double scale) { - if (scale == 1.0 || scale < 0.0) { - return threshold; - } else { - return (intx)(threshold * scale); - } -} - -// Returns freq_log scaled with the value of scale. -// Returned values are in the range of [0, InvocationCounter::number_of_count_bits + 1]. -// If scale < 0.0, freq_log is returned without scaling. -intx Arguments::scaled_freq_log(intx freq_log, double scale) { - // Check if scaling is necessary or if negative value was specified. - if (scale == 1.0 || scale < 0.0) { - return freq_log; - } - // Check values to avoid calculating log2 of 0. - if (scale == 0.0 || freq_log == 0) { - return 0; - } - // Determine the maximum notification frequency value currently supported. - // The largest mask value that the interpreter/C1 can handle is - // of length InvocationCounter::number_of_count_bits. Mask values are always - // one bit shorter then the value of the notification frequency. Set - // max_freq_bits accordingly. - intx max_freq_bits = InvocationCounter::number_of_count_bits + 1; - intx scaled_freq = scaled_compile_threshold((intx)1 << freq_log, scale); - if (scaled_freq == 0) { - // Return 0 right away to avoid calculating log2 of 0. - return 0; - } else if (scaled_freq > nth_bit(max_freq_bits)) { - return max_freq_bits; - } else { - return log2_intptr(scaled_freq); - } -} - -void Arguments::set_tiered_flags() { - // With tiered, set default policy to AdvancedThresholdPolicy, which is 3. - if (FLAG_IS_DEFAULT(CompilationPolicyChoice)) { - FLAG_SET_DEFAULT(CompilationPolicyChoice, 3); - } - if (CompilationPolicyChoice < 2) { - vm_exit_during_initialization( - "Incompatible compilation policy selected", NULL); - } - // Increase the code cache size - tiered compiles a lot more. - if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) { - FLAG_SET_ERGO(uintx, ReservedCodeCacheSize, - MIN2(CODE_CACHE_DEFAULT_LIMIT, ReservedCodeCacheSize * 5)); - } - // Enable SegmentedCodeCache if TieredCompilation is enabled and ReservedCodeCacheSize >= 240M - if (FLAG_IS_DEFAULT(SegmentedCodeCache) && ReservedCodeCacheSize >= 240*M) { - FLAG_SET_ERGO(bool, SegmentedCodeCache, true); - } - if (!UseInterpreter) { // -Xcomp - Tier3InvokeNotifyFreqLog = 0; - Tier4InvocationThreshold = 0; - } - - if (CompileThresholdScaling < 0) { - vm_exit_during_initialization("Negative value specified for CompileThresholdScaling", NULL); - } - - // Scale tiered compilation thresholds. - // CompileThresholdScaling == 0.0 is equivalent to -Xint and leaves compilation thresholds unchanged. - if (!FLAG_IS_DEFAULT(CompileThresholdScaling) && CompileThresholdScaling > 0.0) { - FLAG_SET_ERGO(intx, Tier0InvokeNotifyFreqLog, scaled_freq_log(Tier0InvokeNotifyFreqLog)); - FLAG_SET_ERGO(intx, Tier0BackedgeNotifyFreqLog, scaled_freq_log(Tier0BackedgeNotifyFreqLog)); - - FLAG_SET_ERGO(intx, Tier3InvocationThreshold, scaled_compile_threshold(Tier3InvocationThreshold)); - FLAG_SET_ERGO(intx, Tier3MinInvocationThreshold, scaled_compile_threshold(Tier3MinInvocationThreshold)); - FLAG_SET_ERGO(intx, Tier3CompileThreshold, scaled_compile_threshold(Tier3CompileThreshold)); - FLAG_SET_ERGO(intx, Tier3BackEdgeThreshold, scaled_compile_threshold(Tier3BackEdgeThreshold)); - - // Tier2{Invocation,MinInvocation,Compile,Backedge}Threshold should be scaled here - // once these thresholds become supported. - - FLAG_SET_ERGO(intx, Tier2InvokeNotifyFreqLog, scaled_freq_log(Tier2InvokeNotifyFreqLog)); - FLAG_SET_ERGO(intx, Tier2BackedgeNotifyFreqLog, scaled_freq_log(Tier2BackedgeNotifyFreqLog)); - - FLAG_SET_ERGO(intx, Tier3InvokeNotifyFreqLog, scaled_freq_log(Tier3InvokeNotifyFreqLog)); - FLAG_SET_ERGO(intx, Tier3BackedgeNotifyFreqLog, scaled_freq_log(Tier3BackedgeNotifyFreqLog)); - - FLAG_SET_ERGO(intx, Tier23InlineeNotifyFreqLog, scaled_freq_log(Tier23InlineeNotifyFreqLog)); - - FLAG_SET_ERGO(intx, Tier4InvocationThreshold, scaled_compile_threshold(Tier4InvocationThreshold)); - FLAG_SET_ERGO(intx, Tier4MinInvocationThreshold, scaled_compile_threshold(Tier4MinInvocationThreshold)); - FLAG_SET_ERGO(intx, Tier4CompileThreshold, scaled_compile_threshold(Tier4CompileThreshold)); - FLAG_SET_ERGO(intx, Tier4BackEdgeThreshold, scaled_compile_threshold(Tier4BackEdgeThreshold)); - } -} - void set_object_alignment() { // Object alignment. assert(is_power_of_2(ObjectAlignmentInBytes), "ObjectAlignmentInBytes must be power of 2"); @@ -1760,74 +1665,9 @@ CollectorPolicy::compute_heap_alignment()); } -#ifdef TIERED -bool Arguments::compilation_mode_selected() { - return !FLAG_IS_DEFAULT(TieredCompilation) || !FLAG_IS_DEFAULT(TieredStopAtLevel) || - !FLAG_IS_DEFAULT(UseAOT) JVMCI_ONLY(|| !FLAG_IS_DEFAULT(EnableJVMCI) || !FLAG_IS_DEFAULT(UseJVMCICompiler)); - -} - -void Arguments::select_compilation_mode_ergonomically() { -#if defined(_WINDOWS) && !defined(_LP64) - if (FLAG_IS_DEFAULT(NeverActAsServerClassMachine)) { - FLAG_SET_ERGO(bool, NeverActAsServerClassMachine, true); - } -#endif - if (NeverActAsServerClassMachine) { - set_client_compilation_mode(); - } -} -#endif //TIERED - -#if INCLUDE_JVMCI -void Arguments::set_jvmci_specific_flags() { - if (UseJVMCICompiler) { - if (FLAG_IS_DEFAULT(TypeProfileWidth)) { - FLAG_SET_DEFAULT(TypeProfileWidth, 8); - } - if (FLAG_IS_DEFAULT(OnStackReplacePercentage)) { - FLAG_SET_DEFAULT(OnStackReplacePercentage, 933); - } - if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) { - FLAG_SET_DEFAULT(ReservedCodeCacheSize, 64*M); - } - if (FLAG_IS_DEFAULT(InitialCodeCacheSize)) { - FLAG_SET_DEFAULT(InitialCodeCacheSize, 16*M); - } - if (FLAG_IS_DEFAULT(MetaspaceSize)) { - FLAG_SET_DEFAULT(MetaspaceSize, 12*M); - } - if (FLAG_IS_DEFAULT(NewSizeThreadIncrease)) { - FLAG_SET_DEFAULT(NewSizeThreadIncrease, 4*K); - } - if (TieredStopAtLevel != CompLevel_full_optimization) { - // Currently JVMCI compiler can only work at the full optimization level - warning("forcing TieredStopAtLevel to full optimization because JVMCI is enabled"); - TieredStopAtLevel = CompLevel_full_optimization; - } - if (FLAG_IS_DEFAULT(TypeProfileLevel)) { - FLAG_SET_DEFAULT(TypeProfileLevel, 0); - } - } -} -#endif - jint Arguments::set_ergonomics_flags() { -#ifdef TIERED - if (!compilation_mode_selected()) { - select_compilation_mode_ergonomically(); - } -#endif - GCConfig::initialize(); -#if defined(IA32) - // Only server compiler can optimize safepoints well enough. - if (!is_server_compilation_mode_vm()) { - FLAG_SET_ERGO_IF_DEFAULT(bool, ThreadLocalHandshakes, false); - } -#endif - set_conservative_max_heap_alignment(); #ifndef ZERO @@ -2158,12 +1998,11 @@ //=========================================================================================================== // Parsing of main arguments -#if INCLUDE_JVMCI -// Check consistency of jvmci vm argument settings. -bool Arguments::check_jvmci_args_consistency() { - return JVMCIGlobals::check_jvmci_flags_are_consistent(); -} -#endif //INCLUDE_JVMCI +unsigned int addreads_count = 0; +unsigned int addexports_count = 0; +unsigned int addopens_count = 0; +unsigned int addmods_count = 0; +unsigned int patch_mod_count = 0; // Check the consistency of vm_init_args bool Arguments::check_vm_args_consistency() { @@ -2192,52 +2031,24 @@ #endif } -#if INCLUDE_JVMCI - status = status && check_jvmci_args_consistency(); + if (UseCompiler && is_interpreter_only()) { + if (!FLAG_IS_DEFAULT(UseCompiler)) { + warning("UseCompiler disabled due to -Xint."); + } + FLAG_SET_CMDLINE(bool, UseCompiler, false); + } - if (EnableJVMCI) { + status = CompilerConfig::check_comp_args_consistency(status); +#if INCLUDE_JVMCI + if (status && EnableJVMCI) { PropertyList_unique_add(&_system_properties, "jdk.internal.vm.ci.enabled", "true", AddProperty, UnwriteableProperty, InternalProperty); - - if (!ScavengeRootsInCode) { - warning("forcing ScavengeRootsInCode non-zero because JVMCI is enabled"); - ScavengeRootsInCode = 1; + if (!create_numbered_property("jdk.module.addmods", "jdk.internal.vm.ci", addmods_count++)) { + return false; } } #endif - // Check lower bounds of the code cache - // Template Interpreter code is approximately 3X larger in debug builds. - uint min_code_cache_size = CodeCacheMinimumUseSpace DEBUG_ONLY(* 3); - if (ReservedCodeCacheSize < InitialCodeCacheSize) { - jio_fprintf(defaultStream::error_stream(), - "Invalid ReservedCodeCacheSize: %dK. Must be at least InitialCodeCacheSize=%dK.\n", - ReservedCodeCacheSize/K, InitialCodeCacheSize/K); - status = false; - } else if (ReservedCodeCacheSize < min_code_cache_size) { - jio_fprintf(defaultStream::error_stream(), - "Invalid ReservedCodeCacheSize=%dK. Must be at least %uK.\n", ReservedCodeCacheSize/K, - min_code_cache_size/K); - status = false; - } else if (ReservedCodeCacheSize > CODE_CACHE_SIZE_LIMIT) { - // Code cache size larger than CODE_CACHE_SIZE_LIMIT is not supported. - jio_fprintf(defaultStream::error_stream(), - "Invalid ReservedCodeCacheSize=%dM. Must be at most %uM.\n", ReservedCodeCacheSize/M, - CODE_CACHE_SIZE_LIMIT/M); - status = false; - } else if (NonNMethodCodeHeapSize < min_code_cache_size) { - jio_fprintf(defaultStream::error_stream(), - "Invalid NonNMethodCodeHeapSize=%dK. Must be at least %uK.\n", NonNMethodCodeHeapSize/K, - min_code_cache_size/K); - status = false; - } - -#ifdef _LP64 - if (!FLAG_IS_DEFAULT(CICompilerCount) && !FLAG_IS_DEFAULT(CICompilerCountPerCPU) && CICompilerCountPerCPU) { - warning("The VM option CICompilerCountPerCPU overrides CICompilerCount."); - } -#endif - #ifndef SUPPORT_RESERVED_STACK_AREA if (StackReservedPages != 0) { FLAG_SET_CMDLINE(intx, StackReservedPages, 0); @@ -2245,37 +2056,6 @@ } #endif - if (BackgroundCompilation && (CompileTheWorld || ReplayCompiles)) { - if (!FLAG_IS_DEFAULT(BackgroundCompilation)) { - warning("BackgroundCompilation disabled due to CompileTheWorld or ReplayCompiles options."); - } - FLAG_SET_CMDLINE(bool, BackgroundCompilation, false); - } - if (UseCompiler && is_interpreter_only()) { - if (!FLAG_IS_DEFAULT(UseCompiler)) { - warning("UseCompiler disabled due to -Xint."); - } - FLAG_SET_CMDLINE(bool, UseCompiler, false); - } -#ifdef COMPILER2 - if (PostLoopMultiversioning && !RangeCheckElimination) { - if (!FLAG_IS_DEFAULT(PostLoopMultiversioning)) { - warning("PostLoopMultiversioning disabled because RangeCheckElimination is disabled."); - } - FLAG_SET_CMDLINE(bool, PostLoopMultiversioning, false); - } - if (UseCountedLoopSafepoints && LoopStripMiningIter == 0) { - if (!FLAG_IS_DEFAULT(UseCountedLoopSafepoints) || !FLAG_IS_DEFAULT(LoopStripMiningIter)) { - warning("When counted loop safepoints are enabled, LoopStripMiningIter must be at least 1 (a safepoint every 1 iteration): setting it to 1"); - } - LoopStripMiningIter = 1; - } else if (!UseCountedLoopSafepoints && LoopStripMiningIter > 0) { - if (!FLAG_IS_DEFAULT(UseCountedLoopSafepoints) || !FLAG_IS_DEFAULT(LoopStripMiningIter)) { - warning("Disabling counted safepoints implies no loop strip mining: setting LoopStripMiningIter to 0"); - } - LoopStripMiningIter = 0; - } -#endif if (!FLAG_IS_DEFAULT(AllocateHeapAt)) { if ((UseNUMAInterleaving && !FLAG_IS_DEFAULT(UseNUMAInterleaving)) || (UseNUMA && !FLAG_IS_DEFAULT(UseNUMA))) { log_warning(arguments) ("NUMA support for Heap depends on the file system when AllocateHeapAt option is used.\n"); @@ -2337,12 +2117,6 @@ return false; } -unsigned int addreads_count = 0; -unsigned int addexports_count = 0; -unsigned int addopens_count = 0; -unsigned int addmods_count = 0; -unsigned int patch_mod_count = 0; - bool Arguments::create_property(const char* prop_name, const char* prop_value, PropertyInternal internal) { size_t prop_len = strlen(prop_name) + strlen(prop_value) + 2; char* property = AllocateHeap(prop_len, mtArguments); @@ -3298,7 +3072,7 @@ // This must be done after all arguments have been processed. // java_compiler() true means set to "NONE" or empty. - if (java_compiler() && !xdebug_mode()) { + if (java_compiler() && !TieredCompilation && !xdebug_mode()) { // For backwards compatibility, we switch to interpreted mode if // -Djava.compiler="NONE" or "" is specified AND "-Xdebug" was // not specified. @@ -3327,13 +3101,6 @@ FLAG_SET_DEFAULT(UseLargePages, false); } -#elif defined(COMPILER2) - if (!FLAG_IS_DEFAULT(OptoLoopAlignment) && FLAG_IS_DEFAULT(MaxLoopPad)) { - FLAG_SET_DEFAULT(MaxLoopPad, OptoLoopAlignment-1); - } -#endif - -#if !COMPILER2_OR_JVMCI UNSUPPORTED_OPTION(ProfileInterpreter); NOT_PRODUCT(UNSUPPORTED_OPTION(TraceProfileInterpreter)); #endif @@ -3343,23 +3110,10 @@ UNSUPPORTED_OPTION(TieredCompilation); #endif -#if INCLUDE_JVMCI - if (EnableJVMCI && - !create_numbered_property("jdk.module.addmods", "jdk.internal.vm.ci", addmods_count++)) { - return JNI_ENOMEM; - } -#endif - if (!check_vm_args_consistency()) { return JNI_ERR; } -#if INCLUDE_JVMCI - if (UseJVMCICompiler) { - Compilation_mode = CompMode_server; - } -#endif - #if INCLUDE_CDS if (DumpSharedSpaces) { // Disable biased locking now as it interferes with the clean up of @@ -4118,41 +3872,8 @@ jint result = set_ergonomics_flags(); if (result != JNI_OK) return result; -#if INCLUDE_JVMCI - set_jvmci_specific_flags(); -#endif - set_shared_spaces_flags(); - if (TieredCompilation) { - set_tiered_flags(); - } else { - int max_compilation_policy_choice = 1; -#ifdef COMPILER2 - if (is_server_compilation_mode_vm()) { - max_compilation_policy_choice = 2; - } -#endif - // Check if the policy is valid. - if (CompilationPolicyChoice >= max_compilation_policy_choice) { - vm_exit_during_initialization( - "Incompatible compilation policy selected", NULL); - } - // Scale CompileThreshold - // CompileThresholdScaling == 0.0 is equivalent to -Xint and leaves CompileThreshold unchanged. - if (!FLAG_IS_DEFAULT(CompileThresholdScaling) && CompileThresholdScaling > 0.0) { - FLAG_SET_ERGO(intx, CompileThreshold, scaled_compile_threshold(CompileThreshold)); - } - } - -#ifdef COMPILER2 -#ifndef PRODUCT - if (PrintIdealGraphLevel > 0) { - FLAG_SET_ERGO(bool, PrintIdealGraph, true); - } -#endif -#endif - // Set heap size based on available physical memory set_heap_size(); @@ -4161,6 +3882,10 @@ // Initialize Metaspace flags and alignments Metaspace::ergo_initialize(); + // Set compiler flags after GC is selected and GC specific + // flags (LoopStripMiningIter) are set. + CompilerConfig::ergo_initialize(); + // Set bytecode rewriting flags set_bytecode_flags(); @@ -4198,28 +3923,6 @@ LP64_ONLY(FLAG_SET_DEFAULT(UseCompressedClassPointers, false)); #endif // CC_INTERP -#ifdef COMPILER2 - if (!EliminateLocks) { - EliminateNestedLocks = false; - } - if (!Inline) { - IncrementalInline = false; - } -#ifndef PRODUCT - if (!IncrementalInline) { - AlwaysIncrementalInline = false; - } -#endif - if (!UseTypeSpeculation && FLAG_IS_DEFAULT(TypeProfileLevel)) { - // nothing to use the profiling, turn if off - FLAG_SET_DEFAULT(TypeProfileLevel, 0); - } - if (FLAG_IS_DEFAULT(LoopStripMiningIterShortLoop)) { - // blind guess - LoopStripMiningIterShortLoop = LoopStripMiningIter / 10; - } -#endif - if (PrintAssembly && FLAG_IS_DEFAULT(DebugNonSafepoints)) { warning("PrintAssembly is enabled; turning on DebugNonSafepoints to gain additional output"); DebugNonSafepoints = true; @@ -4229,11 +3932,6 @@ warning("Setting CompressedClassSpaceSize has no effect when compressed class pointers are not used"); } - if (UseOnStackReplacement && !UseLoopCounter) { - warning("On-stack-replacement requires loop counters; enabling loop counters"); - FLAG_SET_DEFAULT(UseLoopCounter, true); - } - #ifndef PRODUCT if (!LogVMOutput && FLAG_IS_DEFAULT(LogVMOutput)) { if (use_vm_log()) { @@ -4259,6 +3957,13 @@ } #endif +#if defined(IA32) + // Only server compiler can optimize safepoints well enough. + if (!is_server_compilation_mode_vm()) { + FLAG_SET_ERGO_IF_DEFAULT(bool, ThreadLocalHandshakes, false); + } +#endif + // ThreadLocalHandshakesConstraintFunc handles the constraints. if (FLAG_IS_DEFAULT(ThreadLocalHandshakes) || !SafepointMechanism::supports_thread_local_poll()) { log_debug(ergo)("ThreadLocalHandshakes %s", ThreadLocalHandshakes ? "enabled." : "disabled."); --- old/src/hotspot/share/runtime/arguments.hpp 2018-05-03 12:25:42.000000000 -0700 +++ new/src/hotspot/share/runtime/arguments.hpp 2018-05-03 12:25:42.000000000 -0700 @@ -371,13 +371,6 @@ static intx _Tier3InvokeNotifyFreqLog; static intx _Tier4InvocationThreshold; - // Compilation mode. - static bool compilation_mode_selected(); - static void select_compilation_mode_ergonomically(); - - // Tiered - static void set_tiered_flags(); - // GC ergonomics static void set_conservative_max_heap_alignment(); static void set_use_compressed_oops(); @@ -468,18 +461,6 @@ static void add_string(char*** bldarray, int* count, const char* arg); static const char* build_resource_string(char** args, int count); - static bool methodExists( - char* className, char* methodName, - int classesNum, char** classes, bool* allMethods, - int methodsNum, char** methods, bool* allClasses - ); - - static void parseOnlyLine( - const char* line, - short* classesNum, short* classesMax, char*** classes, bool** allMethods, - short* methodsNum, short* methodsMax, char*** methods, bool** allClasses - ); - // Returns true if the flag is obsolete (and not yet expired). // In this case the 'version' buffer is filled in with // the version number when the flag became obsolete. @@ -504,38 +485,10 @@ static const char* handle_aliases_and_deprecation(const char* arg, bool warn); static bool lookup_logging_aliases(const char* arg, char* buffer); static AliasedLoggingFlag catch_logging_aliases(const char* name, bool on); - static short CompileOnlyClassesNum; - static short CompileOnlyClassesMax; - static char** CompileOnlyClasses; - static bool* CompileOnlyAllMethods; - - static short CompileOnlyMethodsNum; - static short CompileOnlyMethodsMax; - static char** CompileOnlyMethods; - static bool* CompileOnlyAllClasses; - - static short InterpretOnlyClassesNum; - static short InterpretOnlyClassesMax; - static char** InterpretOnlyClasses; - static bool* InterpretOnlyAllMethods; - - static bool CheckCompileOnly; static char* SharedArchivePath; public: - // Scale compile thresholds - // Returns threshold scaled with CompileThresholdScaling - static intx scaled_compile_threshold(intx threshold, double scale); - static intx scaled_compile_threshold(intx threshold) { - return scaled_compile_threshold(threshold, CompileThresholdScaling); - } - // Returns freq_log scaled with CompileThresholdScaling - static intx scaled_freq_log(intx freq_log, double scale); - static intx scaled_freq_log(intx freq_log) { - return scaled_freq_log(freq_log, CompileThresholdScaling); - } - // Parses the arguments, first phase static jint parse(const JavaVMInitArgs* args); // Apply ergonomics @@ -543,11 +496,6 @@ // Adjusts the arguments after the OS have adjusted the arguments static jint adjust_after_os(); -#if INCLUDE_JVMCI - // Check consistency of jvmci vm argument settings. - static bool check_jvmci_args_consistency(); - static void set_jvmci_specific_flags(); -#endif // Check for consistency in the selection of the garbage collector. static bool check_gc_consistency(); // Check user-selected gc // Check consistency or otherwise of VM argument settings @@ -621,19 +569,8 @@ static exit_hook_t exit_hook() { return _exit_hook; } static vfprintf_hook_t vfprintf_hook() { return _vfprintf_hook; } - static bool GetCheckCompileOnly () { return CheckCompileOnly; } - static const char* GetSharedArchivePath() { return SharedArchivePath; } - static bool CompileMethod(char* className, char* methodName) { - return - methodExists( - className, methodName, - CompileOnlyClassesNum, CompileOnlyClasses, CompileOnlyAllMethods, - CompileOnlyMethodsNum, CompileOnlyMethods, CompileOnlyAllClasses - ); - } - // Java launcher properties static void process_sun_java_launcher_properties(JavaVMInitArgs* args); --- old/src/hotspot/share/runtime/flags/jvmFlagConstraintsCompiler.cpp 2018-05-03 12:25:43.000000000 -0700 +++ new/src/hotspot/share/runtime/flags/jvmFlagConstraintsCompiler.cpp 2018-05-03 12:25:43.000000000 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include "precompiled.hpp" #include "code/relocInfo.hpp" -#include "compiler/compilerDefinitions.hpp" +#include "compiler/compilerConfig.hpp" #include "oops/metadata.hpp" #include "runtime/os.hpp" #include "interpreter/invocationCounter.hpp" --- old/src/hotspot/share/runtime/rtmLocking.cpp 2018-05-03 12:25:44.000000000 -0700 +++ new/src/hotspot/share/runtime/rtmLocking.cpp 2018-05-03 12:25:44.000000000 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ */ #include "precompiled.hpp" -#include "compiler/compilerDefinitions.hpp" +#include "compiler/compilerConfig.hpp" #if INCLUDE_RTM_OPT --- old/test/hotspot/jtreg/compiler/arguments/CheckCompileThresholdScaling.java 2018-05-03 12:25:45.000000000 -0700 +++ new/test/hotspot/jtreg/compiler/arguments/CheckCompileThresholdScaling.java 2018-05-03 12:25:45.000000000 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -125,7 +125,7 @@ "interpreted mode" }, { - "intx CompileThreshold = 0 {pd product} {command line, ergonomic}", + "intx CompileThreshold = 0 {pd product} {command line}", "double CompileThresholdScaling = 0.750000 {product} {command line}", "interpreted mode" } --- old/test/hotspot/jtreg/gc/TestMemoryInitializationWithCMS.java 2018-05-03 12:25:46.000000000 -0700 +++ new/test/hotspot/jtreg/gc/TestMemoryInitializationWithCMS.java 2018-05-03 12:25:46.000000000 -0700 @@ -1,6 +1,5 @@ - /* - * Copyright (c) 2002, 2017 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2018 Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +25,7 @@ * @test TestMemoryInitializationWithCMS * @key gc * @bug 4668531 - * @requires vm.debug & vm.gc.ConcMarkSweep + * @requires vm.debug & vm.gc.ConcMarkSweep & !vm.graal.enabled * @summary Simple test for -XX:+CheckMemoryInitialization doesn't crash VM * @run main/othervm -XX:+UseConcMarkSweepGC -XX:+CheckMemoryInitialization TestMemoryInitializationWithCMS */ --- old/test/hotspot/jtreg/gc/arguments/TestCMSHeapSizeFlags.java 2018-05-03 12:25:47.000000000 -0700 +++ new/test/hotspot/jtreg/gc/arguments/TestCMSHeapSizeFlags.java 2018-05-03 12:25:47.000000000 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ * @test TestCMSHeapSizeFlags * @key gc * @bug 8006088 - * @requires vm.gc.ConcMarkSweep + * @requires vm.gc.ConcMarkSweep & !vm.graal.enabled * @summary Tests argument processing for initial and maximum heap size for the CMS collector * @library /test/lib * @modules java.base/jdk.internal.misc --- old/test/hotspot/jtreg/gc/cms/DisableResizePLAB.java 2018-05-03 12:25:48.000000000 -0700 +++ new/test/hotspot/jtreg/gc/cms/DisableResizePLAB.java 2018-05-03 12:25:48.000000000 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ * @key gc * @bug 8060467 * @author filipp.zhinkin@oracle.com, john.coomes@oracle.com - * @requires vm.gc.ConcMarkSweep + * @requires vm.gc.ConcMarkSweep & !vm.graal.enabled * @summary Run CMS with PLAB resizing disabled and a small OldPLABSize * @run main/othervm -XX:+UseConcMarkSweepGC -XX:-ResizePLAB -XX:OldPLABSize=1k -Xmx256m -Xlog:gc=debug DisableResizePLAB */ --- old/test/hotspot/jtreg/gc/cms/TestBubbleUpRef.java 2018-05-03 12:25:49.000000000 -0700 +++ new/test/hotspot/jtreg/gc/cms/TestBubbleUpRef.java 2018-05-03 12:25:49.000000000 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,7 @@ /* * @test - * @requires vm.gc.ConcMarkSweep + * @requires vm.gc.ConcMarkSweep & !vm.graal.enabled * @key cte_test * @bug 4950157 * @summary Stress the behavior of ergonomics when the heap is nearly full and --- old/test/hotspot/jtreg/gc/cms/TestCMSScavengeBeforeRemark.java 2018-05-03 12:25:50.000000000 -0700 +++ new/test/hotspot/jtreg/gc/cms/TestCMSScavengeBeforeRemark.java 2018-05-03 12:25:50.000000000 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ * @test TestCMSScavengeBeforeRemark * @key gc * @bug 8139868 - * @requires vm.gc.ConcMarkSweep + * @requires vm.gc.ConcMarkSweep & !vm.graal.enabled * @summary Run CMS with CMSScavengeBeforeRemark * @run main/othervm -XX:+UseConcMarkSweepGC -XX:+CMSScavengeBeforeRemark -XX:+ExplicitGCInvokesConcurrent -Xmx256m -Xlog:gc=debug TestCMSScavengeBeforeRemark */ --- old/test/hotspot/jtreg/gc/cms/TestMBeanCMS.java 2018-05-03 12:25:51.000000000 -0700 +++ new/test/hotspot/jtreg/gc/cms/TestMBeanCMS.java 2018-05-03 12:25:51.000000000 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ /* * @test TestMBeanCMS.java * @bug 6581734 - * @requires vm.gc.ConcMarkSweep + * @requires vm.gc.ConcMarkSweep & !vm.graal.enabled * @summary CMS Old Gen's collection usage is zero after GC which is incorrect * @modules java.management * @run main/othervm -Xmx512m -verbose:gc -XX:+UseConcMarkSweepGC TestMBeanCMS --- old/test/hotspot/jtreg/gc/concurrent_phase_control/TestConcurrentPhaseControlCMS.java 2018-05-03 12:25:52.000000000 -0700 +++ new/test/hotspot/jtreg/gc/concurrent_phase_control/TestConcurrentPhaseControlCMS.java 2018-05-03 12:25:52.000000000 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ /* * @test TestConcurrentPhaseControlCMS * @bug 8169517 - * @requires vm.gc.ConcMarkSweep + * @requires vm.gc.ConcMarkSweep & !vm.graal.enabled * @summary Verify CMS GC doesn't support WhiteBox concurrent phase control. * @key gc * @modules java.base --- old/test/hotspot/jtreg/gc/metaspace/TestMetaspaceCMSCancel.java 2018-05-03 12:25:53.000000000 -0700 +++ new/test/hotspot/jtreg/gc/metaspace/TestMetaspaceCMSCancel.java 2018-05-03 12:25:53.000000000 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,7 @@ /* @test TestMetaspaceCMSCancel * @bug 8026752 * @summary Tests cancel of CMS concurrent cycle for Metaspace after a full GC + * @requires !vm.graal.enabled * @library /test/lib * @modules java.base/jdk.internal.misc * @build sun.hotspot.WhiteBox --- old/test/hotspot/jtreg/gc/startup_warnings/TestCMS.java 2018-05-03 12:25:54.000000000 -0700 +++ new/test/hotspot/jtreg/gc/startup_warnings/TestCMS.java 2018-05-03 12:25:54.000000000 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,14 +22,15 @@ */ /* -* @test TestCMS -* @key gc -* @bug 8006398 8155948 8179013 -* @summary Test that CMS prints a warning message -* @library /test/lib -* @modules java.base/jdk.internal.misc -* java.management -*/ + * @test TestCMS + * @key gc + * @bug 8006398 8155948 8179013 + * @summary Test that CMS prints a warning message + * @requires !vm.graal.enabled + * @library /test/lib + * @modules java.base/jdk.internal.misc + * java.management + */ import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.OutputAnalyzer; --- old/test/hotspot/jtreg/gc/stress/TestReclaimStringsLeaksMemory.java 2018-05-03 12:25:55.000000000 -0700 +++ new/test/hotspot/jtreg/gc/stress/TestReclaimStringsLeaksMemory.java 2018-05-03 12:25:55.000000000 -0700 @@ -25,8 +25,7 @@ * @test TestReclaimStringsLeaksMemory * @bug 8180048 * @summary Ensure that during a Full GC interned string memory is reclaimed completely. - * @requires vm.gc=="null" - * @requires !vm.debug + * @requires vm.gc=="null" & !vm.graal.enabled & !vm.debug * @key gc * @library /test/lib * @modules java.base/jdk.internal.misc --- old/test/hotspot/jtreg/gc/stress/gcbasher/TestGCBasherWithCMS.java 2018-05-03 12:25:56.000000000 -0700 +++ new/test/hotspot/jtreg/gc/stress/gcbasher/TestGCBasherWithCMS.java 2018-05-03 12:25:56.000000000 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,7 @@ * @test TestGCBasherWithCMS * @key gc stress * @requires vm.gc.ConcMarkSweep - * @requires vm.flavor == "server" & !vm.emulatedClient + * @requires vm.flavor == "server" & !vm.emulatedClient & !vm.graal.enabled * @summary Stress the CMS GC by trying to make old objects more likely to be garbage than young objects. * @run main/othervm/timeout=200 -Xlog:gc*=info -Xmx256m -server -XX:+UseConcMarkSweepGC TestGCBasherWithCMS 120000 */ --- old/test/hotspot/jtreg/gc/stress/gclocker/TestGCLockerWithCMS.java 2018-05-03 12:25:57.000000000 -0700 +++ new/test/hotspot/jtreg/gc/stress/gclocker/TestGCLockerWithCMS.java 2018-05-03 12:25:57.000000000 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ /* * @test TestGCLockerWithCMS * @key gc - * @requires vm.gc.ConcMarkSweep + * @requires vm.gc.ConcMarkSweep & !vm.graal.enabled * @summary Stress CMS' GC locker by calling GetPrimitiveArrayCritical while concurrently filling up old gen. * @run main/native/othervm/timeout=200 -Xlog:gc*=info -Xms1500m -Xmx1500m -XX:+UseConcMarkSweepGC TestGCLockerWithCMS */ --- old/test/hotspot/jtreg/gc/stress/gcold/TestGCOldWithCMS.java 2018-05-03 12:25:59.000000000 -0700 +++ new/test/hotspot/jtreg/gc/stress/gcold/TestGCOldWithCMS.java 2018-05-03 12:25:59.000000000 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ /* * @test TestGCOldWithCMS * @key gc - * @requires vm.gc.ConcMarkSweep + * @requires vm.gc.ConcMarkSweep & !vm.graal.enabled * @summary Stress the CMS GC by trying to make old objects more likely to be garbage than young objects. * @run main/othervm -Xmx384M -XX:+UseConcMarkSweepGC TestGCOldWithCMS 50 1 20 10 10000 */ --- old/test/hotspot/jtreg/gc/stress/systemgc/TestSystemGCWithCMS.java 2018-05-03 12:26:00.000000000 -0700 +++ new/test/hotspot/jtreg/gc/stress/systemgc/TestSystemGCWithCMS.java 2018-05-03 12:26:00.000000000 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ * @test TestSystemGCWithCMS * @key gc stress * @bug 8190703 - * @requires vm.gc.ConcMarkSweep + * @requires vm.gc.ConcMarkSweep & !vm.graal.enabled * @summary Stress the CMS GC full GC by allocating objects of different lifetimes concurrently with System.gc(). * @run main/othervm/timeout=300 -Xlog:gc*=info -Xmx512m -XX:+UseConcMarkSweepGC TestSystemGCWithCMS 270 */ --- old/test/jdk/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java 2018-05-03 12:26:01.000000000 -0700 +++ new/test/jdk/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java 2018-05-03 12:26:01.000000000 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ * @test * @bug 8028994 * @author Staffan Larsen + * @comment Graal does not support CMS + * @requires !vm.graal.enabled * @library /lib/testlibrary * @modules jdk.attach/sun.tools.attach * jdk.management --- old/test/jdk/java/lang/management/MemoryMXBean/MemoryManagementConcMarkSweepGC.sh 2018-05-03 12:26:02.000000000 -0700 +++ new/test/jdk/java/lang/management/MemoryMXBean/MemoryManagementConcMarkSweepGC.sh 2018-05-03 12:26:02.000000000 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,7 @@ # @summary Run MemoryManagement test with concurrent mark sweep GC # @author Mandy Chung # -# @requires vm.gc=="ConcMarkSweep" | vm.gc=="null" +# @requires (vm.gc=="ConcMarkSweep" | vm.gc=="null") & !vm.graal.enabled # # @run build MemoryManagement # @run shell/timeout=600 MemoryManagementConcMarkSweepGC.sh --- /dev/null 2018-05-03 12:26:03.000000000 -0700 +++ new/src/hotspot/share/compiler/compilerConfig.cpp 2018-05-03 12:26:03.000000000 -0700 @@ -0,0 +1,457 @@ +/* + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#include "precompiled.hpp" +#include "runtime/globals.hpp" +#include "runtime/globals_extension.hpp" +#include "compiler/compilerConfig.hpp" +#include "gc/shared/gcConfig.hpp" +#include "utilities/defaultStream.hpp" + +const char* compilertype2name_tab[compiler_number_of_types] = { + "", + "c1", + "c2", + "jvmci" +}; + +#if defined(COMPILER2) +CompLevel CompLevel_highest_tier = CompLevel_full_optimization; // pure C2 and tiered or JVMCI and tiered +#elif defined(COMPILER1) +CompLevel CompLevel_highest_tier = CompLevel_simple; // pure C1 or JVMCI +#else +CompLevel CompLevel_highest_tier = CompLevel_none; +#endif + +#if defined(TIERED) +CompLevel CompLevel_initial_compile = CompLevel_full_profile; // tiered +#elif defined(COMPILER1) || INCLUDE_JVMCI +CompLevel CompLevel_initial_compile = CompLevel_simple; // pure C1 or JVMCI +#elif defined(COMPILER2) +CompLevel CompLevel_initial_compile = CompLevel_full_optimization; // pure C2 +#else +CompLevel CompLevel_initial_compile = CompLevel_none; +#endif + +#if defined(COMPILER2) +CompMode Compilation_mode = CompMode_server; +#elif defined(COMPILER1) +CompMode Compilation_mode = CompMode_client; +#else +CompMode Compilation_mode = CompMode_none; +#endif + + +// Returns threshold scaled with CompileThresholdScaling +intx CompilerConfig::scaled_compile_threshold(intx threshold) { + return scaled_compile_threshold(threshold, CompileThresholdScaling); +} + +// Returns freq_log scaled with CompileThresholdScaling +intx CompilerConfig::scaled_freq_log(intx freq_log) { + return scaled_freq_log(freq_log, CompileThresholdScaling); +} + +// Returns threshold scaled with the value of scale. +// If scale < 0.0, threshold is returned without scaling. +intx CompilerConfig::scaled_compile_threshold(intx threshold, double scale) { + if (scale == 1.0 || scale < 0.0) { + return threshold; + } else { + return (intx)(threshold * scale); + } +} + +// Returns freq_log scaled with the value of scale. +// Returned values are in the range of [0, InvocationCounter::number_of_count_bits + 1]. +// If scale < 0.0, freq_log is returned without scaling. +intx CompilerConfig::scaled_freq_log(intx freq_log, double scale) { + // Check if scaling is necessary or if negative value was specified. + if (scale == 1.0 || scale < 0.0) { + return freq_log; + } + // Check values to avoid calculating log2 of 0. + if (scale == 0.0 || freq_log == 0) { + return 0; + } + // Determine the maximum notification frequency value currently supported. + // The largest mask value that the interpreter/C1 can handle is + // of length InvocationCounter::number_of_count_bits. Mask values are always + // one bit shorter then the value of the notification frequency. Set + // max_freq_bits accordingly. + intx max_freq_bits = InvocationCounter::number_of_count_bits + 1; + intx scaled_freq = scaled_compile_threshold((intx)1 << freq_log, scale); + if (scaled_freq == 0) { + // Return 0 right away to avoid calculating log2 of 0. + return 0; + } else if (scaled_freq > nth_bit(max_freq_bits)) { + return max_freq_bits; + } else { + return log2_intptr(scaled_freq); + } +} + +void CompilerConfig::set_tiered_flags() { + // With tiered, set default policy to AdvancedThresholdPolicy, which is 3. + if (FLAG_IS_DEFAULT(CompilationPolicyChoice)) { + FLAG_SET_DEFAULT(CompilationPolicyChoice, 3); + } + if (CompilationPolicyChoice < 2) { + vm_exit_during_initialization( + "Incompatible compilation policy selected", NULL); + } + // Increase the code cache size - tiered compiles a lot more. + if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) { + FLAG_SET_ERGO(uintx, ReservedCodeCacheSize, + MIN2(CODE_CACHE_DEFAULT_LIMIT, ReservedCodeCacheSize * 5)); + } + // Enable SegmentedCodeCache if TieredCompilation is enabled and ReservedCodeCacheSize >= 240M + if (FLAG_IS_DEFAULT(SegmentedCodeCache) && ReservedCodeCacheSize >= 240*M) { + FLAG_SET_ERGO(bool, SegmentedCodeCache, true); + } + if (!UseInterpreter) { // -Xcomp + Tier3InvokeNotifyFreqLog = 0; + Tier4InvocationThreshold = 0; + } + + if (CompileThresholdScaling < 0) { + vm_exit_during_initialization("Negative value specified for CompileThresholdScaling", NULL); + } + + // Scale tiered compilation thresholds. + // CompileThresholdScaling == 0.0 is equivalent to -Xint and leaves compilation thresholds unchanged. + if (!FLAG_IS_DEFAULT(CompileThresholdScaling) && CompileThresholdScaling > 0.0) { + FLAG_SET_ERGO(intx, Tier0InvokeNotifyFreqLog, scaled_freq_log(Tier0InvokeNotifyFreqLog)); + FLAG_SET_ERGO(intx, Tier0BackedgeNotifyFreqLog, scaled_freq_log(Tier0BackedgeNotifyFreqLog)); + + FLAG_SET_ERGO(intx, Tier3InvocationThreshold, scaled_compile_threshold(Tier3InvocationThreshold)); + FLAG_SET_ERGO(intx, Tier3MinInvocationThreshold, scaled_compile_threshold(Tier3MinInvocationThreshold)); + FLAG_SET_ERGO(intx, Tier3CompileThreshold, scaled_compile_threshold(Tier3CompileThreshold)); + FLAG_SET_ERGO(intx, Tier3BackEdgeThreshold, scaled_compile_threshold(Tier3BackEdgeThreshold)); + + // Tier2{Invocation,MinInvocation,Compile,Backedge}Threshold should be scaled here + // once these thresholds become supported. + + FLAG_SET_ERGO(intx, Tier2InvokeNotifyFreqLog, scaled_freq_log(Tier2InvokeNotifyFreqLog)); + FLAG_SET_ERGO(intx, Tier2BackedgeNotifyFreqLog, scaled_freq_log(Tier2BackedgeNotifyFreqLog)); + + FLAG_SET_ERGO(intx, Tier3InvokeNotifyFreqLog, scaled_freq_log(Tier3InvokeNotifyFreqLog)); + FLAG_SET_ERGO(intx, Tier3BackedgeNotifyFreqLog, scaled_freq_log(Tier3BackedgeNotifyFreqLog)); + + FLAG_SET_ERGO(intx, Tier23InlineeNotifyFreqLog, scaled_freq_log(Tier23InlineeNotifyFreqLog)); + + FLAG_SET_ERGO(intx, Tier4InvocationThreshold, scaled_compile_threshold(Tier4InvocationThreshold)); + FLAG_SET_ERGO(intx, Tier4MinInvocationThreshold, scaled_compile_threshold(Tier4MinInvocationThreshold)); + FLAG_SET_ERGO(intx, Tier4CompileThreshold, scaled_compile_threshold(Tier4CompileThreshold)); + FLAG_SET_ERGO(intx, Tier4BackEdgeThreshold, scaled_compile_threshold(Tier4BackEdgeThreshold)); + } +} + +#ifdef TIERED +void set_client_compilation_mode() { + Compilation_mode = CompMode_client; + CompLevel_highest_tier = CompLevel_simple; + CompLevel_initial_compile = CompLevel_simple; + FLAG_SET_ERGO(bool, TieredCompilation, false); + FLAG_SET_ERGO(bool, ProfileInterpreter, false); +#if INCLUDE_JVMCI + FLAG_SET_ERGO(bool, EnableJVMCI, false); + FLAG_SET_ERGO(bool, UseJVMCICompiler, false); +#endif +#if INCLUDE_AOT + FLAG_SET_ERGO(bool, UseAOT, false); +#endif + if (FLAG_IS_DEFAULT(NeverActAsServerClassMachine)) { + FLAG_SET_ERGO(bool, NeverActAsServerClassMachine, true); + } + if (FLAG_IS_DEFAULT(InitialCodeCacheSize)) { + FLAG_SET_ERGO(uintx, InitialCodeCacheSize, 160*K); + } + if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) { + FLAG_SET_ERGO(uintx, ReservedCodeCacheSize, 32*M); + } + if (FLAG_IS_DEFAULT(NonProfiledCodeHeapSize)) { + FLAG_SET_ERGO(uintx, NonProfiledCodeHeapSize, 27*M); + } + if (FLAG_IS_DEFAULT(ProfiledCodeHeapSize)) { + FLAG_SET_ERGO(uintx, ProfiledCodeHeapSize, 0); + } + if (FLAG_IS_DEFAULT(NonNMethodCodeHeapSize)) { + FLAG_SET_ERGO(uintx, NonNMethodCodeHeapSize, 5*M); + } + if (FLAG_IS_DEFAULT(CodeCacheExpansionSize)) { + FLAG_SET_ERGO(uintx, CodeCacheExpansionSize, 32*K); + } + if (FLAG_IS_DEFAULT(MetaspaceSize)) { + FLAG_SET_ERGO(size_t, MetaspaceSize, 12*M); + } + if (FLAG_IS_DEFAULT(MaxRAM)) { + // Do not use FLAG_SET_ERGO to update MaxRAM, as this will impact + // heap setting done based on available phys_mem (see Arguments::set_heap_size). + FLAG_SET_DEFAULT(MaxRAM, 1ULL*G); + } + if (FLAG_IS_DEFAULT(CompileThreshold)) { + FLAG_SET_ERGO(intx, CompileThreshold, 1500); + } + if (FLAG_IS_DEFAULT(OnStackReplacePercentage)) { + FLAG_SET_ERGO(intx, OnStackReplacePercentage, 933); + } + if (FLAG_IS_DEFAULT(CICompilerCount)) { + FLAG_SET_ERGO(intx, CICompilerCount, 1); + } +} + +bool compilation_mode_selected() { + return !FLAG_IS_DEFAULT(TieredCompilation) || + !FLAG_IS_DEFAULT(TieredStopAtLevel) || + !FLAG_IS_DEFAULT(UseAOT) + JVMCI_ONLY(|| !FLAG_IS_DEFAULT(EnableJVMCI) + || !FLAG_IS_DEFAULT(UseJVMCICompiler)); +} + +void select_compilation_mode_ergonomically() { +#if defined(_WINDOWS) && !defined(_LP64) + if (FLAG_IS_DEFAULT(NeverActAsServerClassMachine)) { + FLAG_SET_ERGO(bool, NeverActAsServerClassMachine, true); + } +#endif + if (NeverActAsServerClassMachine) { + set_client_compilation_mode(); + } +} +#endif //TIERED + +#if INCLUDE_JVMCI +void CompilerConfig::set_jvmci_specific_flags() { + if (UseJVMCICompiler) { + Compilation_mode = CompMode_server; + + if (FLAG_IS_DEFAULT(TypeProfileWidth)) { + FLAG_SET_DEFAULT(TypeProfileWidth, 8); + } + if (FLAG_IS_DEFAULT(OnStackReplacePercentage)) { + FLAG_SET_DEFAULT(OnStackReplacePercentage, 933); + } + if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) { + FLAG_SET_DEFAULT(ReservedCodeCacheSize, 64*M); + } + if (FLAG_IS_DEFAULT(InitialCodeCacheSize)) { + FLAG_SET_DEFAULT(InitialCodeCacheSize, 16*M); + } + if (FLAG_IS_DEFAULT(MetaspaceSize)) { + FLAG_SET_DEFAULT(MetaspaceSize, 12*M); + } + if (FLAG_IS_DEFAULT(NewSizeThreadIncrease)) { + FLAG_SET_DEFAULT(NewSizeThreadIncrease, 4*K); + } + if (TieredStopAtLevel != CompLevel_full_optimization) { + // Currently JVMCI compiler can only work at the full optimization level + warning("forcing TieredStopAtLevel to full optimization because JVMCI is enabled"); + FLAG_SET_ERGO(intx, TieredStopAtLevel, CompLevel_full_optimization); + } + if (FLAG_IS_DEFAULT(TypeProfileLevel)) { + FLAG_SET_DEFAULT(TypeProfileLevel, 0); + } + } +} +#endif // INCLUDE_JVMCI + +bool CompilerConfig::check_comp_args_consistency(bool status) { + // Check lower bounds of the code cache + // Template Interpreter code is approximately 3X larger in debug builds. + uint min_code_cache_size = CodeCacheMinimumUseSpace DEBUG_ONLY(* 3); + if (ReservedCodeCacheSize < InitialCodeCacheSize) { + jio_fprintf(defaultStream::error_stream(), + "Invalid ReservedCodeCacheSize: %dK. Must be at least InitialCodeCacheSize=%dK.\n", + ReservedCodeCacheSize/K, InitialCodeCacheSize/K); + status = false; + } else if (ReservedCodeCacheSize < min_code_cache_size) { + jio_fprintf(defaultStream::error_stream(), + "Invalid ReservedCodeCacheSize=%dK. Must be at least %uK.\n", ReservedCodeCacheSize/K, + min_code_cache_size/K); + status = false; + } else if (ReservedCodeCacheSize > CODE_CACHE_SIZE_LIMIT) { + // Code cache size larger than CODE_CACHE_SIZE_LIMIT is not supported. + jio_fprintf(defaultStream::error_stream(), + "Invalid ReservedCodeCacheSize=%dM. Must be at most %uM.\n", ReservedCodeCacheSize/M, + CODE_CACHE_SIZE_LIMIT/M); + status = false; + } else if (NonNMethodCodeHeapSize < min_code_cache_size) { + jio_fprintf(defaultStream::error_stream(), + "Invalid NonNMethodCodeHeapSize=%dK. Must be at least %uK.\n", NonNMethodCodeHeapSize/K, + min_code_cache_size/K); + status = false; + } + +#ifdef _LP64 + if (!FLAG_IS_DEFAULT(CICompilerCount) && !FLAG_IS_DEFAULT(CICompilerCountPerCPU) && CICompilerCountPerCPU) { + warning("The VM option CICompilerCountPerCPU overrides CICompilerCount."); + } +#endif + + if (BackgroundCompilation && (CompileTheWorld || ReplayCompiles)) { + if (!FLAG_IS_DEFAULT(BackgroundCompilation)) { + warning("BackgroundCompilation disabled due to CompileTheWorld or ReplayCompiles options."); + } + FLAG_SET_CMDLINE(bool, BackgroundCompilation, false); + } + +#ifdef COMPILER2 + if (PostLoopMultiversioning && !RangeCheckElimination) { + if (!FLAG_IS_DEFAULT(PostLoopMultiversioning)) { + warning("PostLoopMultiversioning disabled because RangeCheckElimination is disabled."); + } + FLAG_SET_CMDLINE(bool, PostLoopMultiversioning, false); + } + if (UseCountedLoopSafepoints && LoopStripMiningIter == 0) { + if (!FLAG_IS_DEFAULT(UseCountedLoopSafepoints) || !FLAG_IS_DEFAULT(LoopStripMiningIter)) { + warning("When counted loop safepoints are enabled, LoopStripMiningIter must be at least 1 (a safepoint every 1 iteration): setting it to 1"); + } + LoopStripMiningIter = 1; + } else if (!UseCountedLoopSafepoints && LoopStripMiningIter > 0) { + if (!FLAG_IS_DEFAULT(UseCountedLoopSafepoints) || !FLAG_IS_DEFAULT(LoopStripMiningIter)) { + warning("Disabling counted safepoints implies no loop strip mining: setting LoopStripMiningIter to 0"); + } + LoopStripMiningIter = 0; + } +#endif // COMPILER2 + + if (Arguments::is_interpreter_only()) { +#if INCLUDE_JVMCI + if (EnableJVMCI) { + if (!FLAG_IS_DEFAULT(EnableJVMCI) || !FLAG_IS_DEFAULT(UseJVMCICompiler)) { + warning("JVMCI Compiler disabled due to -Xint."); + } + FLAG_SET_CMDLINE(bool, EnableJVMCI, false); + FLAG_SET_CMDLINE(bool, UseJVMCICompiler, false); + } +#endif + if (UseCompiler) { + if (!FLAG_IS_DEFAULT(UseCompiler)) { + warning("UseCompiler disabled due to -Xint."); + } + FLAG_SET_CMDLINE(bool, UseCompiler, false); + } + if (ProfileInterpreter) { + if (!FLAG_IS_DEFAULT(ProfileInterpreter)) { + warning("ProfileInterpreter disabled due to -Xint."); + } + FLAG_SET_CMDLINE(bool, ProfileInterpreter, false); + } + if (TieredCompilation) { + if (!FLAG_IS_DEFAULT(TieredCompilation)) { + warning("TieredCompilation disabled due to -Xint."); + } + FLAG_SET_CMDLINE(bool, TieredCompilation, false); + } + } else { +#if INCLUDE_JVMCI + status = status && JVMCIGlobals::check_jvmci_flags_are_consistent(); +#endif + } + return status; +} + +void check_comp_supported_gc() { + if (!(UseSerialGC || UseParallelGC || UseParallelOldGC || UseG1GC || UseConcMarkSweepGC)) { + vm_exit_during_initialization("Compiler does not support selected GC", GCConfig::hs_err_name()); + } +#if INCLUDE_JVMCI + JVMCIGlobals::check_jvmci_supported_gc(); +#endif +} + +void CompilerConfig::ergo_initialize() { + if (Arguments::is_interpreter_only()) { + return; // Nothing to do. + } + + // Check that compiler supports selested GC. + // Should be done after GCConfig::initialize() was called. + check_comp_supported_gc(); + +#ifdef TIERED + if (!compilation_mode_selected()) { + select_compilation_mode_ergonomically(); + } +#endif + +#if INCLUDE_JVMCI + set_jvmci_specific_flags(); +#endif + + if (TieredCompilation) { + set_tiered_flags(); + } else { + int max_compilation_policy_choice = 1; +#ifdef COMPILER2 + if (is_server_compilation_mode_vm()) { + max_compilation_policy_choice = 2; + } +#endif + // Check if the policy is valid. + if (CompilationPolicyChoice >= max_compilation_policy_choice) { + vm_exit_during_initialization( + "Incompatible compilation policy selected", NULL); + } + // Scale CompileThreshold + // CompileThresholdScaling == 0.0 is equivalent to -Xint and leaves CompileThreshold unchanged. + if (!FLAG_IS_DEFAULT(CompileThresholdScaling) && CompileThresholdScaling > 0.0) { + FLAG_SET_ERGO(intx, CompileThreshold, scaled_compile_threshold(CompileThreshold)); + } + } + + if (UseOnStackReplacement && !UseLoopCounter) { + warning("On-stack-replacement requires loop counters; enabling loop counters"); + FLAG_SET_DEFAULT(UseLoopCounter, true); + } + +#ifdef COMPILER2 + if (!EliminateLocks) { + EliminateNestedLocks = false; + } + if (!Inline) { + IncrementalInline = false; + } +#ifndef PRODUCT + if (!IncrementalInline) { + AlwaysIncrementalInline = false; + } + if (PrintIdealGraphLevel > 0) { + FLAG_SET_ERGO(bool, PrintIdealGraph, true); + } +#endif + if (!UseTypeSpeculation && FLAG_IS_DEFAULT(TypeProfileLevel)) { + // nothing to use the profiling, turn if off + FLAG_SET_DEFAULT(TypeProfileLevel, 0); + } + if (!FLAG_IS_DEFAULT(OptoLoopAlignment) && FLAG_IS_DEFAULT(MaxLoopPad)) { + FLAG_SET_DEFAULT(MaxLoopPad, OptoLoopAlignment-1); + } + if (FLAG_IS_DEFAULT(LoopStripMiningIterShortLoop)) { + // blind guess + LoopStripMiningIterShortLoop = LoopStripMiningIter / 10; + } +#endif // COMPILER2 +} --- /dev/null 2018-05-03 12:26:05.000000000 -0700 +++ new/src/hotspot/share/compiler/compilerConfig.hpp 2018-05-03 12:26:04.000000000 -0700 @@ -0,0 +1,136 @@ +/* + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#ifndef SHARE_VM_COMPILER_COMPILERCONFIG_HPP +#define SHARE_VM_COMPILER_COMPILERCONFIG_HPP + +#include "memory/allocation.hpp" + +// The (closed set) of concrete compiler classes. +enum CompilerType { + compiler_none, + compiler_c1, + compiler_c2, + compiler_jvmci, + compiler_number_of_types +}; + +extern const char* compilertype2name_tab[compiler_number_of_types]; // Map CompilerType to its name +inline const char* compilertype2name(CompilerType t) { return (uint)t < compiler_number_of_types ? compilertype2name_tab[t] : NULL; } + +// Handy constants for deciding which compiler mode to use. +enum MethodCompilation { + InvocationEntryBci = -1 // i.e., not a on-stack replacement compilation +}; + +// Enumeration to distinguish tiers of compilation +enum CompLevel { + CompLevel_any = -2, + CompLevel_all = -2, + CompLevel_aot = -1, + CompLevel_none = 0, // Interpreter + CompLevel_simple = 1, // C1 + CompLevel_limited_profile = 2, // C1, invocation & backedge counters + CompLevel_full_profile = 3, // C1, invocation & backedge counters + mdo + CompLevel_full_optimization = 4 // C2 or JVMCI +}; + +extern CompLevel CompLevel_highest_tier; +extern CompLevel CompLevel_initial_compile; + +enum CompMode { + CompMode_none = 0, + CompMode_client = 1, + CompMode_server = 2 +}; + +extern CompMode Compilation_mode; + +inline bool is_server_compilation_mode_vm() { + return Compilation_mode == CompMode_server; +} + +inline bool is_client_compilation_mode_vm() { + return Compilation_mode == CompMode_client; +} + +extern void set_client_compilation_mode(); + +inline bool is_c1_compile(int comp_level) { + return comp_level > CompLevel_none && comp_level < CompLevel_full_optimization; +} + +inline bool is_c2_compile(int comp_level) { + return comp_level == CompLevel_full_optimization; +} + +inline bool is_highest_tier_compile(int comp_level) { + return comp_level == CompLevel_highest_tier; +} + +inline bool is_compile(int comp_level) { + return is_c1_compile(comp_level) || is_c2_compile(comp_level); +} + +// States of Restricted Transactional Memory usage. +enum RTMState { + NoRTM = 0x2, // Don't use RTM + UseRTM = 0x1, // Use RTM + ProfileRTM = 0x0 // Use RTM with abort ratio calculation +}; + +#ifndef INCLUDE_RTM_OPT +#define INCLUDE_RTM_OPT 0 +#endif +#if INCLUDE_RTM_OPT +#define RTM_OPT_ONLY(code) code +#else +#define RTM_OPT_ONLY(code) +#endif + +class CompilerConfig : public AllStatic { +public: + static void ergo_initialize(); + static bool check_comp_args_consistency(bool status); + + // Tiered + static void set_tiered_flags(); + + // Scale compile thresholds + // Returns threshold scaled with CompileThresholdScaling + static intx scaled_compile_threshold(intx threshold, double scale); + static intx scaled_compile_threshold(intx threshold); + + // Returns freq_log scaled with CompileThresholdScaling + static intx scaled_freq_log(intx freq_log, double scale); + static intx scaled_freq_log(intx freq_log); + +#if INCLUDE_JVMCI + // Check consistency of jvmci vm argument settings. + static bool check_jvmci_args_consistency(); + static void set_jvmci_specific_flags(); +#endif +}; + +#endif // SHARE_VM_COMPILER_COMPILERCONFIG_HPP --- old/src/hotspot/share/compiler/compilerDefinitions.cpp 2018-05-03 12:26:05.000000000 -0700 +++ /dev/null 2018-05-03 12:26:06.000000000 -0700 @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -#include "precompiled.hpp" -#include "runtime/globals.hpp" -#include "runtime/globals_extension.hpp" -#include "compiler/compilerDefinitions.hpp" - -const char* compilertype2name_tab[compiler_number_of_types] = { - "", - "c1", - "c2", - "jvmci" -}; - -#if defined(COMPILER2) -CompLevel CompLevel_highest_tier = CompLevel_full_optimization; // pure C2 and tiered or JVMCI and tiered -#elif defined(COMPILER1) -CompLevel CompLevel_highest_tier = CompLevel_simple; // pure C1 or JVMCI -#else -CompLevel CompLevel_highest_tier = CompLevel_none; -#endif - -#if defined(TIERED) -CompLevel CompLevel_initial_compile = CompLevel_full_profile; // tiered -#elif defined(COMPILER1) || INCLUDE_JVMCI -CompLevel CompLevel_initial_compile = CompLevel_simple; // pure C1 or JVMCI -#elif defined(COMPILER2) -CompLevel CompLevel_initial_compile = CompLevel_full_optimization; // pure C2 -#else -CompLevel CompLevel_initial_compile = CompLevel_none; -#endif - -#if defined(COMPILER2) -CompMode Compilation_mode = CompMode_server; -#elif defined(COMPILER1) -CompMode Compilation_mode = CompMode_client; -#else -CompMode Compilation_mode = CompMode_none; -#endif - -#ifdef TIERED -void set_client_compilation_mode() { - Compilation_mode = CompMode_client; - CompLevel_highest_tier = CompLevel_simple; - CompLevel_initial_compile = CompLevel_simple; - FLAG_SET_ERGO(bool, TieredCompilation, false); - FLAG_SET_ERGO(bool, ProfileInterpreter, false); -#if INCLUDE_JVMCI - FLAG_SET_ERGO(bool, EnableJVMCI, false); - FLAG_SET_ERGO(bool, UseJVMCICompiler, false); -#endif -#if INCLUDE_AOT - FLAG_SET_ERGO(bool, UseAOT, false); -#endif - if (FLAG_IS_DEFAULT(NeverActAsServerClassMachine)) { - FLAG_SET_ERGO(bool, NeverActAsServerClassMachine, true); - } - if (FLAG_IS_DEFAULT(InitialCodeCacheSize)) { - FLAG_SET_ERGO(uintx, InitialCodeCacheSize, 160*K); - } - if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) { - FLAG_SET_ERGO(uintx, ReservedCodeCacheSize, 32*M); - } - if (FLAG_IS_DEFAULT(NonProfiledCodeHeapSize)) { - FLAG_SET_ERGO(uintx, NonProfiledCodeHeapSize, 27*M); - } - if (FLAG_IS_DEFAULT(ProfiledCodeHeapSize)) { - FLAG_SET_ERGO(uintx, ProfiledCodeHeapSize, 0); - } - if (FLAG_IS_DEFAULT(NonNMethodCodeHeapSize)) { - FLAG_SET_ERGO(uintx, NonNMethodCodeHeapSize, 5*M); - } - if (FLAG_IS_DEFAULT(CodeCacheExpansionSize)) { - FLAG_SET_ERGO(uintx, CodeCacheExpansionSize, 32*K); - } - if (FLAG_IS_DEFAULT(MetaspaceSize)) { - FLAG_SET_ERGO(size_t, MetaspaceSize, 12*M); - } - if (FLAG_IS_DEFAULT(MaxRAM)) { - // Do not use FLAG_SET_ERGO to update MaxRAM, as this will impact - // heap setting done based on available phys_mem (see Arguments::set_heap_size). - FLAG_SET_DEFAULT(MaxRAM, 1ULL*G); - } - if (FLAG_IS_DEFAULT(CompileThreshold)) { - FLAG_SET_ERGO(intx, CompileThreshold, 1500); - } - if (FLAG_IS_DEFAULT(OnStackReplacePercentage)) { - FLAG_SET_ERGO(intx, OnStackReplacePercentage, 933); - } - if (FLAG_IS_DEFAULT(CICompilerCount)) { - FLAG_SET_ERGO(intx, CICompilerCount, 1); - } -} -#endif // TIERED --- old/src/hotspot/share/compiler/compilerDefinitions.hpp 2018-05-03 12:26:06.000000000 -0700 +++ /dev/null 2018-05-03 12:26:06.000000000 -0700 @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -#ifndef SHARE_VM_COMPILER_COMPILERDEFINITIONS_HPP -#define SHARE_VM_COMPILER_COMPILERDEFINITIONS_HPP - -#include "utilities/globalDefinitions.hpp" - -// The (closed set) of concrete compiler classes. -enum CompilerType { - compiler_none, - compiler_c1, - compiler_c2, - compiler_jvmci, - compiler_number_of_types -}; - -extern const char* compilertype2name_tab[compiler_number_of_types]; // Map CompilerType to its name -inline const char* compilertype2name(CompilerType t) { return (uint)t < compiler_number_of_types ? compilertype2name_tab[t] : NULL; } - -// Handy constants for deciding which compiler mode to use. -enum MethodCompilation { - InvocationEntryBci = -1 // i.e., not a on-stack replacement compilation -}; - -// Enumeration to distinguish tiers of compilation -enum CompLevel { - CompLevel_any = -2, - CompLevel_all = -2, - CompLevel_aot = -1, - CompLevel_none = 0, // Interpreter - CompLevel_simple = 1, // C1 - CompLevel_limited_profile = 2, // C1, invocation & backedge counters - CompLevel_full_profile = 3, // C1, invocation & backedge counters + mdo - CompLevel_full_optimization = 4 // C2 or JVMCI -}; - -extern CompLevel CompLevel_highest_tier; -extern CompLevel CompLevel_initial_compile; - -enum CompMode { - CompMode_none = 0, - CompMode_client = 1, - CompMode_server = 2 -}; - -extern CompMode Compilation_mode; - -inline bool is_server_compilation_mode_vm() { - return Compilation_mode == CompMode_server; -} - -inline bool is_client_compilation_mode_vm() { - return Compilation_mode == CompMode_client; -} - -extern void set_client_compilation_mode(); - -inline bool is_c1_compile(int comp_level) { - return comp_level > CompLevel_none && comp_level < CompLevel_full_optimization; -} - -inline bool is_c2_compile(int comp_level) { - return comp_level == CompLevel_full_optimization; -} - -inline bool is_highest_tier_compile(int comp_level) { - return comp_level == CompLevel_highest_tier; -} - -inline bool is_compile(int comp_level) { - return is_c1_compile(comp_level) || is_c2_compile(comp_level); -} - -// States of Restricted Transactional Memory usage. -enum RTMState { - NoRTM = 0x2, // Don't use RTM - UseRTM = 0x1, // Use RTM - ProfileRTM = 0x0 // Use RTM with abort ratio calculation -}; - -#ifndef INCLUDE_RTM_OPT -#define INCLUDE_RTM_OPT 0 -#endif -#if INCLUDE_RTM_OPT -#define RTM_OPT_ONLY(code) code -#else -#define RTM_OPT_ONLY(code) -#endif - -#endif // SHARE_VM_COMPILER_COMPILERDEFINITIONS_HPP