OpenJDK / jdk / jdk
changeset 59321:140c5adcabdd
8235673: [C1, C2] Split inlining control flags
Reviewed-by: neliasso, kvn, thartmann
line wrap: on
line diff
--- a/src/hotspot/cpu/aarch64/c1_globals_aarch64.hpp Sun May 17 15:10:06 2020 -0700 +++ b/src/hotspot/cpu/aarch64/c1_globals_aarch64.hpp Mon May 18 10:57:16 2020 +0200 @@ -44,7 +44,6 @@ define_pd_global(intx, CompileThreshold, 1500 ); define_pd_global(intx, OnStackReplacePercentage, 933 ); -define_pd_global(intx, FreqInlineSize, 325 ); define_pd_global(intx, NewSizeThreadIncrease, 4*K ); define_pd_global(intx, InitialCodeCacheSize, 160*K); define_pd_global(intx, ReservedCodeCacheSize, 32*M );
--- a/src/hotspot/cpu/arm/c1_globals_arm.hpp Sun May 17 15:10:06 2020 -0700 +++ b/src/hotspot/cpu/arm/c1_globals_arm.hpp Mon May 18 10:57:16 2020 +0200 @@ -45,7 +45,6 @@ define_pd_global(intx, CompileThreshold, 1500 ); define_pd_global(intx, OnStackReplacePercentage, 933 ); -define_pd_global(intx, FreqInlineSize, 325 ); define_pd_global(size_t, NewSizeThreadIncrease, 4*K ); define_pd_global(size_t, InitialCodeCacheSize, 160*K); define_pd_global(size_t, ReservedCodeCacheSize, 32*M );
--- a/src/hotspot/cpu/ppc/c1_globals_ppc.hpp Sun May 17 15:10:06 2020 -0700 +++ b/src/hotspot/cpu/ppc/c1_globals_ppc.hpp Mon May 18 10:57:16 2020 +0200 @@ -45,7 +45,6 @@ define_pd_global(intx, OnStackReplacePercentage, 1400); define_pd_global(bool, UseTLAB, true); define_pd_global(bool, ProfileInterpreter, false); -define_pd_global(intx, FreqInlineSize, 325 ); define_pd_global(bool, ResizeTLAB, true); define_pd_global(uintx, ReservedCodeCacheSize, 32*M); define_pd_global(uintx, NonProfiledCodeHeapSize, 13*M );
--- a/src/hotspot/cpu/s390/c1_globals_s390.hpp Sun May 17 15:10:06 2020 -0700 +++ b/src/hotspot/cpu/s390/c1_globals_s390.hpp Mon May 18 10:57:16 2020 +0200 @@ -46,7 +46,6 @@ define_pd_global(intx, OnStackReplacePercentage, 1400); define_pd_global(bool, UseTLAB, true); define_pd_global(bool, ProfileInterpreter, false); -define_pd_global(intx, FreqInlineSize, 325); define_pd_global(bool, ResizeTLAB, true); define_pd_global(uintx, ReservedCodeCacheSize, 32*M); define_pd_global(uintx, NonProfiledCodeHeapSize, 13*M);
--- a/src/hotspot/cpu/sparc/c1_globals_sparc.hpp Sun May 17 15:10:06 2020 -0700 +++ b/src/hotspot/cpu/sparc/c1_globals_sparc.hpp Mon May 18 10:57:16 2020 +0200 @@ -44,7 +44,6 @@ define_pd_global(intx, OnStackReplacePercentage, 1400 ); define_pd_global(bool, UseTLAB, true ); define_pd_global(bool, ProfileInterpreter, false); -define_pd_global(intx, FreqInlineSize, 325 ); define_pd_global(bool, ResizeTLAB, true ); define_pd_global(uintx, ReservedCodeCacheSize, 32*M ); define_pd_global(uintx, NonProfiledCodeHeapSize, 13*M );
--- a/src/hotspot/cpu/x86/c1_globals_x86.hpp Sun May 17 15:10:06 2020 -0700 +++ b/src/hotspot/cpu/x86/c1_globals_x86.hpp Mon May 18 10:57:16 2020 +0200 @@ -43,7 +43,6 @@ define_pd_global(intx, CompileThreshold, 1500 ); define_pd_global(intx, OnStackReplacePercentage, 933 ); -define_pd_global(intx, FreqInlineSize, 325 ); define_pd_global(size_t, NewSizeThreadIncrease, 4*K ); define_pd_global(uintx, InitialCodeCacheSize, 160*K); define_pd_global(uintx, ReservedCodeCacheSize, 32*M );
--- a/src/hotspot/share/c1/c1_GraphBuilder.cpp Sun May 17 15:10:06 2020 -0700 +++ b/src/hotspot/share/c1/c1_GraphBuilder.cpp Mon May 18 10:57:16 2020 +0200 @@ -701,10 +701,10 @@ if (parent != NULL) { _max_inline_size = (intx) ((float) NestedInliningSizeRatio * (float) parent->max_inline_size() / 100.0f); } else { - _max_inline_size = MaxInlineSize; + _max_inline_size = C1MaxInlineSize; } - if (_max_inline_size < MaxTrivialSize) { - _max_inline_size = MaxTrivialSize; + if (_max_inline_size < C1MaxTrivialSize) { + _max_inline_size = C1MaxTrivialSize; } } @@ -3817,8 +3817,8 @@ // now perform tests that are based on flag settings bool inlinee_by_directive = compilation()->directive()->should_inline(callee); if (callee->force_inline() || inlinee_by_directive) { - if (inline_level() > MaxForceInlineLevel ) INLINE_BAILOUT("MaxForceInlineLevel"); - if (recursive_inline_level(callee) > MaxRecursiveInlineLevel) INLINE_BAILOUT("recursive inlining too deep"); + if (inline_level() > MaxForceInlineLevel ) INLINE_BAILOUT("MaxForceInlineLevel"); + if (recursive_inline_level(callee) > C1MaxRecursiveInlineLevel) INLINE_BAILOUT("recursive inlining too deep"); const char* msg = ""; if (callee->force_inline()) msg = "force inline by annotation"; @@ -3826,9 +3826,15 @@ print_inlining(callee, msg); } else { // use heuristic controls on inlining - if (inline_level() > MaxInlineLevel ) INLINE_BAILOUT("inlining too deep"); - if (recursive_inline_level(callee) > MaxRecursiveInlineLevel) INLINE_BAILOUT("recursive inlining too deep"); + if (inline_level() > C1MaxInlineLevel ) INLINE_BAILOUT("inlining too deep"); + int callee_recursive_level = recursive_inline_level(callee); + if (callee_recursive_level > C1MaxRecursiveInlineLevel ) INLINE_BAILOUT("recursive inlining too deep"); if (callee->code_size_for_inlining() > max_inline_size() ) INLINE_BAILOUT("callee is too large"); + // Additional condition to limit stack usage for non-recursive calls. + if ((callee_recursive_level == 0) && + (callee->max_stack() + callee->max_locals() - callee->size_of_parameters() > C1InlineStackLimit)) { + INLINE_BAILOUT("callee uses too much stack"); + } // don't inline throwable methods unless the inlining tree is rooted in a throwable class if (callee->name() == ciSymbol::object_initializer_name() &&
--- a/src/hotspot/share/c1/c1_globals.hpp Sun May 17 15:10:06 2020 -0700 +++ b/src/hotspot/share/c1/c1_globals.hpp Mon May 18 10:57:16 2020 +0200 @@ -170,6 +170,28 @@ develop(bool, UseTableRanges, true, \ "Faster versions of lookup table using ranges") \ \ + product(intx, C1MaxInlineSize, 35, \ + "The maximum bytecode size of a method to be inlined by C1") \ + range(0, max_jint) \ + \ + product(intx, C1MaxTrivialSize, 6, \ + "The maximum bytecode size of a trivial method to be inlined by " \ + "C1") \ + range(0, max_jint) \ + \ + product(intx, C1MaxInlineLevel, 9, \ + "The maximum number of nested calls that are inlined by C1") \ + range(0, max_jint) \ + \ + product(intx, C1MaxRecursiveInlineLevel, 1, \ + "maximum number of nested recursive calls that are inlined by C1")\ + range(0, max_jint) \ + \ + product(intx, C1InlineStackLimit, 10, \ + "inlining only allowed for methods which don't exceed this " \ + "number of expression stack and local slots") \ + range(0, max_jint) \ + \ develop(intx, NestedInliningSizeRatio, 90, \ "Percentage of prev. allowed inline size in recursive inlining") \ range(0, 100) \
--- a/src/hotspot/share/compiler/compilerDefinitions.cpp Sun May 17 15:10:06 2020 -0700 +++ b/src/hotspot/share/compiler/compilerDefinitions.cpp Mon May 18 10:57:16 2020 +0200 @@ -278,6 +278,13 @@ } #endif // INCLUDE_AOT } + + // Reduce stack usage due to inlining of methods which require much stack. + // (High tier compiler can inline better based on profiling information.) + if (FLAG_IS_DEFAULT(C1InlineStackLimit) && + TieredStopAtLevel == CompLevel_full_optimization && !CompilationModeFlag::quick_only()) { + FLAG_SET_DEFAULT(C1InlineStackLimit, 5); + } } #endif // TIERED
--- a/src/hotspot/share/compiler/compiler_globals.hpp Sun May 17 15:10:06 2020 -0700 +++ b/src/hotspot/share/compiler/compiler_globals.hpp Mon May 18 10:57:16 2020 +0200 @@ -52,7 +52,6 @@ define_pd_global(intx, OnStackReplacePercentage, 0); define_pd_global(bool, ResizeTLAB, false); -define_pd_global(intx, FreqInlineSize, 0); define_pd_global(size_t, NewSizeThreadIncrease, 4*K); define_pd_global(bool, InlineClassNatives, true); define_pd_global(bool, InlineUnsafeOps, true);
--- a/src/hotspot/share/opto/c2_globals.hpp Sun May 17 15:10:06 2020 -0700 +++ b/src/hotspot/share/opto/c2_globals.hpp Mon May 18 10:57:16 2020 +0200 @@ -685,6 +685,35 @@ develop(bool, VerifyAliases, false, \ "perform extra checks on the results of alias analysis") \ \ + product(intx, MaxInlineLevel, 15, \ + "maximum number of nested calls that are inlined by high tier " \ + "compiler") \ + range(0, max_jint) \ + \ + product(intx, MaxRecursiveInlineLevel, 1, \ + "maximum number of nested recursive calls that are inlined by " \ + "high tier compiler") \ + range(0, max_jint) \ + \ + product_pd(intx, InlineSmallCode, \ + "Only inline already compiled methods if their code size is " \ + "less than this") \ + range(0, max_jint) \ + \ + product(intx, MaxInlineSize, 35, \ + "The maximum bytecode size of a method to be inlined by high " \ + "tier compiler") \ + range(0, max_jint) \ + \ + product_pd(intx, FreqInlineSize, \ + "The maximum bytecode size of a frequent method to be inlined") \ + range(0, max_jint) \ + \ + product(intx, MaxTrivialSize, 6, \ + "The maximum bytecode size of a trivial method to be inlined by " \ + "high tier compiler") \ + range(0, max_jint) \ + \ product(bool, IncrementalInline, true, \ "do post parse inlining") \ \
--- a/src/hotspot/share/runtime/arguments.cpp Sun May 17 15:10:06 2020 -0700 +++ b/src/hotspot/share/runtime/arguments.cpp Mon May 18 10:57:16 2020 +0200 @@ -570,6 +570,16 @@ { "dup option", JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::undefined() }, #endif +#ifndef COMPILER2 + // These flags were generally available, but are C2 only, now. + { "MaxInlineLevel", JDK_Version::undefined(), JDK_Version::jdk(15), JDK_Version::jdk(16) }, + { "MaxRecursiveInlineLevel", JDK_Version::undefined(), JDK_Version::jdk(15), JDK_Version::jdk(16) }, + { "InlineSmallCode", JDK_Version::undefined(), JDK_Version::jdk(15), JDK_Version::jdk(16) }, + { "MaxInlineSize", JDK_Version::undefined(), JDK_Version::jdk(15), JDK_Version::jdk(16) }, + { "FreqInlineSize", JDK_Version::undefined(), JDK_Version::jdk(15), JDK_Version::jdk(16) }, + { "MaxTrivialSize", JDK_Version::undefined(), JDK_Version::jdk(15), JDK_Version::jdk(16) }, +#endif + { NULL, JDK_Version(0), JDK_Version(0) } };
--- a/src/hotspot/share/runtime/globals.hpp Sun May 17 15:10:06 2020 -0700 +++ b/src/hotspot/share/runtime/globals.hpp Mon May 18 10:57:16 2020 +0200 @@ -1455,36 +1455,11 @@ notproduct(intx, MaxSubklassPrintSize, 4, \ "maximum number of subklasses to print when printing klass") \ \ - product(intx, MaxInlineLevel, 15, \ - "maximum number of nested calls that are inlined") \ - range(0, max_jint) \ - \ - product(intx, MaxRecursiveInlineLevel, 1, \ - "maximum number of nested recursive calls that are inlined") \ - range(0, max_jint) \ - \ develop(intx, MaxForceInlineLevel, 100, \ "maximum number of nested calls that are forced for inlining " \ "(using CompileCommand or marked w/ @ForceInline)") \ range(0, max_jint) \ \ - product_pd(intx, InlineSmallCode, \ - "Only inline already compiled methods if their code size is " \ - "less than this") \ - range(0, max_jint) \ - \ - product(intx, MaxInlineSize, 35, \ - "The maximum bytecode size of a method to be inlined") \ - range(0, max_jint) \ - \ - product_pd(intx, FreqInlineSize, \ - "The maximum bytecode size of a frequent method to be inlined") \ - range(0, max_jint) \ - \ - product(intx, MaxTrivialSize, 6, \ - "The maximum bytecode size of a trivial method to be inlined") \ - range(0, max_jint) \ - \ product(intx, MinInliningThreshold, 250, \ "The minimum invocation count a method needs to have to be " \ "inlined") \
--- a/test/hotspot/jtreg/compiler/c2/Test5091921.java Sun May 17 15:10:06 2020 -0700 +++ b/test/hotspot/jtreg/compiler/c2/Test5091921.java Mon May 18 10:57:16 2020 +0200 @@ -27,7 +27,7 @@ * @bug 5091921 * @summary Sign flip issues in loop optimizer * - * @run main/othervm -Xcomp -XX:MaxInlineSize=1 + * @run main/othervm -Xcomp -XX:+IgnoreUnrecognizedVMOptions -XX:MaxInlineSize=1 -XX:C1MaxInlineSize=1 * -XX:CompileCommand=compileonly,compiler.c2.Test5091921::* * compiler.c2.Test5091921 */
--- a/test/hotspot/jtreg/compiler/c2/Test6792161.java Sun May 17 15:10:06 2020 -0700 +++ b/test/hotspot/jtreg/compiler/c2/Test6792161.java Mon May 18 10:57:16 2020 +0200 @@ -26,7 +26,7 @@ * @bug 6792161 * @summary assert("No dead instructions after post-alloc") * - * @run main/othervm/timeout=600 -Xcomp -XX:-TieredCompilation -XX:MaxInlineSize=120 compiler.c2.Test6792161 + * @run main/othervm/timeout=600 -Xcomp -XX:-TieredCompilation -XX:+IgnoreUnrecognizedVMOptions -XX:MaxInlineSize=120 compiler.c2.Test6792161 */ package compiler.c2;
--- a/test/hotspot/jtreg/compiler/c2/Test6910605_2.java Sun May 17 15:10:06 2020 -0700 +++ b/test/hotspot/jtreg/compiler/c2/Test6910605_2.java Mon May 18 10:57:16 2020 +0200 @@ -27,14 +27,14 @@ * @summary C2: NullPointerException/ClassCaseException is thrown when C2 with DeoptimizeALot is used * * @run main/othervm -Xmx128m -XX:+IgnoreUnrecognizedVMOptions -XX:+DeoptimizeALot - * -XX:+DoEscapeAnalysis -Xbatch -XX:InlineSmallCode=2000 + * -XX:+DoEscapeAnalysis -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:InlineSmallCode=2000 * compiler.c2.Test6910605_2 */ package compiler.c2; /* - * Added InlineSmallCode=2000 to guaranty inlining of StringBuilder::append() to allow scalar replace StringBuilder object. + * Added InlineSmallCode=2000 to guarantee inlining of StringBuilder::append() to allow scalar replace StringBuilder object. * * original test: gc/gctests/StringGC */
--- a/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/Command.java Sun May 17 15:10:06 2020 -0700 +++ b/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/Command.java Mon May 18 10:57:16 2020 +0200 @@ -33,8 +33,8 @@ public enum Command { COMPILEONLY("compileonly", ".*", "-Xbatch"), EXCLUDE("exclude", "", "-Xbatch"), - INLINE("inline", ".*", "-Xbatch", "-XX:InlineSmallCode=4000"), - DONTINLINE("dontinline", "", "-Xbatch", "-XX:InlineSmallCode=4000"), + INLINE("inline", ".*", "-Xbatch", "-XX:+IgnoreUnrecognizedVMOptions", "-XX:InlineSmallCode=4000"), + DONTINLINE("dontinline", "", "-Xbatch", "-XX:+IgnoreUnrecognizedVMOptions", "-XX:InlineSmallCode=4000"), LOG("log", "", "-XX:+UnlockDiagnosticVMOptions", "-XX:+LogCompilation", "-XX:LogFile=" + LogProcessor.LOG_FILE), PRINT("print", ""),
--- a/test/hotspot/jtreg/compiler/intrinsics/string/TestStringIntrinsics2.java Sun May 17 15:10:06 2020 -0700 +++ b/test/hotspot/jtreg/compiler/intrinsics/string/TestStringIntrinsics2.java Mon May 18 10:57:16 2020 +0200 @@ -37,6 +37,7 @@ * -Xmixed * -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI + * -XX:+IgnoreUnrecognizedVMOptions * -XX:MaxInlineSize=70 * -XX:MinInliningThreshold=0 * compiler.intrinsics.string.TestStringIntrinsics2
--- a/test/hotspot/jtreg/compiler/profiling/TestProfileCounterOverflow.java Sun May 17 15:10:06 2020 -0700 +++ b/test/hotspot/jtreg/compiler/profiling/TestProfileCounterOverflow.java Mon May 18 10:57:16 2020 +0200 @@ -25,7 +25,7 @@ * @test * @bug 8224162 * @summary Profile counter for a call site may overflow. - * @run main/othervm -Xbatch -XX:-UseOnStackReplacement -XX:MaxTrivialSize=0 compiler.profiling.TestProfileCounterOverflow + * @run main/othervm -Xbatch -XX:-UseOnStackReplacement -XX:+IgnoreUnrecognizedVMOptions -XX:MaxTrivialSize=0 -XX:C1MaxTrivialSize=0 compiler.profiling.TestProfileCounterOverflow */ package compiler.profiling;
--- a/test/hotspot/jtreg/runtime/ReservedStack/ReservedStackTest.java Sun May 17 15:10:06 2020 -0700 +++ b/test/hotspot/jtreg/runtime/ReservedStack/ReservedStackTest.java Mon May 18 10:57:16 2020 +0200 @@ -29,7 +29,7 @@ * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.vm.annotation * - * @run main/othervm -XX:MaxInlineLevel=2 -XX:CompileCommand=exclude,java/util/concurrent/locks/AbstractOwnableSynchronizer.setExclusiveOwnerThread ReservedStackTest + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:MaxInlineLevel=2 -XX:C1MaxInlineLevel=2 -XX:CompileCommand=exclude,java/util/concurrent/locks/AbstractOwnableSynchronizer.setExclusiveOwnerThread ReservedStackTest */ /* The exclusion of java.util.concurrent.locks.AbstractOwnableSynchronizer.setExclusiveOwnerThread()