8172285: UL support for PrintCompilation

Reviewed-by: kvn
This commit is contained in:
Yasumasa Suenaga 2017-02-14 20:00:28 -08:00
parent 5a06c21978
commit b1171ce431
8 changed files with 85 additions and 28 deletions

View File

@ -4289,6 +4289,8 @@ void GraphBuilder::print_inlining(ciMethod* callee, const char* msg, bool succes
}
#endif // INCLUDE_TRACE
CompileTask::print_inlining_ul(callee, scope()->level(), bci(), msg);
if (!compilation()->directive()->PrintInliningOption) {
return;
}

View File

@ -1134,8 +1134,11 @@ void nmethod::log_state_change() const {
xtty->end_elem();
}
}
const char *state_msg = _state == zombie ? "made zombie" : "made not entrant";
CompileTask::print_ul(this, state_msg);
if (PrintCompilation && _state != unloaded) {
print_on(tty, _state == zombie ? "made zombie" : "made not entrant");
print_on(tty, state_msg);
}
}

View File

@ -1765,6 +1765,7 @@ CompilerDirectives* DirectivesStack::_bottom = NULL;
// Compile a method.
//
void CompileBroker::invoke_compiler_on_method(CompileTask* task) {
task->print_ul();
if (PrintCompilation) {
ResourceMark rm;
task->print_tty();

View File

@ -180,11 +180,27 @@ private:
public:
void print(outputStream* st = tty, const char* msg = NULL, bool short_form = false, bool cr = true);
void print_ul(const char* msg = NULL){
Log(jit, compilation) log;
if (log.is_debug()) {
print(log.debug_stream(), msg, /* short form */ true, /* cr */ true);
}
}
static void print(outputStream* st, const nmethod* nm, const char* msg = NULL, bool short_form = false, bool cr = true) {
print_impl(st, nm->method(), nm->compile_id(), nm->comp_level(),
nm->is_osr_method(), nm->is_osr_method() ? nm->osr_entry_bci() : -1, /*is_blocking*/ false,
msg, short_form, cr);
}
static void print_ul(const nmethod* nm, const char* msg = NULL) {
Log(jit, compilation) log;
if (log.is_debug()) {
print_impl(log.debug_stream(), nm->method(), nm->compile_id(),
nm->comp_level(), nm->is_osr_method(),
nm->is_osr_method() ? nm->osr_entry_bci() : -1,
/*is_blocking*/ false,
msg, /* short form */ true, /* cr */ true);
}
}
static void print_inline_indent(int inline_level, outputStream* st = tty);
@ -206,6 +222,12 @@ public:
static void print_inlining_tty(ciMethod* method, int inline_level, int bci, const char* msg = NULL) {
print_inlining_inner(tty, method, inline_level, bci, msg);
}
static void print_inlining_ul(ciMethod* method, int inline_level, int bci, const char* msg = NULL) {
Log(jit, inlining) log;
if (log.is_debug()) {
print_inlining_inner(log.debug_stream(), method, inline_level, bci, msg);
}
}
};
#endif // SHARE_VM_COMPILER_COMPILETASK_HPP

View File

@ -50,6 +50,7 @@
LOG_TAG(cleanup) \
LOG_TAG(codecache) \
LOG_TAG(compaction) \
LOG_TAG(compilation) \
LOG_TAG(constraints) \
LOG_TAG(constantpool) \
LOG_TAG(coops) \
@ -70,7 +71,9 @@
LOG_TAG(ihop) \
LOG_TAG(iklass) \
LOG_TAG(init) \
LOG_TAG(inlining) \
LOG_TAG(itables) \
LOG_TAG(jit) \
LOG_TAG(jni) \
LOG_TAG(jvmti) \
LOG_TAG(liveness) \

View File

@ -496,6 +496,8 @@ void InlineTree::print_inlining(ciMethod* callee_method, int caller_bci,
C->log()->inline_fail(inline_msg);
}
}
CompileTask::print_inlining_ul(callee_method, inline_level(),
caller_bci, inline_msg);
if (C->print_inlining()) {
C->print_inlining(callee_method, inline_level(), caller_bci, inline_msg);
if (callee_method == NULL) tty->print(" callee not monotonic or profiled");

View File

@ -387,8 +387,11 @@ JVMState* LibraryIntrinsic::generate(JVMState* jvms) {
// Try to inline the intrinsic.
if ((CheckIntrinsics ? callee->intrinsic_candidate() : true) &&
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);
if (C->print_intrinsics() || C->print_inlining()) {
C->print_inlining(callee, jvms->depth() - 1, bci, is_virtual() ? "(intrinsic, virtual)" : "(intrinsic)");
C->print_inlining(callee, jvms->depth() - 1, bci, inline_msg);
}
C->gather_intrinsic_statistics(intrinsic_id(), is_virtual(), Compile::_intrinsic_worked);
if (C->log()) {
@ -404,22 +407,30 @@ JVMState* LibraryIntrinsic::generate(JVMState* jvms) {
}
// The intrinsic bailed out
if (C->print_intrinsics() || C->print_inlining()) {
if (jvms->has_method()) {
// Not a root compile.
const char* msg;
if (callee->intrinsic_candidate()) {
msg = is_virtual() ? "failed to inline (intrinsic, virtual)" : "failed to inline (intrinsic)";
} else {
msg = is_virtual() ? "failed to inline (intrinsic, virtual), method not annotated"
: "failed to inline (intrinsic), method not annotated";
}
C->print_inlining(callee, jvms->depth() - 1, bci, msg);
if (jvms->has_method()) {
// Not a root compile.
const char* msg;
if (callee->intrinsic_candidate()) {
msg = is_virtual() ? "failed to inline (intrinsic, virtual)" : "failed to inline (intrinsic)";
} else {
// Root compile
tty->print("Did not generate intrinsic %s%s at bci:%d in",
vmIntrinsics::name_at(intrinsic_id()),
(is_virtual() ? " (virtual)" : ""), bci);
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);
if (C->print_intrinsics() || C->print_inlining()) {
C->print_inlining(callee, jvms->depth() - 1, bci, msg);
}
} else {
// Root compile
ResourceMark rm;
stringStream msg_stream;
msg_stream.print("Did not generate intrinsic %s%s at bci:%d in",
vmIntrinsics::name_at(intrinsic_id()),
is_virtual() ? " (virtual)" : "", bci);
const char *msg = msg_stream.as_string();
log_debug(jit, inlining)("%s", msg);
if (C->print_intrinsics() || C->print_inlining()) {
tty->print("%s", msg);
}
}
C->gather_intrinsic_statistics(intrinsic_id(), is_virtual(), Compile::_intrinsic_failed);
@ -445,8 +456,11 @@ Node* LibraryIntrinsic::generate_predicate(JVMState* jvms, int predicate) {
Node* slow_ctl = kit.try_to_predicate(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);
if (C->print_intrinsics() || C->print_inlining()) {
C->print_inlining(callee, jvms->depth() - 1, bci, is_virtual() ? "(intrinsic, virtual, predicate)" : "(intrinsic, predicate)");
C->print_inlining(callee, jvms->depth() - 1, bci, inline_msg);
}
C->gather_intrinsic_statistics(intrinsic_id(), is_virtual(), Compile::_intrinsic_worked);
if (C->log()) {
@ -459,16 +473,24 @@ Node* LibraryIntrinsic::generate_predicate(JVMState* jvms, int predicate) {
}
// The intrinsic bailed out
if (C->print_intrinsics() || C->print_inlining()) {
if (jvms->has_method()) {
// Not a root compile.
const char* msg = "failed to generate predicate for intrinsic";
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);
if (C->print_intrinsics() || C->print_inlining()) {
C->print_inlining(kit.callee(), jvms->depth() - 1, bci, msg);
} else {
// Root compile
C->print_inlining_stream()->print("Did not generate predicate for intrinsic %s%s at bci:%d in",
vmIntrinsics::name_at(intrinsic_id()),
(is_virtual() ? " (virtual)" : ""), bci);
}
} else {
// Root compile
ResourceMark rm;
stringStream msg_stream;
msg_stream.print("Did not generate intrinsic %s%s at bci:%d in",
vmIntrinsics::name_at(intrinsic_id()),
is_virtual() ? " (virtual)" : "", bci);
const char *msg = msg_stream.as_string();
log_debug(jit, inlining)("%s", msg);
if (C->print_intrinsics() || C->print_inlining()) {
C->print_inlining_stream()->print("%s", msg);
}
}
C->gather_intrinsic_statistics(intrinsic_id(), is_virtual(), Compile::_intrinsic_failed);

View File

@ -2891,9 +2891,11 @@ void AdapterHandlerLibrary::create_native_wrapper(const methodHandle& method) {
// Install the generated code.
if (nm != NULL) {
const char *msg = method->is_static() ? "(static)" : "";
CompileTask::print_ul(nm, msg);
if (PrintCompilation) {
ttyLocker ttyl;
CompileTask::print(tty, nm, method->is_static() ? "(static)" : "");
CompileTask::print(tty, nm, msg);
}
nm->post_compiled_method_load_event();
}