mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 14:24:46 +02:00
8071374: -XX:+PrintAssembly -XX:+PrintSignatureHandlers crash fastdebug VM with assert(limit == __null || limit <= nm->code_end()) in RelocIterator::initialize
Reviewed-by: kvn, iklam, shade
This commit is contained in:
parent
f642bbcecd
commit
a82be01120
13 changed files with 33 additions and 30 deletions
|
@ -125,15 +125,15 @@ decode_instructions(void* start_pv, void* end_pv,
|
||||||
event_callback_t event_callback_arg, void* event_stream_arg,
|
event_callback_t event_callback_arg, void* event_stream_arg,
|
||||||
printf_callback_t printf_callback_arg, void* printf_stream_arg,
|
printf_callback_t printf_callback_arg, void* printf_stream_arg,
|
||||||
const char* options) {
|
const char* options) {
|
||||||
decode_instructions_virtual((uintptr_t)start_pv,
|
return decode_instructions_virtual((uintptr_t)start_pv,
|
||||||
(uintptr_t)end_pv,
|
(uintptr_t)end_pv,
|
||||||
(unsigned char*)start_pv,
|
(unsigned char*)start_pv,
|
||||||
(uintptr_t)end_pv - (uintptr_t)start_pv,
|
(uintptr_t)end_pv - (uintptr_t)start_pv,
|
||||||
event_callback_arg,
|
event_callback_arg,
|
||||||
event_stream_arg,
|
event_stream_arg,
|
||||||
printf_callback_arg,
|
printf_callback_arg,
|
||||||
printf_stream_arg,
|
printf_stream_arg,
|
||||||
options, false);
|
options, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void* decode(struct hsdis_app_data* app_data, const char* options) {
|
static void* decode(struct hsdis_app_data* app_data, const char* options) {
|
||||||
|
@ -212,6 +212,7 @@ static const char* format_insn_close(const char* close,
|
||||||
case dis_condjsr: type = "condjsr"; break;
|
case dis_condjsr: type = "condjsr"; break;
|
||||||
case dis_dref: type = "dref"; break;
|
case dis_dref: type = "dref"; break;
|
||||||
case dis_dref2: type = "dref2"; break;
|
case dis_dref2: type = "dref2"; break;
|
||||||
|
case dis_noninsn: type = "noninsn"; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(buf, close);
|
strcpy(buf, close);
|
||||||
|
|
|
@ -1030,6 +1030,7 @@ JRT_ENTRY(void, Runtime1::patch_code(JavaThread* thread, Runtime1::StubID stub_i
|
||||||
address copy_buff = stub_location - *byte_skip - *byte_count;
|
address copy_buff = stub_location - *byte_skip - *byte_count;
|
||||||
address being_initialized_entry = stub_location - *being_initialized_entry_offset;
|
address being_initialized_entry = stub_location - *being_initialized_entry_offset;
|
||||||
if (TracePatching) {
|
if (TracePatching) {
|
||||||
|
ttyLocker ttyl;
|
||||||
tty->print_cr(" Patching %s at bci %d at address " INTPTR_FORMAT " (%s)", Bytecodes::name(code), bci,
|
tty->print_cr(" Patching %s at bci %d at address " INTPTR_FORMAT " (%s)", Bytecodes::name(code), bci,
|
||||||
p2i(instr_pc), (stub_id == Runtime1::access_field_patching_id) ? "field" : "klass");
|
p2i(instr_pc), (stub_id == Runtime1::access_field_patching_id) ? "field" : "klass");
|
||||||
nmethod* caller_code = CodeCache::find_nmethod(caller_frame.pc());
|
nmethod* caller_code = CodeCache::find_nmethod(caller_frame.pc());
|
||||||
|
|
|
@ -1045,9 +1045,6 @@ void ciEnv::register_method(ciMethod* target,
|
||||||
if (printnmethods || PrintDebugInfo || PrintRelocations || PrintDependencies || PrintExceptionHandlers) {
|
if (printnmethods || PrintDebugInfo || PrintRelocations || PrintDependencies || PrintExceptionHandlers) {
|
||||||
nm->print_nmethod(printnmethods);
|
nm->print_nmethod(printnmethods);
|
||||||
}
|
}
|
||||||
if (directives->PrintAssemblyOption) {
|
|
||||||
Disassembler::decode(nm);
|
|
||||||
}
|
|
||||||
|
|
||||||
nm->set_has_unsafe_access(has_unsafe_access);
|
nm->set_has_unsafe_access(has_unsafe_access);
|
||||||
nm->set_has_wide_vectors(has_wide_vectors);
|
nm->set_has_wide_vectors(has_wide_vectors);
|
||||||
|
|
|
@ -181,6 +181,11 @@ const ImmutableOopMap* CodeBlob::oop_map_for_return_address(address return_addre
|
||||||
return oop_maps()->find_map_at_offset((intptr_t) return_address - (intptr_t) code_begin());
|
return oop_maps()->find_map_at_offset((intptr_t) return_address - (intptr_t) code_begin());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CodeBlob::print_code() {
|
||||||
|
HandleMark hm;
|
||||||
|
ResourceMark m;
|
||||||
|
Disassembler::decode(this, tty);
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
// Implementation of BufferBlob
|
// Implementation of BufferBlob
|
||||||
|
|
|
@ -196,6 +196,7 @@ class CodeBlob VALUE_OBJ_CLASS_SPEC {
|
||||||
void print() const { print_on(tty); }
|
void print() const { print_on(tty); }
|
||||||
virtual void print_on(outputStream* st) const;
|
virtual void print_on(outputStream* st) const;
|
||||||
virtual void print_value_on(outputStream* st) const;
|
virtual void print_value_on(outputStream* st) const;
|
||||||
|
void print_code();
|
||||||
|
|
||||||
// Deal with Disassembler, VTune, Forte, JvmtiExport, MemoryService.
|
// Deal with Disassembler, VTune, Forte, JvmtiExport, MemoryService.
|
||||||
static void trace_new_stub(CodeBlob* blob, const char* name1, const char* name2 = "");
|
static void trace_new_stub(CodeBlob* blob, const char* name1, const char* name2 = "");
|
||||||
|
|
|
@ -2639,6 +2639,7 @@ address nmethod::continuation_for_implicit_exception(address pc) {
|
||||||
ResourceMark rm(thread);
|
ResourceMark rm(thread);
|
||||||
CodeBlob* cb = CodeCache::find_blob(pc);
|
CodeBlob* cb = CodeCache::find_blob(pc);
|
||||||
assert(cb != NULL && cb == this, "");
|
assert(cb != NULL && cb == this, "");
|
||||||
|
ttyLocker ttyl;
|
||||||
tty->print_cr("implicit exception happened at " INTPTR_FORMAT, p2i(pc));
|
tty->print_cr("implicit exception happened at " INTPTR_FORMAT, p2i(pc));
|
||||||
print();
|
print();
|
||||||
method()->print_codes();
|
method()->print_codes();
|
||||||
|
@ -2960,13 +2961,6 @@ void nmethod::print() const {
|
||||||
nul_chk_table_size());
|
nul_chk_table_size());
|
||||||
}
|
}
|
||||||
|
|
||||||
void nmethod::print_code() {
|
|
||||||
HandleMark hm;
|
|
||||||
ResourceMark m;
|
|
||||||
Disassembler::decode(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
|
|
||||||
void nmethod::print_scopes() {
|
void nmethod::print_scopes() {
|
||||||
|
|
|
@ -704,7 +704,6 @@ public:
|
||||||
|
|
||||||
// printing support
|
// printing support
|
||||||
void print() const;
|
void print() const;
|
||||||
void print_code();
|
|
||||||
void print_relocations() PRODUCT_RETURN;
|
void print_relocations() PRODUCT_RETURN;
|
||||||
void print_pcs() PRODUCT_RETURN;
|
void print_pcs() PRODUCT_RETURN;
|
||||||
void print_scopes() PRODUCT_RETURN;
|
void print_scopes() PRODUCT_RETURN;
|
||||||
|
|
|
@ -497,6 +497,7 @@ address decode_env::decode_instructions(address start, address end) {
|
||||||
|
|
||||||
|
|
||||||
void Disassembler::decode(CodeBlob* cb, outputStream* st) {
|
void Disassembler::decode(CodeBlob* cb, outputStream* st) {
|
||||||
|
ttyLocker ttyl;
|
||||||
if (!load_library()) return;
|
if (!load_library()) return;
|
||||||
if (cb->is_nmethod()) {
|
if (cb->is_nmethod()) {
|
||||||
decode((nmethod*)cb, st);
|
decode((nmethod*)cb, st);
|
||||||
|
@ -510,12 +511,14 @@ void Disassembler::decode(CodeBlob* cb, outputStream* st) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Disassembler::decode(address start, address end, outputStream* st, CodeStrings c) {
|
void Disassembler::decode(address start, address end, outputStream* st, CodeStrings c) {
|
||||||
|
ttyLocker ttyl;
|
||||||
if (!load_library()) return;
|
if (!load_library()) return;
|
||||||
decode_env env(CodeCache::find_blob_unsafe(start), st, c);
|
decode_env env(CodeCache::find_blob_unsafe(start), st, c);
|
||||||
env.decode_instructions(start, end);
|
env.decode_instructions(start, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Disassembler::decode(nmethod* nm, outputStream* st) {
|
void Disassembler::decode(nmethod* nm, outputStream* st) {
|
||||||
|
ttyLocker ttyl;
|
||||||
if (!load_library()) return;
|
if (!load_library()) return;
|
||||||
decode_env env(nm, st);
|
decode_env env(nm, st);
|
||||||
env.output()->print_cr("----------------------------------------------------------------------");
|
env.output()->print_cr("----------------------------------------------------------------------");
|
||||||
|
|
|
@ -1252,6 +1252,7 @@ void SignatureHandlerLibrary::add(const methodHandle& method) {
|
||||||
} else {
|
} else {
|
||||||
// debugging suppport
|
// debugging suppport
|
||||||
if (PrintSignatureHandlers && (handler != Interpreter::slow_signature_handler())) {
|
if (PrintSignatureHandlers && (handler != Interpreter::slow_signature_handler())) {
|
||||||
|
ttyLocker ttyl;
|
||||||
tty->cr();
|
tty->cr();
|
||||||
tty->print_cr("argument handler #%d for: %s %s (fingerprint = " UINT64_FORMAT ", %d bytes generated)",
|
tty->print_cr("argument handler #%d for: %s %s (fingerprint = " UINT64_FORMAT ", %d bytes generated)",
|
||||||
_handlers->length(),
|
_handlers->length(),
|
||||||
|
|
|
@ -897,10 +897,8 @@ C2V_VMENTRY(jobject, disassembleCodeBlob, (JNIEnv *jniEnv, jobject, jobject inst
|
||||||
if (!nm->is_alive()) {
|
if (!nm->is_alive()) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
Disassembler::decode(nm, &st);
|
|
||||||
} else {
|
|
||||||
Disassembler::decode(cb, &st);
|
|
||||||
}
|
}
|
||||||
|
Disassembler::decode(cb, &st);
|
||||||
if (st.size() <= 0) {
|
if (st.size() <= 0) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -726,6 +726,7 @@ address SharedRuntime::compute_compiled_exc_handler(nmethod* nm, address ret_pc,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (t == NULL) {
|
if (t == NULL) {
|
||||||
|
ttyLocker ttyl;
|
||||||
tty->print_cr("MISSING EXCEPTION HANDLER for pc " INTPTR_FORMAT " and handler bci %d", p2i(ret_pc), handler_bci);
|
tty->print_cr("MISSING EXCEPTION HANDLER for pc " INTPTR_FORMAT " and handler bci %d", p2i(ret_pc), handler_bci);
|
||||||
tty->print_cr(" Exception:");
|
tty->print_cr(" Exception:");
|
||||||
exception->print();
|
exception->print();
|
||||||
|
@ -2759,7 +2760,7 @@ void AdapterHandlerLibrary::create_native_wrapper(const methodHandle& method) {
|
||||||
|
|
||||||
DirectiveSet* directive = DirectivesStack::getDefaultDirective(CompileBroker::compiler(CompLevel_simple));
|
DirectiveSet* directive = DirectivesStack::getDefaultDirective(CompileBroker::compiler(CompLevel_simple));
|
||||||
if (directive->PrintAssemblyOption) {
|
if (directive->PrintAssemblyOption) {
|
||||||
Disassembler::decode(nm, tty);
|
nm->print_code();
|
||||||
}
|
}
|
||||||
DirectivesStack::release(directive);
|
DirectivesStack::release(directive);
|
||||||
}
|
}
|
||||||
|
|
|
@ -406,6 +406,7 @@ inline void vframeStreamCommon::fill_from_compiled_frame(int decode_offset) {
|
||||||
// as it were a native compiled frame (no Java-level assumptions).
|
// as it were a native compiled frame (no Java-level assumptions).
|
||||||
#ifdef ASSERT
|
#ifdef ASSERT
|
||||||
if (WizardMode) {
|
if (WizardMode) {
|
||||||
|
ttyLocker ttyl;
|
||||||
tty->print_cr("Error in fill_from_frame: pc_desc for "
|
tty->print_cr("Error in fill_from_frame: pc_desc for "
|
||||||
INTPTR_FORMAT " not found or invalid at %d",
|
INTPTR_FORMAT " not found or invalid at %d",
|
||||||
p2i(_frame.pc()), decode_offset);
|
p2i(_frame.pc()), decode_offset);
|
||||||
|
|
|
@ -480,12 +480,13 @@ extern "C" void nm(intptr_t p) {
|
||||||
extern "C" void disnm(intptr_t p) {
|
extern "C" void disnm(intptr_t p) {
|
||||||
Command c("disnm");
|
Command c("disnm");
|
||||||
CodeBlob* cb = CodeCache::find_blob((address) p);
|
CodeBlob* cb = CodeCache::find_blob((address) p);
|
||||||
nmethod* nm = cb->as_nmethod_or_null();
|
if (cb != NULL) {
|
||||||
if (nm) {
|
nmethod* nm = cb->as_nmethod_or_null();
|
||||||
nm->print();
|
if (nm != NULL) {
|
||||||
Disassembler::decode(nm);
|
nm->print();
|
||||||
} else {
|
} else {
|
||||||
cb->print();
|
cb->print();
|
||||||
|
}
|
||||||
Disassembler::decode(cb);
|
Disassembler::decode(cb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue