mirror of
https://github.com/openjdk/jdk.git
synced 2026-07-13 04:27:53 +00:00
8073607: add trace events for inlining
Reviewed-by: kvn, fzhinkin, mgronlun
This commit is contained in:
parent
2632925f9f
commit
140bf2be86
@ -4306,7 +4306,18 @@ void GraphBuilder::print_inlining(ciMethod* callee, const char* msg, bool succes
|
||||
log->inline_fail("reason unknown");
|
||||
}
|
||||
}
|
||||
|
||||
#if INCLUDE_TRACE
|
||||
EventCompilerInlining event;
|
||||
if (event.should_commit()) {
|
||||
event.set_compileID(compilation()->env()->task()->compile_id());
|
||||
event.set_message(msg);
|
||||
event.set_succeeded(success);
|
||||
event.set_bci(bci());
|
||||
event.set_caller(method()->get_Method());
|
||||
event.set_callee(callee->to_trace_struct());
|
||||
event.commit();
|
||||
}
|
||||
#endif // INCLUDE_TRACE
|
||||
if (!PrintInlining && !compilation()->method()->has_option("PrintInlining")) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -48,6 +48,7 @@
|
||||
#include "runtime/deoptimization.hpp"
|
||||
#include "utilities/bitMap.inline.hpp"
|
||||
#include "utilities/xmlstream.hpp"
|
||||
#include "trace/tracing.hpp"
|
||||
#ifdef COMPILER2
|
||||
#include "ci/bcEscapeAnalyzer.hpp"
|
||||
#include "ci/ciTypeFlow.hpp"
|
||||
@ -1466,3 +1467,13 @@ void ciMethod::print_impl(outputStream* st) {
|
||||
st->print(" loaded=false");
|
||||
}
|
||||
}
|
||||
|
||||
#if INCLUDE_TRACE
|
||||
TraceStructCiMethod ciMethod::to_trace_struct() const {
|
||||
TraceStructCiMethod result;
|
||||
result.set_class(holder()->name()->as_utf8());
|
||||
result.set_name(name()->as_utf8());
|
||||
result.set_signature(signature()->as_symbol()->as_utf8());
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -32,13 +32,14 @@
|
||||
#include "compiler/methodLiveness.hpp"
|
||||
#include "prims/methodHandles.hpp"
|
||||
#include "utilities/bitMap.hpp"
|
||||
#include "trace/tracing.hpp"
|
||||
|
||||
class ciMethodBlocks;
|
||||
class MethodLiveness;
|
||||
class BitMap;
|
||||
class Arena;
|
||||
class BCEscapeAnalyzer;
|
||||
|
||||
class InlineTree;
|
||||
|
||||
// ciMethod
|
||||
//
|
||||
@ -52,6 +53,7 @@ class ciMethod : public ciMetadata {
|
||||
friend class ciBytecodeStream;
|
||||
friend class ciMethodHandle;
|
||||
friend class ciReplay;
|
||||
friend class InlineTree;
|
||||
|
||||
private:
|
||||
// General method information.
|
||||
@ -95,12 +97,6 @@ class ciMethod : public ciMetadata {
|
||||
ciMethod(methodHandle h_m, ciInstanceKlass* holder);
|
||||
ciMethod(ciInstanceKlass* holder, ciSymbol* name, ciSymbol* signature, ciInstanceKlass* accessor);
|
||||
|
||||
Method* get_Method() const {
|
||||
Method* m = (Method*)_metadata;
|
||||
assert(m != NULL, "illegal use of unloaded method");
|
||||
return m;
|
||||
}
|
||||
|
||||
oop loader() const { return _holder->loader(); }
|
||||
|
||||
const char* type_string() { return "ciMethod"; }
|
||||
@ -158,6 +154,11 @@ class ciMethod : public ciMetadata {
|
||||
}
|
||||
}
|
||||
|
||||
Method* get_Method() const {
|
||||
Method* m = (Method*)_metadata;
|
||||
assert(m != NULL, "illegal use of unloaded method");
|
||||
return m;
|
||||
}
|
||||
|
||||
// Method code and related information.
|
||||
address code() { if (_code == NULL) load_code(); return _code; }
|
||||
@ -339,6 +340,10 @@ class ciMethod : public ciMetadata {
|
||||
// Print the name of this method in various incarnations.
|
||||
void print_name(outputStream* st = tty);
|
||||
void print_short_name(outputStream* st = tty);
|
||||
|
||||
#if INCLUDE_TRACE
|
||||
TraceStructCiMethod to_trace_struct() const;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // SHARE_VM_CI_CIMETHOD_HPP
|
||||
|
||||
@ -33,6 +33,7 @@
|
||||
#include "opto/callGenerator.hpp"
|
||||
#include "opto/parse.hpp"
|
||||
#include "runtime/handles.inline.hpp"
|
||||
#include "utilities/events.hpp"
|
||||
|
||||
//=============================================================================
|
||||
//------------------------------InlineTree-------------------------------------
|
||||
@ -490,7 +491,7 @@ const char* InlineTree::check_can_parse(ciMethod* callee) {
|
||||
|
||||
//------------------------------print_inlining---------------------------------
|
||||
void InlineTree::print_inlining(ciMethod* callee_method, int caller_bci,
|
||||
bool success) const {
|
||||
ciMethod* caller_method, bool success) const {
|
||||
const char* inline_msg = msg();
|
||||
assert(inline_msg != NULL, "just checking");
|
||||
if (C->log() != NULL) {
|
||||
@ -509,6 +510,18 @@ void InlineTree::print_inlining(ciMethod* callee_method, int caller_bci,
|
||||
//tty->print(" bcs: %d+%d invoked: %d", top->count_inline_bcs(), callee_method->code_size(), callee_method->interpreter_invocation_count());
|
||||
}
|
||||
}
|
||||
#if INCLUDE_TRACE
|
||||
EventCompilerInlining event;
|
||||
if (event.should_commit()) {
|
||||
event.set_compileID(C->compile_id());
|
||||
event.set_message(inline_msg);
|
||||
event.set_succeeded(success);
|
||||
event.set_bci(caller_bci);
|
||||
event.set_caller(caller_method->get_Method());
|
||||
event.set_callee(callee_method->to_trace_struct());
|
||||
event.commit();
|
||||
}
|
||||
#endif // INCLUDE_TRACE
|
||||
}
|
||||
|
||||
//------------------------------ok_to_inline-----------------------------------
|
||||
@ -531,14 +544,14 @@ WarmCallInfo* InlineTree::ok_to_inline(ciMethod* callee_method, JVMState* jvms,
|
||||
// Do some initial checks.
|
||||
if (!pass_initial_checks(caller_method, caller_bci, callee_method)) {
|
||||
set_msg("failed initial checks");
|
||||
print_inlining(callee_method, caller_bci, false /* !success */);
|
||||
print_inlining(callee_method, caller_bci, caller_method, false /* !success */);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Do some parse checks.
|
||||
set_msg(check_can_parse(callee_method));
|
||||
if (msg() != NULL) {
|
||||
print_inlining(callee_method, caller_bci, false /* !success */);
|
||||
print_inlining(callee_method, caller_bci, caller_method, false /* !success */);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -580,10 +593,11 @@ WarmCallInfo* InlineTree::ok_to_inline(ciMethod* callee_method, JVMState* jvms,
|
||||
if (msg() == NULL) {
|
||||
set_msg("inline (hot)");
|
||||
}
|
||||
print_inlining(callee_method, caller_bci, true /* success */);
|
||||
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())
|
||||
if (InlineWarmCalls && !wci.is_hot()) {
|
||||
return new (C) WarmCallInfo(wci); // copy to heap
|
||||
}
|
||||
return WarmCallInfo::always_hot();
|
||||
}
|
||||
|
||||
@ -591,7 +605,7 @@ WarmCallInfo* InlineTree::ok_to_inline(ciMethod* callee_method, JVMState* jvms,
|
||||
if (msg() == NULL) {
|
||||
set_msg("too cold to inline");
|
||||
}
|
||||
print_inlining(callee_method, caller_bci, false /* !success */ );
|
||||
print_inlining(callee_method, caller_bci, caller_method, false /* !success */ );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@ -87,7 +87,7 @@ protected:
|
||||
JVMState* jvms,
|
||||
WarmCallInfo* wci_result);
|
||||
void print_inlining(ciMethod* callee_method, int caller_bci,
|
||||
bool success) const;
|
||||
ciMethod* caller_method, bool success) const;
|
||||
|
||||
InlineTree* caller_tree() const { return _caller_tree; }
|
||||
InlineTree* callee_at(int bci, ciMethod* m) const;
|
||||
|
||||
@ -400,6 +400,22 @@ Declares a structure type that can be used in other events.
|
||||
<value type="UINT" field="compileID" label="Compilation ID" relation="COMP_ID"/>
|
||||
</event>
|
||||
|
||||
<struct id="CiMethod">
|
||||
<value type="UTF8" field="class" label="Class name"/>
|
||||
<value type="UTF8" field="name" label="Method name"/>
|
||||
<value type="UTF8" field="signature" label="Method signature"/>
|
||||
</struct>
|
||||
|
||||
<event id="CompilerInlining" path="vm/compiler/optimization/inlining" label="Method Inlining"
|
||||
has_thread="true" is_instant="true">
|
||||
<value type="UINT" field="compileID" label="Compilation ID" relation="COMP_ID"/>
|
||||
<value type="METHOD" field="caller" label="Caller Method"/>
|
||||
<structvalue type="CiMethod" field="callee" label="Callee Method"/>
|
||||
<value type="BOOLEAN" field="succeeded" label="Succeeded"/>
|
||||
<value type="UTF8" field="message" label="Message"/>
|
||||
<value type="INTEGER" field="bci" label="Byte Code Index"/>
|
||||
</event>
|
||||
|
||||
<!-- Code sweeper events -->
|
||||
|
||||
<event id="SweepCodeCache" path="vm/code_sweeper/sweep" label="Sweep Code Cache"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user