8314452: Explicitly indicate inlining success/failure in PrintInlining
Reviewed-by: kvn, shade, thartmann
This commit is contained in:
parent
b482e6d902
commit
68f69417c7
src/hotspot/share
c1
compiler
opto
test/hotspot/jtreg/compiler
@ -4438,12 +4438,12 @@ void GraphBuilder::print_inlining(ciMethod* callee, const char* msg, bool succes
|
||||
CompilerEvent::InlineEvent::post(event, compilation()->env()->task()->compile_id(), method()->get_Method(), callee, success, msg, bci());
|
||||
}
|
||||
|
||||
CompileTask::print_inlining_ul(callee, scope()->level(), bci(), msg);
|
||||
CompileTask::print_inlining_ul(callee, scope()->level(), bci(), inlining_result_of(success), msg);
|
||||
|
||||
if (!compilation()->directive()->PrintInliningOption) {
|
||||
return;
|
||||
}
|
||||
CompileTask::print_inlining_tty(callee, scope()->level(), bci(), msg);
|
||||
CompileTask::print_inlining_tty(callee, scope()->level(), bci(), inlining_result_of(success), msg);
|
||||
if (success && CIPrintMethodCodes) {
|
||||
callee->print_codes();
|
||||
}
|
||||
|
@ -409,7 +409,7 @@ bool CompileTask::check_break_at_flags() {
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// CompileTask::print_inlining
|
||||
void CompileTask::print_inlining_inner(outputStream* st, ciMethod* method, int inline_level, int bci, const char* msg) {
|
||||
void CompileTask::print_inlining_inner(outputStream* st, ciMethod* method, int inline_level, int bci, InliningResult result, const char* msg) {
|
||||
// 1234567
|
||||
st->print(" "); // print timestamp
|
||||
// 1234
|
||||
@ -444,7 +444,9 @@ void CompileTask::print_inlining_inner(outputStream* st, ciMethod* method, int i
|
||||
st->print(" (not loaded)");
|
||||
|
||||
if (msg != nullptr) {
|
||||
st->print(" %s", msg);
|
||||
st->print(" %s%s", result == InliningResult::SUCCESS ? "" : "failed to inline: ", msg);
|
||||
} else if (result == InliningResult::FAILURE) {
|
||||
st->print(" %s", "failed to inline");
|
||||
}
|
||||
st->cr();
|
||||
}
|
||||
@ -469,11 +471,11 @@ void CompileTask::print_ul(const nmethod* nm, const char* msg) {
|
||||
}
|
||||
}
|
||||
|
||||
void CompileTask::print_inlining_ul(ciMethod* method, int inline_level, int bci, const char* msg) {
|
||||
void CompileTask::print_inlining_ul(ciMethod* method, int inline_level, int bci, InliningResult result, const char* msg) {
|
||||
LogTarget(Debug, jit, inlining) lt;
|
||||
if (lt.is_enabled()) {
|
||||
LogStream ls(lt);
|
||||
print_inlining_inner(&ls, method, inline_level, bci, msg);
|
||||
print_inlining_inner(&ls, method, inline_level, bci, result, msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,12 @@ class DirectiveSet;
|
||||
|
||||
JVMCI_ONLY(class JVMCICompileState;)
|
||||
|
||||
enum class InliningResult { SUCCESS, FAILURE };
|
||||
|
||||
inline InliningResult inlining_result_of(bool success) {
|
||||
return success ? InliningResult::SUCCESS : InliningResult::FAILURE;
|
||||
}
|
||||
|
||||
// CompileTask
|
||||
//
|
||||
// An entry in the compile queue. It represents a pending or current
|
||||
@ -225,11 +231,11 @@ public:
|
||||
|
||||
bool check_break_at_flags();
|
||||
|
||||
static void print_inlining_inner(outputStream* st, ciMethod* method, int inline_level, int bci, const char* msg = nullptr);
|
||||
static void print_inlining_tty(ciMethod* method, int inline_level, int bci, const char* msg = nullptr) {
|
||||
print_inlining_inner(tty, method, inline_level, bci, msg);
|
||||
static void print_inlining_inner(outputStream* st, ciMethod* method, int inline_level, int bci, InliningResult result, const char* msg = nullptr);
|
||||
static void print_inlining_tty(ciMethod* method, int inline_level, int bci, InliningResult result, const char* msg = nullptr) {
|
||||
print_inlining_inner(tty, method, inline_level, bci, result, msg);
|
||||
}
|
||||
static void print_inlining_ul(ciMethod* method, int inline_level, int bci, const char* msg = nullptr);
|
||||
static void print_inlining_ul(ciMethod* method, int inline_level, int bci, InliningResult result, const char* msg = nullptr);
|
||||
};
|
||||
|
||||
#endif // SHARE_COMPILER_COMPILETASK_HPP
|
||||
|
@ -545,9 +545,9 @@ void InlineTree::print_inlining(ciMethod* callee_method, int caller_bci,
|
||||
}
|
||||
}
|
||||
CompileTask::print_inlining_ul(callee_method, inline_level(),
|
||||
caller_bci, inline_msg);
|
||||
caller_bci, inlining_result_of(success), inline_msg);
|
||||
if (C->print_inlining()) {
|
||||
C->print_inlining(callee_method, inline_level(), caller_bci, inline_msg);
|
||||
C->print_inlining(callee_method, inline_level(), caller_bci, inlining_result_of(success), inline_msg);
|
||||
guarantee(callee_method != nullptr, "would crash in CompilerEvent::InlineEvent::post");
|
||||
if (Verbose) {
|
||||
const InlineTree *top = this;
|
||||
|
@ -352,11 +352,11 @@ class LateInlineCallGenerator : public DirectCallGenerator {
|
||||
return DirectCallGenerator::generate(jvms);
|
||||
}
|
||||
|
||||
virtual void print_inlining_late(const char* msg) {
|
||||
virtual void print_inlining_late(InliningResult result, const char* msg) {
|
||||
CallNode* call = call_node();
|
||||
Compile* C = Compile::current();
|
||||
C->print_inlining_assert_ready();
|
||||
C->print_inlining(method(), call->jvms()->depth()-1, call->jvms()->bci(), msg);
|
||||
C->print_inlining(method(), call->jvms()->depth()-1, call->jvms()->bci(), result, msg);
|
||||
C->print_inlining_move_to(this);
|
||||
C->print_inlining_update_delayed(this);
|
||||
}
|
||||
@ -494,11 +494,11 @@ class LateInlineVirtualCallGenerator : public VirtualCallGenerator {
|
||||
return new_jvms;
|
||||
}
|
||||
|
||||
virtual void print_inlining_late(const char* msg) {
|
||||
virtual void print_inlining_late(InliningResult result, const char* msg) {
|
||||
CallNode* call = call_node();
|
||||
Compile* C = Compile::current();
|
||||
C->print_inlining_assert_ready();
|
||||
C->print_inlining(method(), call->jvms()->depth()-1, call->jvms()->bci(), msg);
|
||||
C->print_inlining(method(), call->jvms()->depth()-1, call->jvms()->bci(), result, msg);
|
||||
C->print_inlining_move_to(this);
|
||||
C->print_inlining_update_delayed(this);
|
||||
}
|
||||
@ -527,7 +527,7 @@ bool LateInlineVirtualCallGenerator::do_late_inline_check(Compile* C, JVMState*
|
||||
const Type* recv_type = C->initial_gvn()->type(receiver);
|
||||
if (recv_type->maybe_null()) {
|
||||
if (C->print_inlining() || C->print_intrinsics()) {
|
||||
C->print_inlining(method(), jvms->depth()-1, call_node()->jvms()->bci(),
|
||||
C->print_inlining(method(), jvms->depth()-1, call_node()->jvms()->bci(), InliningResult::FAILURE,
|
||||
"late call devirtualization failed (receiver may be null)");
|
||||
}
|
||||
return false;
|
||||
@ -537,7 +537,7 @@ bool LateInlineVirtualCallGenerator::do_late_inline_check(Compile* C, JVMState*
|
||||
if (!allow_inline && _callee->holder()->is_interface()) {
|
||||
// Don't convert the interface call to a direct call guarded by an interface subtype check.
|
||||
if (C->print_inlining() || C->print_intrinsics()) {
|
||||
C->print_inlining(method(), jvms->depth()-1, call_node()->jvms()->bci(),
|
||||
C->print_inlining(method(), jvms->depth()-1, call_node()->jvms()->bci(), InliningResult::FAILURE,
|
||||
"late call devirtualization failed (interface call)");
|
||||
}
|
||||
return false;
|
||||
|
@ -171,22 +171,28 @@ class CallGenerator : public ArenaObj {
|
||||
CallGenerator* cg);
|
||||
virtual Node* generate_predicate(JVMState* jvms, int predicate) { return nullptr; };
|
||||
|
||||
virtual void print_inlining_late(const char* msg) { ShouldNotReachHere(); }
|
||||
virtual void print_inlining_late(InliningResult result, const char* msg) { ShouldNotReachHere(); }
|
||||
|
||||
static void print_inlining(Compile* C, ciMethod* callee, int inline_level, int bci, const char* msg) {
|
||||
if (C->print_inlining()) {
|
||||
C->print_inlining(callee, inline_level, bci, msg);
|
||||
}
|
||||
print_inlining_impl(C, callee, inline_level, bci, InliningResult::SUCCESS, msg);
|
||||
}
|
||||
|
||||
static void print_inlining_failure(Compile* C, ciMethod* callee, int inline_level, int bci, const char* msg) {
|
||||
print_inlining(C, callee, inline_level, bci, msg);
|
||||
print_inlining_impl(C, callee, inline_level, bci, InliningResult::FAILURE, msg);
|
||||
C->log_inline_failure(msg);
|
||||
}
|
||||
|
||||
static bool is_inlined_method_handle_intrinsic(JVMState* jvms, ciMethod* m);
|
||||
static bool is_inlined_method_handle_intrinsic(ciMethod* caller, int bci, ciMethod* m);
|
||||
static bool is_inlined_method_handle_intrinsic(ciMethod* symbolic_info, ciMethod* m);
|
||||
|
||||
private:
|
||||
static void print_inlining_impl(Compile* C, ciMethod* callee, int inline_level, int bci,
|
||||
InliningResult result, const char* msg) {
|
||||
if (C->print_inlining()) {
|
||||
C->print_inlining(callee, inline_level, bci, result, msg);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -2101,7 +2101,7 @@ void Compile::inline_incrementally(PhaseIterGVN& igvn) {
|
||||
CallGenerator* cg = _late_inlines.at(i);
|
||||
const char* msg = "live nodes > LiveNodeCountInliningCutoff";
|
||||
if (do_print_inlining) {
|
||||
cg->print_inlining_late(msg);
|
||||
cg->print_inlining_late(InliningResult::FAILURE, msg);
|
||||
}
|
||||
log_late_inline_failure(cg, msg);
|
||||
}
|
||||
|
@ -512,9 +512,9 @@ private:
|
||||
void print_inlining_assert_ready();
|
||||
void print_inlining_reset();
|
||||
|
||||
void print_inlining(ciMethod* method, int inline_level, int bci, const char* msg = nullptr) {
|
||||
void print_inlining(ciMethod* method, int inline_level, int bci, InliningResult result, const char* msg = nullptr) {
|
||||
stringStream ss;
|
||||
CompileTask::print_inlining_inner(&ss, method, inline_level, bci, msg);
|
||||
CompileTask::print_inlining_inner(&ss, method, inline_level, bci, result, msg);
|
||||
print_inlining_stream()->print("%s", ss.freeze());
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ void trace_type_profile(Compile* C, ciMethod* method, int depth, int bci, ciMeth
|
||||
method->print_short_name();
|
||||
tty->cr();
|
||||
}
|
||||
CompileTask::print_inlining_tty(prof_method, depth, bci);
|
||||
CompileTask::print_inlining_tty(prof_method, depth, bci, InliningResult::SUCCESS);
|
||||
} else {
|
||||
out = C->print_inlining_stream();
|
||||
}
|
||||
@ -373,7 +373,7 @@ CallGenerator* Compile::call_generator(ciMethod* callee, int vtable_index, bool
|
||||
if (call_does_dispatch) {
|
||||
const char* msg = "virtual call";
|
||||
if (C->print_inlining()) {
|
||||
print_inlining(callee, jvms->depth() - 1, jvms->bci(), msg);
|
||||
print_inlining(callee, jvms->depth() - 1, jvms->bci(), InliningResult::FAILURE, msg);
|
||||
}
|
||||
C->log_inline_failure(msg);
|
||||
if (IncrementalInlineVirtual && allow_inline) {
|
||||
|
@ -118,9 +118,9 @@ JVMState* LibraryIntrinsic::generate(JVMState* jvms) {
|
||||
kit.try_to_inline(_last_predicate)) {
|
||||
const char *inline_msg = is_virtual() ? "(intrinsic, virtual)"
|
||||
: "(intrinsic)";
|
||||
CompileTask::print_inlining_ul(callee, jvms->depth() - 1, bci, inline_msg);
|
||||
CompileTask::print_inlining_ul(callee, jvms->depth() - 1, bci, InliningResult::SUCCESS, inline_msg);
|
||||
if (C->print_intrinsics() || C->print_inlining()) {
|
||||
C->print_inlining(callee, jvms->depth() - 1, bci, inline_msg);
|
||||
C->print_inlining(callee, jvms->depth() - 1, bci, InliningResult::SUCCESS, inline_msg);
|
||||
}
|
||||
C->gather_intrinsic_statistics(intrinsic_id(), is_virtual(), Compile::_intrinsic_worked);
|
||||
if (C->log()) {
|
||||
@ -146,9 +146,9 @@ JVMState* LibraryIntrinsic::generate(JVMState* jvms) {
|
||||
msg = is_virtual() ? "failed to inline (intrinsic, virtual), method not annotated"
|
||||
: "failed to inline (intrinsic), method not annotated";
|
||||
}
|
||||
CompileTask::print_inlining_ul(callee, jvms->depth() - 1, bci, msg);
|
||||
CompileTask::print_inlining_ul(callee, jvms->depth() - 1, bci, InliningResult::FAILURE, msg);
|
||||
if (C->print_intrinsics() || C->print_inlining()) {
|
||||
C->print_inlining(callee, jvms->depth() - 1, bci, msg);
|
||||
C->print_inlining(callee, jvms->depth() - 1, bci, InliningResult::FAILURE, msg);
|
||||
}
|
||||
} else {
|
||||
// Root compile
|
||||
@ -189,9 +189,9 @@ Node* LibraryIntrinsic::generate_predicate(JVMState* jvms, int predicate) {
|
||||
if (!kit.failing()) {
|
||||
const char *inline_msg = is_virtual() ? "(intrinsic, virtual, predicate)"
|
||||
: "(intrinsic, predicate)";
|
||||
CompileTask::print_inlining_ul(callee, jvms->depth() - 1, bci, inline_msg);
|
||||
CompileTask::print_inlining_ul(callee, jvms->depth() - 1, bci, InliningResult::SUCCESS, inline_msg);
|
||||
if (C->print_intrinsics() || C->print_inlining()) {
|
||||
C->print_inlining(callee, jvms->depth() - 1, bci, inline_msg);
|
||||
C->print_inlining(callee, jvms->depth() - 1, bci, InliningResult::SUCCESS, inline_msg);
|
||||
}
|
||||
C->gather_intrinsic_statistics(intrinsic_id(), is_virtual(), Compile::_intrinsic_worked);
|
||||
if (C->log()) {
|
||||
@ -207,9 +207,9 @@ Node* LibraryIntrinsic::generate_predicate(JVMState* jvms, int predicate) {
|
||||
if (jvms->has_method()) {
|
||||
// Not a root compile.
|
||||
const char* msg = "failed to generate predicate for intrinsic";
|
||||
CompileTask::print_inlining_ul(kit.callee(), jvms->depth() - 1, bci, msg);
|
||||
CompileTask::print_inlining_ul(kit.callee(), jvms->depth() - 1, bci, InliningResult::FAILURE, msg);
|
||||
if (C->print_intrinsics() || C->print_inlining()) {
|
||||
C->print_inlining(kit.callee(), jvms->depth() - 1, bci, msg);
|
||||
C->print_inlining(kit.callee(), jvms->depth() - 1, bci, InliningResult::FAILURE, msg);
|
||||
}
|
||||
} else {
|
||||
// Root compile
|
||||
|
@ -210,9 +210,9 @@ public class TestInlineUnloaded {
|
||||
output.shouldMatch("TestNull::testRet .* unloaded signature classes");
|
||||
output.shouldMatch("TestNull::test .* unloaded signature classes");
|
||||
|
||||
output.shouldNotMatch("TestNull::testArg .* inline");
|
||||
output.shouldNotMatch("TestNull::testRet .* inline");
|
||||
output.shouldNotMatch("TestNull::test .* inline");
|
||||
output.shouldMatch("TestNull::testArg .* failed to inline");
|
||||
output.shouldMatch("TestNull::testRet .* failed to inline");
|
||||
output.shouldMatch("TestNull::test .* failed to inline");
|
||||
});
|
||||
run("TestLoadedRemotely", output -> {
|
||||
output.shouldMatch("TestNull::testArg .* inline");
|
||||
|
@ -86,11 +86,11 @@ public abstract class InliningBase extends DumpReplayBase {
|
||||
}
|
||||
|
||||
public boolean isDisallowedByReplay() {
|
||||
return reason.equals("disallowed by ciReplay");
|
||||
return reason.equals("failed to inline: disallowed by ciReplay");
|
||||
}
|
||||
|
||||
public boolean isUnloadedSignatureClasses() {
|
||||
return reason.equals("unloaded signature classes");
|
||||
return reason.equals("failed to inline: unloaded signature classes");
|
||||
}
|
||||
|
||||
public boolean isForcedIncrementalInlineByReplay() {
|
||||
@ -102,7 +102,7 @@ public abstract class InliningBase extends DumpReplayBase {
|
||||
}
|
||||
|
||||
public boolean isTooDeep() {
|
||||
return reason.equals("inlining too deep");
|
||||
return reason.equals("failed to inline: inlining too deep");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -52,8 +52,8 @@ public class ResolvedClassTest {
|
||||
|
||||
analyzer.shouldHaveExitValue(0);
|
||||
|
||||
analyzer.shouldNotContain("TestStatic$A::m (1 bytes) not inlineable");
|
||||
analyzer.shouldNotContain("TestStatic$A::m (1 bytes) no static binding");
|
||||
analyzer.shouldNotContain("TestStatic$A::m (1 bytes) failed to inline: not inlineable");
|
||||
analyzer.shouldNotContain("TestStatic$A::m (1 bytes) failed to inline: no static binding");
|
||||
|
||||
analyzer.shouldContain("TestStatic$A::m (1 bytes) inline");
|
||||
}
|
||||
@ -88,7 +88,7 @@ public class ResolvedClassTest {
|
||||
|
||||
analyzer.shouldHaveExitValue(0);
|
||||
|
||||
analyzer.shouldContain("TestStaticInit$A::m (1 bytes) no static binding");
|
||||
analyzer.shouldContain("TestStaticInit$A::m (1 bytes) failed to inline: no static binding");
|
||||
}
|
||||
|
||||
static class TestStaticInit {
|
||||
@ -125,10 +125,10 @@ public class ResolvedClassTest {
|
||||
|
||||
analyzer.shouldHaveExitValue(0);
|
||||
|
||||
analyzer.shouldNotMatch("java\\.lang\\.invoke\\..+::linkToTargetMethod \\(9 bytes\\) not inlineable");
|
||||
analyzer.shouldNotMatch("java\\.lang\\.invoke\\..+::linkToTargetMethod \\(9 bytes\\) failed to inline: not inlineable");
|
||||
|
||||
analyzer.shouldMatch("java\\.lang\\.invoke\\..+::linkToTargetMethod \\(9 bytes\\) force inline by annotation");
|
||||
analyzer.shouldContain("java/lang/invoke/MethodHandle::invokeBasic (not loaded) not inlineable");
|
||||
analyzer.shouldContain("java/lang/invoke/MethodHandle::invokeBasic (not loaded) failed to inline: not inlineable");
|
||||
}
|
||||
|
||||
static class TestIndy {
|
||||
|
Loading…
x
Reference in New Issue
Block a user