Mercurial > hg > truffle
diff src/share/vm/runtime/sharedRuntime.cpp @ 2321:1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
Reviewed-by: never, bdelsart
author | twisti |
---|---|
date | Mon, 28 Feb 2011 06:07:12 -0800 |
parents | b92c45f2bc75 |
children | 3d58a4983660 |
line wrap: on
line diff
--- a/src/share/vm/runtime/sharedRuntime.cpp Sat Feb 26 12:10:54 2011 -0800 +++ b/src/share/vm/runtime/sharedRuntime.cpp Mon Feb 28 06:07:12 2011 -0800 @@ -431,25 +431,24 @@ // previous frame depending on the return address. address SharedRuntime::raw_exception_handler_for_return_address(JavaThread* thread, address return_address) { - assert(frame::verify_return_pc(return_address), "must be a return pc"); - - // Reset MethodHandle flag. + assert(frame::verify_return_pc(return_address), err_msg("must be a return address: " INTPTR_FORMAT, return_address)); + + // Reset method handle flag. thread->set_is_method_handle_return(false); - // the fastest case first + // The fastest case first CodeBlob* blob = CodeCache::find_blob(return_address); - if (blob != NULL && blob->is_nmethod()) { - nmethod* code = (nmethod*)blob; - assert(code != NULL, "nmethod must be present"); - // Check if the return address is a MethodHandle call site. - thread->set_is_method_handle_return(code->is_method_handle_return(return_address)); + nmethod* nm = (blob != NULL) ? blob->as_nmethod_or_null() : NULL; + if (nm != NULL) { + // Set flag if return address is a method handle call site. + thread->set_is_method_handle_return(nm->is_method_handle_return(return_address)); // native nmethods don't have exception handlers - assert(!code->is_native_method(), "no exception handler"); - assert(code->header_begin() != code->exception_begin(), "no exception handler"); - if (code->is_deopt_pc(return_address)) { + assert(!nm->is_native_method(), "no exception handler"); + assert(nm->header_begin() != nm->exception_begin(), "no exception handler"); + if (nm->is_deopt_pc(return_address)) { return SharedRuntime::deopt_blob()->unpack_with_exception(); } else { - return code->exception_begin(); + return nm->exception_begin(); } } @@ -462,22 +461,9 @@ return Interpreter::rethrow_exception_entry(); } - // Compiled code - if (CodeCache::contains(return_address)) { - CodeBlob* blob = CodeCache::find_blob(return_address); - if (blob->is_nmethod()) { - nmethod* code = (nmethod*)blob; - assert(code != NULL, "nmethod must be present"); - // Check if the return address is a MethodHandle call site. - thread->set_is_method_handle_return(code->is_method_handle_return(return_address)); - assert(code->header_begin() != code->exception_begin(), "no exception handler"); - return code->exception_begin(); - } - if (blob->is_runtime_stub()) { - ShouldNotReachHere(); // callers are responsible for skipping runtime stub frames - } - } + guarantee(blob == NULL || !blob->is_runtime_stub(), "caller should have skipped stub"); guarantee(!VtableStubs::contains(return_address), "NULL exceptions in vtables should have been handled already!"); + #ifndef PRODUCT { ResourceMark rm; tty->print_cr("No exception handler found for exception at " INTPTR_FORMAT " - potential problems:", return_address); @@ -485,6 +471,7 @@ tty->print_cr("b) other problem"); } #endif // PRODUCT + ShouldNotReachHere(); return NULL; }