Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8266328: C2: Remove InlineWarmCalls #3805

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
83 changes: 21 additions & 62 deletions src/hotspot/share/opto/bytecodeInfo.cpp
Expand Up @@ -112,24 +112,18 @@ static bool is_unboxing_method(ciMethod* callee_method, Compile* C) {

// positive filter: should callee be inlined?
bool InlineTree::should_inline(ciMethod* callee_method, ciMethod* caller_method,
int caller_bci, ciCallProfile& profile,
WarmCallInfo* wci_result) {
int caller_bci, ciCallProfile& profile) {
// Allows targeted inlining
if (C->directive()->should_inline(callee_method)) {
*wci_result = *(WarmCallInfo::always_hot());
if (C->print_inlining() && Verbose) {
CompileTask::print_inline_indent(inline_level());
tty->print_cr("Inlined method is hot: ");
}
set_msg("force inline by CompileCommand");
_forced_inline = true;
return true;
}

if (callee_method->force_inline()) {
set_msg("force inline by annotation");
_forced_inline = true;
return true;
set_msg("force inline by annotation");
_forced_inline = true;
return true;
}

#ifndef PRODUCT
Expand All @@ -146,7 +140,6 @@ bool InlineTree::should_inline(ciMethod* callee_method, ciMethod* caller_method,
// Check for too many throws (and not too huge)
if(callee_method->interpreter_throwout_count() > InlineThrowCount &&
size < InlineThrowMaxSize ) {
wci_result->set_profit(wci_result->profit() * 100);
if (C->print_inlining() && Verbose) {
CompileTask::print_inline_indent(inline_level());
tty->print_cr("Inlined method with many throws (throws=%d):", callee_method->interpreter_throwout_count());
Expand Down Expand Up @@ -202,8 +195,7 @@ bool InlineTree::should_inline(ciMethod* callee_method, ciMethod* caller_method,
// negative filter: should callee NOT be inlined?
bool InlineTree::should_not_inline(ciMethod *callee_method,
ciMethod* caller_method,
JVMState* jvms,
WarmCallInfo* wci_result) {
JVMState* jvms) {

const char* fail_msg = NULL;

Expand Down Expand Up @@ -361,7 +353,7 @@ bool InlineTree::is_not_reached(ciMethod* callee_method, ciMethod* caller_method
// Relocated from "InliningClosure::try_to_inline"
bool InlineTree::try_to_inline(ciMethod* callee_method, ciMethod* caller_method,
int caller_bci, JVMState* jvms, ciCallProfile& profile,
WarmCallInfo* wci_result, bool& should_delay) {
bool& should_delay) {

if (ClipInlining && (int)count_inline_bcs() >= DesiredMethodLimit) {
if (!callee_method->force_inline() || !IncrementalInline) {
Expand All @@ -373,11 +365,10 @@ bool InlineTree::try_to_inline(ciMethod* callee_method, ciMethod* caller_method,
}

_forced_inline = false; // Reset
if (!should_inline(callee_method, caller_method, caller_bci, profile,
wci_result)) {
if (!should_inline(callee_method, caller_method, caller_bci, profile)) {
return false;
}
if (should_not_inline(callee_method, caller_method, jvms, wci_result)) {
if (should_not_inline(callee_method, caller_method, jvms)) {
return false;
}

Expand Down Expand Up @@ -560,7 +551,8 @@ void InlineTree::print_inlining(ciMethod* callee_method, int caller_bci,
}

//------------------------------ok_to_inline-----------------------------------
WarmCallInfo* InlineTree::ok_to_inline(ciMethod* callee_method, JVMState* jvms, ciCallProfile& profile, WarmCallInfo* initial_wci, bool& should_delay) {
bool InlineTree::ok_to_inline(ciMethod* callee_method, JVMState* jvms, ciCallProfile& profile,
bool& should_delay) {
assert(callee_method != NULL, "caller checks for optimized virtual!");
assert(!should_delay, "should be initialized to false");
#ifdef ASSERT
Expand All @@ -580,68 +572,35 @@ WarmCallInfo* InlineTree::ok_to_inline(ciMethod* callee_method, JVMState* jvms,
if (!pass_initial_checks(caller_method, caller_bci, callee_method)) {
set_msg("failed initial checks");
print_inlining(callee_method, caller_bci, caller_method, false /* !success */);
return NULL;
return false;
}

// Do some parse checks.
set_msg(check_can_parse(callee_method));
if (msg() != NULL) {
print_inlining(callee_method, caller_bci, caller_method, false /* !success */);
return NULL;
return false;
}

// Check if inlining policy says no.
WarmCallInfo wci = *(initial_wci);
bool success = try_to_inline(callee_method, caller_method, caller_bci,
jvms, profile, &wci, should_delay);

#ifndef PRODUCT
if (InlineWarmCalls && (PrintOpto || C->print_inlining())) {
bool cold = wci.is_cold();
bool hot = !cold && wci.is_hot();
bool old_cold = !success;
if (old_cold != cold || (Verbose || WizardMode)) {
if (msg() == NULL) {
set_msg("OK");
}
tty->print(" OldInlining= %4s : %s\n WCI=",
old_cold ? "cold" : "hot", msg());
wci.print();
}
}
#endif
bool success = try_to_inline(callee_method, caller_method, caller_bci, jvms, profile,
should_delay); // out
if (success) {
wci = *(WarmCallInfo::always_hot());
} else {
wci = *(WarmCallInfo::always_cold());
}

if (!InlineWarmCalls) {
if (!wci.is_cold() && !wci.is_hot()) {
// Do not inline the warm calls.
wci = *(WarmCallInfo::always_cold());
}
}

if (!wci.is_cold()) {
// Inline!
if (msg() == NULL) {
set_msg("inline (hot)");
}
print_inlining(callee_method, caller_bci, caller_method, true /* success */);
build_inline_tree_for_callee(callee_method, jvms, caller_bci);
if (InlineWarmCalls && !wci.is_hot()) {
return new (C) WarmCallInfo(wci); // copy to heap
return true;
} else {
// Do not inline
if (msg() == NULL) {
set_msg("too cold to inline");
}
return WarmCallInfo::always_hot();
}

// Do not inline
if (msg() == NULL) {
set_msg("too cold to inline");
print_inlining(callee_method, caller_bci, caller_method, false /* !success */ );
return false;
}
print_inlining(callee_method, caller_bci, caller_method, false /* !success */ );
return NULL;
}

//------------------------------build_inline_tree_for_callee-------------------
Expand Down
40 changes: 0 additions & 40 deletions src/hotspot/share/opto/c2_globals.hpp
Expand Up @@ -419,46 +419,6 @@
"If parser node generation exceeds limit stop inlining") \
range(0, max_jint) \
\
develop(intx, NodeCountInliningStep, 1000, \
"Target size of warm calls inlined between optimization passes") \
range(0, max_jint) \
\
develop(bool, InlineWarmCalls, false, \
"Use a heat-based priority queue to govern inlining") \
\
/* Max values must not exceed WarmCallInfo::MAX_VALUE(). */ \
develop(intx, HotCallCountThreshold, 999999, \
"large numbers of calls (per method invocation) force hotness") \
range(0, ((intx)MIN2((int64_t)max_intx,(int64_t)(+1.0e10)))) \
\
develop(intx, HotCallProfitThreshold, 999999, \
"highly profitable inlining opportunities force hotness") \
range(0, ((intx)MIN2((int64_t)max_intx,(int64_t)(+1.0e10)))) \
\
develop(intx, HotCallTrivialWork, -1, \
"trivial execution time (no larger than this) forces hotness") \
range(-1, ((intx)MIN2((int64_t)max_intx,(int64_t)(+1.0e10)))) \
\
develop(intx, HotCallTrivialSize, -1, \
"trivial methods (no larger than this) force calls to be hot") \
range(-1, ((intx)MIN2((int64_t)max_intx,(int64_t)(+1.0e10)))) \
\
develop(intx, WarmCallMinCount, -1, \
"number of calls (per method invocation) to enable inlining") \
range(-1, ((intx)MIN2((int64_t)max_intx,(int64_t)(+1.0e10)))) \
\
develop(intx, WarmCallMinProfit, -1, \
"number of calls (per method invocation) to enable inlining") \
range(-1, ((intx)MIN2((int64_t)max_intx,(int64_t)(+1.0e10)))) \
\
develop(intx, WarmCallMaxWork, 999999, \
"execution time of the largest inlinable method") \
range(0, ((intx)MIN2((int64_t)max_intx,(int64_t)(+1.0e10)))) \
\
develop(intx, WarmCallMaxSize, 999999, \
"size of the largest inlinable method") \
range(0, ((intx)MIN2((int64_t)max_intx,(int64_t)(+1.0e10)))) \
\
product(intx, MaxNodeLimit, 80000, \
"Maximum number of nodes") \
range(1000, max_jint / 3) \
Expand Down