diff -r 92383597fa21 -r 1aa9beac610e src/hotspot/share/code/codeBlob.cpp --- a/src/hotspot/share/code/codeBlob.cpp Thu Oct 04 14:03:13 2018 +0200 +++ b/src/hotspot/share/code/codeBlob.cpp Thu Oct 04 16:39:07 2018 +0200 @@ -26,7 +26,9 @@ #include "jvm.h" #include "code/codeBlob.hpp" #include "code/codeCache.hpp" +#include "code/icBuffer.hpp" #include "code/relocInfo.hpp" +#include "code/vtableStubs.hpp" #include "compiler/disassembler.hpp" #include "interpreter/bytecode.hpp" #include "memory/allocation.inline.hpp" @@ -559,6 +561,67 @@ st->print_cr("[CodeBlob]"); } +void CodeBlob::dump_for_addr(address addr, outputStream* st, bool verbose) const { + if (is_buffer_blob()) { + // the interpreter is generated into a buffer blob + InterpreterCodelet* i = Interpreter::codelet_containing(addr); + if (i != NULL) { + st->print_cr(INTPTR_FORMAT " is at code_begin+%d in an Interpreter codelet", p2i(addr), (int)(addr - i->code_begin())); + i->print_on(st); + return; + } + if (Interpreter::contains(addr)) { + st->print_cr(INTPTR_FORMAT " is pointing into interpreter code" + " (not bytecode specific)", p2i(addr)); + return; + } + // + if (AdapterHandlerLibrary::contains(this)) { + st->print_cr(INTPTR_FORMAT " is at code_begin+%d in an AdapterHandler", p2i(addr), (int)(addr - code_begin())); + AdapterHandlerLibrary::print_handler_on(st, this); + } + // the stubroutines are generated into a buffer blob + StubCodeDesc* d = StubCodeDesc::desc_for(addr); + if (d != NULL) { + st->print_cr(INTPTR_FORMAT " is at begin+%d in a stub", p2i(addr), (int)(addr - d->begin())); + d->print_on(st); + st->cr(); + return; + } + if (StubRoutines::contains(addr)) { + st->print_cr(INTPTR_FORMAT " is pointing to an (unnamed) stub routine", p2i(addr)); + return; + } + // the InlineCacheBuffer is using stubs generated into a buffer blob + if (InlineCacheBuffer::contains(addr)) { + st->print_cr(INTPTR_FORMAT " is pointing into InlineCacheBuffer", p2i(addr)); + return; + } + VtableStub* v = VtableStubs::stub_containing(addr); + if (v != NULL) { + st->print_cr(INTPTR_FORMAT " is at entry_point+%d in a vtable stub", p2i(addr), (int)(addr - v->entry_point())); + v->print_on(st); + st->cr(); + return; + } + } + if (is_nmethod()) { + nmethod* nm = (nmethod*)this; + ResourceMark rm; + st->print(INTPTR_FORMAT " is at entry_point+%d in (nmethod*)" INTPTR_FORMAT, + p2i(addr), (int)(addr - nm->entry_point()), p2i(nm)); + if (verbose) { + st->print(" for "); + nm->method()->print_value_on(st); + } + st->cr(); + nm->print_nmethod(verbose); + return; + } + st->print_cr(INTPTR_FORMAT " is at code_begin+%d in ", p2i(addr), (int)(addr - code_begin())); + print_on(st); +} + void RuntimeBlob::verify() { ShouldNotReachHere(); }