Skip to content

Commit

Permalink
Automatic merge of jdk:master into master
Browse files Browse the repository at this point in the history
  • Loading branch information
duke committed May 18, 2020
2 parents 494bf16 + 76b7665 commit 48bf215
Show file tree
Hide file tree
Showing 20 changed files with 90 additions and 47 deletions.
1 change: 0 additions & 1 deletion src/hotspot/cpu/aarch64/c1_globals_aarch64.hpp
Expand Up @@ -44,7 +44,6 @@ define_pd_global(bool, TieredCompilation, false);
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 );
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/cpu/arm/c1_globals_arm.hpp
Expand Up @@ -45,7 +45,6 @@ define_pd_global(bool, TieredCompilation, false);
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 );
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/cpu/ppc/c1_globals_ppc.hpp
Expand Up @@ -45,7 +45,6 @@ define_pd_global(intx, CompileThreshold, 1000);
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 );
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/cpu/s390/c1_globals_s390.hpp
Expand Up @@ -46,7 +46,6 @@ define_pd_global(intx, CompileThreshold, 1000);
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);
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/cpu/sparc/c1_globals_sparc.hpp
Expand Up @@ -44,7 +44,6 @@ define_pd_global(intx, CompileThreshold, 1000 ); // Design center r
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 );
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/cpu/x86/c1_globals_x86.hpp
Expand Up @@ -43,7 +43,6 @@ define_pd_global(bool, TieredCompilation, false);
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 );
Expand Down
20 changes: 13 additions & 7 deletions src/hotspot/share/c1/c1_GraphBuilder.cpp
Expand Up @@ -701,10 +701,10 @@ GraphBuilder::ScopeData::ScopeData(ScopeData* parent)
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;
}
}

Expand Down Expand Up @@ -3817,18 +3817,24 @@ bool GraphBuilder::try_inline_full(ciMethod* callee, bool holder_known, bool ign
// 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";
if (inlinee_by_directive) msg = "force inline by CompileCommand";
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() &&
Expand Down
22 changes: 22 additions & 0 deletions src/hotspot/share/c1/c1_globals.hpp
Expand Up @@ -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) \
Expand Down
7 changes: 7 additions & 0 deletions src/hotspot/share/compiler/compilerDefinitions.cpp
Expand Up @@ -278,6 +278,13 @@ void CompilerConfig::set_tiered_flags() {
}
#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
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/share/compiler/compiler_globals.hpp
Expand Up @@ -52,7 +52,6 @@ define_pd_global(intx, CompileThreshold, 0);

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);
Expand Down
29 changes: 29 additions & 0 deletions src/hotspot/share/opto/c2_globals.hpp
Expand Up @@ -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") \
\
Expand Down
10 changes: 10 additions & 0 deletions src/hotspot/share/runtime/arguments.cpp
Expand Up @@ -570,6 +570,16 @@ static SpecialFlag const special_jvm_flags[] = {
{ "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) }
};

Expand Down
25 changes: 0 additions & 25 deletions src/hotspot/share/runtime/globals.hpp
Expand Up @@ -1455,36 +1455,11 @@ const size_t minimumSymbolTableSize = 1024;
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") \
Expand Down
2 changes: 1 addition & 1 deletion test/hotspot/jtreg/compiler/c2/Test5091921.java
Expand Up @@ -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
*/
Expand Down
2 changes: 1 addition & 1 deletion test/hotspot/jtreg/compiler/c2/Test6792161.java
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions test/hotspot/jtreg/compiler/c2/Test6910605_2.java
Expand Up @@ -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
*/
Expand Down
Expand Up @@ -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", ""),
Expand Down
Expand Up @@ -37,6 +37,7 @@
* -Xmixed
* -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* -XX:+IgnoreUnrecognizedVMOptions
* -XX:MaxInlineSize=70
* -XX:MinInliningThreshold=0
* compiler.intrinsics.string.TestStringIntrinsics2
Expand Down
Expand Up @@ -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;
Expand Down
Expand Up @@ -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()
Expand Down

0 comments on commit 48bf215

Please sign in to comment.