提交 fc5cd0fa 编写于 作者: T twisti

8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty...

8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
Reviewed-by: kvn, iveresov
上级 35b9267b
...@@ -1067,6 +1067,25 @@ OopMapSet* Runtime1::generate_handle_exception(StubID id, StubAssembler* sasm) { ...@@ -1067,6 +1067,25 @@ OopMapSet* Runtime1::generate_handle_exception(StubID id, StubAssembler* sasm) {
__ verify_not_null_oop(Oexception); __ verify_not_null_oop(Oexception);
#ifdef ASSERT
// check that fields in JavaThread for exception oop and issuing pc are
// empty before writing to them
Label oop_empty;
Register scratch = I7; // We can use I7 here because it's overwritten later anyway.
__ ld_ptr(Address(G2_thread, JavaThread::exception_oop_offset()), scratch);
__ br_null(scratch, false, Assembler::pt, oop_empty);
__ delayed()->nop();
__ stop("exception oop already set");
__ bind(oop_empty);
Label pc_empty;
__ ld_ptr(Address(G2_thread, JavaThread::exception_pc_offset()), scratch);
__ br_null(scratch, false, Assembler::pt, pc_empty);
__ delayed()->nop();
__ stop("exception pc already set");
__ bind(pc_empty);
#endif
// save the exception and issuing pc in the thread // save the exception and issuing pc in the thread
__ st_ptr(Oexception, G2_thread, in_bytes(JavaThread::exception_oop_offset())); __ st_ptr(Oexception, G2_thread, in_bytes(JavaThread::exception_oop_offset()));
__ st_ptr(Oissuing_pc, G2_thread, in_bytes(JavaThread::exception_pc_offset())); __ st_ptr(Oissuing_pc, G2_thread, in_bytes(JavaThread::exception_pc_offset()));
......
...@@ -542,8 +542,7 @@ JRT_ENTRY_NO_ASYNC(static address, exception_handler_for_pc_helper(JavaThread* t ...@@ -542,8 +542,7 @@ JRT_ENTRY_NO_ASYNC(static address, exception_handler_for_pc_helper(JavaThread* t
// exception handler can cause class loading, which might throw an // exception handler can cause class loading, which might throw an
// exception and those fields are expected to be clear during // exception and those fields are expected to be clear during
// normal bytecode execution. // normal bytecode execution.
thread->set_exception_oop(NULL); thread->clear_exception_oop_and_pc();
thread->set_exception_pc(NULL);
continuation = SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, false, false); continuation = SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, false, false);
// If an exception was thrown during exception dispatch, the exception oop may have changed // If an exception was thrown during exception dispatch, the exception oop may have changed
......
...@@ -976,30 +976,36 @@ JRT_ENTRY_NO_ASYNC(address, OptoRuntime::handle_exception_C_helper(JavaThread* t ...@@ -976,30 +976,36 @@ JRT_ENTRY_NO_ASYNC(address, OptoRuntime::handle_exception_C_helper(JavaThread* t
address handler_address = NULL; address handler_address = NULL;
Handle exception(thread, thread->exception_oop()); Handle exception(thread, thread->exception_oop());
address pc = thread->exception_pc();
// Clear out the exception oop and pc since looking up an
// exception handler can cause class loading, which might throw an
// exception and those fields are expected to be clear during
// normal bytecode execution.
thread->clear_exception_oop_and_pc();
if (TraceExceptions) { if (TraceExceptions) {
trace_exception(exception(), thread->exception_pc(), ""); trace_exception(exception(), pc, "");
} }
// for AbortVMOnException flag // for AbortVMOnException flag
NOT_PRODUCT(Exceptions::debug_check_abort(exception)); NOT_PRODUCT(Exceptions::debug_check_abort(exception));
#ifdef ASSERT #ifdef ASSERT
if (!(exception->is_a(SystemDictionary::Throwable_klass()))) { if (!(exception->is_a(SystemDictionary::Throwable_klass()))) {
// should throw an exception here // should throw an exception here
ShouldNotReachHere(); ShouldNotReachHere();
} }
#endif #endif
// new exception handling: this method is entered only from adapters // new exception handling: this method is entered only from adapters
// exceptions from compiled java methods are handled in compiled code // exceptions from compiled java methods are handled in compiled code
// using rethrow node // using rethrow node
address pc = thread->exception_pc();
nm = CodeCache::find_nmethod(pc); nm = CodeCache::find_nmethod(pc);
assert(nm != NULL, "No NMethod found"); assert(nm != NULL, "No NMethod found");
if (nm->is_native_method()) { if (nm->is_native_method()) {
fatal("Native mathod should not have path to exception handling"); fatal("Native method should not have path to exception handling");
} else { } else {
// we are switching to old paradigm: search for exception handler in caller_frame // we are switching to old paradigm: search for exception handler in caller_frame
// instead in exception handler of caller_frame.sender() // instead in exception handler of caller_frame.sender()
...@@ -1346,7 +1352,8 @@ static void trace_exception(oop exception_oop, address exception_pc, const char* ...@@ -1346,7 +1352,8 @@ static void trace_exception(oop exception_oop, address exception_pc, const char*
tty->print(" in "); tty->print(" in ");
CodeBlob* blob = CodeCache::find_blob(exception_pc); CodeBlob* blob = CodeCache::find_blob(exception_pc);
if (blob->is_nmethod()) { if (blob->is_nmethod()) {
((nmethod*)blob)->method()->print_value(); nmethod* nm = blob->as_nmethod_or_null();
nm->method()->print_value();
} else if (blob->is_runtime_stub()) { } else if (blob->is_runtime_stub()) {
tty->print("<runtime-stub>"); tty->print("<runtime-stub>");
} else { } else {
......
...@@ -1283,6 +1283,11 @@ class JavaThread: public Thread { ...@@ -1283,6 +1283,11 @@ class JavaThread: public Thread {
void set_exception_handler_pc(address a) { _exception_handler_pc = a; } void set_exception_handler_pc(address a) { _exception_handler_pc = a; }
void set_is_method_handle_return(bool value) { _is_method_handle_return = value ? 1 : 0; } void set_is_method_handle_return(bool value) { _is_method_handle_return = value ? 1 : 0; }
void clear_exception_oop_and_pc() {
set_exception_oop(NULL);
set_exception_pc(NULL);
}
// Stack overflow support // Stack overflow support
inline size_t stack_available(address cur_sp); inline size_t stack_available(address cur_sp);
address stack_yellow_zone_base() address stack_yellow_zone_base()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册