8319879: Stress mode to randomize incremental inlining decision
Reviewed-by: kvn, roland
This commit is contained in:
parent
099a8f5b2f
commit
303757b3a0
@ -606,6 +606,7 @@ void CompilerConfig::ergo_initialize() {
|
|||||||
IncrementalInline = false;
|
IncrementalInline = false;
|
||||||
IncrementalInlineMH = false;
|
IncrementalInlineMH = false;
|
||||||
IncrementalInlineVirtual = false;
|
IncrementalInlineVirtual = false;
|
||||||
|
StressIncrementalInlining = false;
|
||||||
}
|
}
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
if (!IncrementalInline) {
|
if (!IncrementalInline) {
|
||||||
|
@ -53,6 +53,9 @@
|
|||||||
product(bool, StressCCP, false, DIAGNOSTIC, \
|
product(bool, StressCCP, false, DIAGNOSTIC, \
|
||||||
"Randomize worklist traversal in CCP") \
|
"Randomize worklist traversal in CCP") \
|
||||||
\
|
\
|
||||||
|
product(bool, StressIncrementalInlining, false, DIAGNOSTIC, \
|
||||||
|
"Randomize the incremental inlining decision") \
|
||||||
|
\
|
||||||
product(uint, StressSeed, 0, DIAGNOSTIC, \
|
product(uint, StressSeed, 0, DIAGNOSTIC, \
|
||||||
"Seed for randomized stress testing (if unset, a random one is " \
|
"Seed for randomized stress testing (if unset, a random one is " \
|
||||||
"generated). The seed is recorded in the compilation log, if " \
|
"generated). The seed is recorded in the compilation log, if " \
|
||||||
|
@ -432,7 +432,7 @@ bool LateInlineMHCallGenerator::do_late_inline_check(Compile* C, JVMState* jvms)
|
|||||||
assert(!input_not_const, "sanity"); // shouldn't have been scheduled for inlining in the first place
|
assert(!input_not_const, "sanity"); // shouldn't have been scheduled for inlining in the first place
|
||||||
|
|
||||||
if (cg != nullptr) {
|
if (cg != nullptr) {
|
||||||
assert(!cg->is_late_inline() || cg->is_mh_late_inline() || AlwaysIncrementalInline, "we're doing late inlining");
|
assert(!cg->is_late_inline() || cg->is_mh_late_inline() || AlwaysIncrementalInline || StressIncrementalInlining, "we're doing late inlining");
|
||||||
_inline_cg = cg;
|
_inline_cg = cg;
|
||||||
C->dec_number_of_mh_late_inlines();
|
C->dec_number_of_mh_late_inlines();
|
||||||
return true;
|
return true;
|
||||||
@ -554,7 +554,7 @@ bool LateInlineVirtualCallGenerator::do_late_inline_check(Compile* C, JVMState*
|
|||||||
true /*allow_intrinsics*/);
|
true /*allow_intrinsics*/);
|
||||||
|
|
||||||
if (cg != nullptr) {
|
if (cg != nullptr) {
|
||||||
assert(!cg->is_late_inline() || cg->is_mh_late_inline() || AlwaysIncrementalInline, "we're doing late inlining");
|
assert(!cg->is_late_inline() || cg->is_mh_late_inline() || AlwaysIncrementalInline || StressIncrementalInlining, "we're doing late inlining");
|
||||||
_inline_cg = cg;
|
_inline_cg = cg;
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@ -989,8 +989,9 @@ CallGenerator* CallGenerator::for_method_handle_call(JVMState* jvms, ciMethod* c
|
|||||||
bool input_not_const;
|
bool input_not_const;
|
||||||
CallGenerator* cg = CallGenerator::for_method_handle_inline(jvms, caller, callee, allow_inline, input_not_const);
|
CallGenerator* cg = CallGenerator::for_method_handle_inline(jvms, caller, callee, allow_inline, input_not_const);
|
||||||
Compile* C = Compile::current();
|
Compile* C = Compile::current();
|
||||||
|
bool should_delay = C->should_delay_inlining();
|
||||||
if (cg != nullptr) {
|
if (cg != nullptr) {
|
||||||
if (AlwaysIncrementalInline) {
|
if (should_delay) {
|
||||||
return CallGenerator::for_late_inline(callee, cg);
|
return CallGenerator::for_late_inline(callee, cg);
|
||||||
} else {
|
} else {
|
||||||
return cg;
|
return cg;
|
||||||
@ -1001,7 +1002,7 @@ CallGenerator* CallGenerator::for_method_handle_call(JVMState* jvms, ciMethod* c
|
|||||||
int call_site_count = caller->scale_count(profile.count());
|
int call_site_count = caller->scale_count(profile.count());
|
||||||
|
|
||||||
if (IncrementalInlineMH && call_site_count > 0 &&
|
if (IncrementalInlineMH && call_site_count > 0 &&
|
||||||
(input_not_const || !C->inlining_incrementally() || C->over_inlining_cutoff())) {
|
(should_delay || input_not_const || !C->inlining_incrementally() || C->over_inlining_cutoff())) {
|
||||||
return CallGenerator::for_mh_late_inline(caller, callee, input_not_const);
|
return CallGenerator::for_mh_late_inline(caller, callee, input_not_const);
|
||||||
} else {
|
} else {
|
||||||
// Out-of-line call.
|
// Out-of-line call.
|
||||||
|
@ -839,7 +839,7 @@ Compile::Compile( ciEnv* ci_env, ciMethod* target, int osr_bci,
|
|||||||
|
|
||||||
// If any phase is randomized for stress testing, seed random number
|
// If any phase is randomized for stress testing, seed random number
|
||||||
// generation and log the seed for repeatability.
|
// generation and log the seed for repeatability.
|
||||||
if (StressLCM || StressGCM || StressIGVN || StressCCP) {
|
if (StressLCM || StressGCM || StressIGVN || StressCCP || StressIncrementalInlining) {
|
||||||
if (FLAG_IS_DEFAULT(StressSeed) || (FLAG_IS_ERGO(StressSeed) && directive->RepeatCompilationOption)) {
|
if (FLAG_IS_DEFAULT(StressSeed) || (FLAG_IS_ERGO(StressSeed) && directive->RepeatCompilationOption)) {
|
||||||
_stress_seed = static_cast<uint>(Ticks::now().nanoseconds());
|
_stress_seed = static_cast<uint>(Ticks::now().nanoseconds());
|
||||||
FLAG_SET_ERGO(StressSeed, _stress_seed);
|
FLAG_SET_ERGO(StressSeed, _stress_seed);
|
||||||
@ -2262,7 +2262,7 @@ void Compile::Optimize() {
|
|||||||
|
|
||||||
if (failing()) return;
|
if (failing()) return;
|
||||||
|
|
||||||
if (AlwaysIncrementalInline) {
|
if (AlwaysIncrementalInline || StressIncrementalInlining) {
|
||||||
inline_incrementally(igvn);
|
inline_incrementally(igvn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1069,6 +1069,7 @@ private:
|
|||||||
bool inline_incrementally_one();
|
bool inline_incrementally_one();
|
||||||
void inline_incrementally_cleanup(PhaseIterGVN& igvn);
|
void inline_incrementally_cleanup(PhaseIterGVN& igvn);
|
||||||
void inline_incrementally(PhaseIterGVN& igvn);
|
void inline_incrementally(PhaseIterGVN& igvn);
|
||||||
|
bool should_delay_inlining() { return AlwaysIncrementalInline || (StressIncrementalInlining && (random() % 2) == 0); }
|
||||||
void inline_string_calls(bool parse_time);
|
void inline_string_calls(bool parse_time);
|
||||||
void inline_boxing_calls(PhaseIterGVN& igvn);
|
void inline_boxing_calls(PhaseIterGVN& igvn);
|
||||||
bool optimize_loops(PhaseIterGVN& igvn, LoopOptsMode mode);
|
bool optimize_loops(PhaseIterGVN& igvn, LoopOptsMode mode);
|
||||||
|
@ -185,7 +185,7 @@ CallGenerator* Compile::call_generator(ciMethod* callee, int vtable_index, bool
|
|||||||
// Try inlining a bytecoded method:
|
// Try inlining a bytecoded method:
|
||||||
if (!call_does_dispatch) {
|
if (!call_does_dispatch) {
|
||||||
InlineTree* ilt = InlineTree::find_subtree_from_root(this->ilt(), jvms->caller(), jvms->method());
|
InlineTree* ilt = InlineTree::find_subtree_from_root(this->ilt(), jvms->caller(), jvms->method());
|
||||||
bool should_delay = AlwaysIncrementalInline;
|
bool should_delay = C->should_delay_inlining();
|
||||||
if (ilt->ok_to_inline(callee, jvms, profile, should_delay)) {
|
if (ilt->ok_to_inline(callee, jvms, profile, should_delay)) {
|
||||||
CallGenerator* cg = CallGenerator::for_inline(callee, expected_uses);
|
CallGenerator* cg = CallGenerator::for_inline(callee, expected_uses);
|
||||||
// For optimized virtual calls assert at runtime that receiver object
|
// For optimized virtual calls assert at runtime that receiver object
|
||||||
@ -204,14 +204,14 @@ CallGenerator* Compile::call_generator(ciMethod* callee, int vtable_index, bool
|
|||||||
// Delay the inlining of this method to give us the
|
// Delay the inlining of this method to give us the
|
||||||
// opportunity to perform some high level optimizations
|
// opportunity to perform some high level optimizations
|
||||||
// first.
|
// first.
|
||||||
if (should_delay_string_inlining(callee, jvms)) {
|
if (should_delay) {
|
||||||
|
return CallGenerator::for_late_inline(callee, cg);
|
||||||
|
} else if (should_delay_string_inlining(callee, jvms)) {
|
||||||
return CallGenerator::for_string_late_inline(callee, cg);
|
return CallGenerator::for_string_late_inline(callee, cg);
|
||||||
} else if (should_delay_boxing_inlining(callee, jvms)) {
|
} else if (should_delay_boxing_inlining(callee, jvms)) {
|
||||||
return CallGenerator::for_boxing_late_inline(callee, cg);
|
return CallGenerator::for_boxing_late_inline(callee, cg);
|
||||||
} else if (should_delay_vector_reboxing_inlining(callee, jvms)) {
|
} else if (should_delay_vector_reboxing_inlining(callee, jvms)) {
|
||||||
return CallGenerator::for_vector_reboxing_late_inline(callee, cg);
|
return CallGenerator::for_vector_reboxing_late_inline(callee, cg);
|
||||||
} else if (should_delay) {
|
|
||||||
return CallGenerator::for_late_inline(callee, cg);
|
|
||||||
} else {
|
} else {
|
||||||
return cg;
|
return cg;
|
||||||
}
|
}
|
||||||
|
@ -68,6 +68,7 @@ public class TestIncrementalInlining extends InliningBase {
|
|||||||
commandLineNormal.add("-XX:+WhiteBoxAPI");
|
commandLineNormal.add("-XX:+WhiteBoxAPI");
|
||||||
commandLineNormal.add("-XX:MaxInlineLevel=2");
|
commandLineNormal.add("-XX:MaxInlineLevel=2");
|
||||||
commandLineNormal.add("-XX:-AlwaysIncrementalInline");
|
commandLineNormal.add("-XX:-AlwaysIncrementalInline");
|
||||||
|
commandLineNormal.add("-XX:-StressIncrementalInlining");
|
||||||
runTest();
|
runTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
* -Xmixed -XX:-BackgroundCompilation -XX:-TieredCompilation -XX:CompileThreshold=1000
|
* -Xmixed -XX:-BackgroundCompilation -XX:-TieredCompilation -XX:CompileThreshold=1000
|
||||||
* -XX:+UnlockExperimentalVMOptions -XX:PerMethodTrapLimit=100 -XX:-StressReflectiveCode
|
* -XX:+UnlockExperimentalVMOptions -XX:PerMethodTrapLimit=100 -XX:-StressReflectiveCode
|
||||||
* -XX:+UncommonNullCast -XX:-StressMethodHandleLinkerInlining -XX:TypeProfileLevel=0
|
* -XX:+UncommonNullCast -XX:-StressMethodHandleLinkerInlining -XX:TypeProfileLevel=0
|
||||||
* -XX:-AlwaysIncrementalInline
|
* -XX:-AlwaysIncrementalInline -XX:-StressIncrementalInlining
|
||||||
* -XX:CompileCommand=exclude,compiler.intrinsics.klass.CastNullCheckDroppingsTest::runTest
|
* -XX:CompileCommand=exclude,compiler.intrinsics.klass.CastNullCheckDroppingsTest::runTest
|
||||||
* compiler.intrinsics.klass.CastNullCheckDroppingsTest
|
* compiler.intrinsics.klass.CastNullCheckDroppingsTest
|
||||||
*/
|
*/
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
* -Xbatch -XX:-UseOnStackReplacement -XX:-TieredCompilation
|
* -Xbatch -XX:-UseOnStackReplacement -XX:-TieredCompilation
|
||||||
* -XX:+UnlockExperimentalVMOptions -XX:PerMethodTrapLimit=100 -XX:PerBytecodeTrapLimit=4
|
* -XX:+UnlockExperimentalVMOptions -XX:PerMethodTrapLimit=100 -XX:PerBytecodeTrapLimit=4
|
||||||
* -XX:TypeProfileLevel=0
|
* -XX:TypeProfileLevel=0
|
||||||
* -XX:+IgnoreUnrecognizedVMOptions -XX:-AlwaysIncrementalInline
|
* -XX:+IgnoreUnrecognizedVMOptions -XX:-AlwaysIncrementalInline -XX:-StressIncrementalInlining
|
||||||
* -XX:CompileCommand=compileonly,compiler.uncommontrap.Decompile::uncommonTrap
|
* -XX:CompileCommand=compileonly,compiler.uncommontrap.Decompile::uncommonTrap
|
||||||
* -XX:CompileCommand=inline,compiler.uncommontrap.Decompile*::foo
|
* -XX:CompileCommand=inline,compiler.uncommontrap.Decompile*::foo
|
||||||
* compiler.uncommontrap.Decompile
|
* compiler.uncommontrap.Decompile
|
||||||
|
Loading…
x
Reference in New Issue
Block a user