--- old/src/share/vm/compiler/compileBroker.hpp 2014-07-01 11:37:43.239304801 +0200 +++ new/src/share/vm/compiler/compileBroker.hpp 2014-07-01 11:37:43.163304804 +0200 @@ -109,15 +109,17 @@ private: static void print_compilation_impl(outputStream* st, Method* method, int compile_id, int comp_level, - bool is_osr_method = false, int osr_bci = -1, bool is_blocking = false, + bool is_osr_method = false, int osr_bci = InvocationEntryBci, bool is_blocking = false, const char* msg = NULL, bool short_form = false); public: void print_compilation(outputStream* st = tty, const char* msg = NULL, bool short_form = false); static void print_compilation(outputStream* st, const nmethod* nm, const char* msg = NULL, bool short_form = false) { - print_compilation_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); + print_compilation(st, nm, nm->is_osr_method() ? nm->osr_entry_bci() : InvocationEntryBci, msg, short_form); + } + static void print_compilation(outputStream* st, const nmethod* nm, int osr_bci, const char* msg = NULL, bool short_form = false) { + print_compilation_impl(st, nm->method(), nm->compile_id(), nm->comp_level(), nm->is_osr_method(), + osr_bci, /*is_blocking*/ false, msg, short_form); } static void print_inlining(outputStream* st, ciMethod* method, int inline_level, int bci, const char* msg = NULL); --- old/src/share/vm/code/nmethod.cpp 2014-07-01 11:37:43.235304801 +0200 +++ new/src/share/vm/code/nmethod.cpp 2014-07-01 11:37:43.119304806 +0200 @@ -958,14 +958,14 @@ // Print out more verbose output usually for a newly created nmethod. -void nmethod::print_on(outputStream* st, const char* msg) const { +void nmethod::print_on(outputStream* st, const char* msg, int entry_bci) const { if (st != NULL) { ttyLocker ttyl; if (WizardMode) { - CompileTask::print_compilation(st, this, msg, /*short_form:*/ true); + CompileTask::print_compilation(st, this, entry_bci, msg, /*short_form:*/ true); st->print_cr(" (" INTPTR_FORMAT ")", this); } else { - CompileTask::print_compilation(st, this, msg, /*short_form:*/ false); + CompileTask::print_compilation(st, this, entry_bci, msg, /*short_form:*/ false); } } } @@ -1269,7 +1269,7 @@ _entry_bci = InvalidOSREntryBci; } -void nmethod::log_state_change() const { +void nmethod::log_state_change(int entry_bci) const { if (LogCompilation) { if (xtty != NULL) { ttyLocker ttyl; // keep the following output all in one block @@ -1287,7 +1287,7 @@ } } if (PrintCompilation && _state != unloaded) { - print_on(tty, _state == zombie ? "made zombie" : "made not entrant"); + print_on(tty, _state == zombie ? "made zombie" : "made not entrant", entry_bci); } } @@ -1315,6 +1315,8 @@ // they both acquire leaf locks and we don't want a deadlock. // This logic is equivalent to the logic below for patching the // verified entry point of regular methods. + // Save entry bci for logging before invalidating the index. + int entry_bci = _entry_bci; if (is_osr_method()) { // this effectively makes the osr nmethod not entrant invalidate_osr_method(); @@ -1361,8 +1363,8 @@ // Change state _state = state; - // Log the transition once - log_state_change(); + // Log the transition once (print saved entry bci for osr nmethods) + log_state_change(entry_bci); // Remove nmethod from method. // We need to check if both the _code and _from_compiled_code_entry_point --- old/src/share/vm/code/nmethod.hpp 2014-07-01 11:37:43.263304800 +0200 +++ new/src/share/vm/code/nmethod.hpp 2014-07-01 11:37:43.155304805 +0200 @@ -659,12 +659,18 @@ // need to re-define this from CodeBlob else the overload hides it virtual void print_on(outputStream* st) const { CodeBlob::print_on(st); } - void print_on(outputStream* st, const char* msg) const; + void print_on(outputStream* st, const char* msg, int entry_bci) const; + void print_on(outputStream* st, const char* msg) const { + print_on(st, msg, _entry_bci); + } // Logging void log_identity(xmlStream* log) const; void log_new_nmethod() const; - void log_state_change() const; + void log_state_change(int entry_bci) const; + void log_state_change() const { + log_state_change(_entry_bci); + } // Prints block-level comments, including nmethod specific block labels: virtual void print_block_comment(outputStream* stream, address block_begin) const {