# HG changeset patch # User Christian Haeubl # Date 1329958403 28800 # Node ID 8021e46f4a99ecc251e89298e8eee3346dd048ff # Parent 7167f487cc3146968acb629eeac12d777e5687da another fix for resolving the issue with biased monitor and deoptimization diff -r 7167f487cc31 -r 8021e46f4a99 src/cpu/x86/vm/sharedRuntime_x86_64.cpp --- a/src/cpu/x86/vm/sharedRuntime_x86_64.cpp Wed Feb 22 17:27:11 2012 +0100 +++ b/src/cpu/x86/vm/sharedRuntime_x86_64.cpp Wed Feb 22 16:53:23 2012 -0800 @@ -2703,17 +2703,12 @@ } #endif // ASSERT - __ movl(c_rarg1, (int32_t)(Deoptimization::make_trap_request(Deoptimization::Reason_unreached, Deoptimization::Action_none))); __ mov(c_rarg0, r15_thread); - __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::uncommon_trap))); - oop_maps->add_gc_map( __ pc()-start, map->deep_copy()); - - //__ reset_last_Java_frame(false, false); - //__ call(RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::fetch_unroll_info))); + __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::fetch_unroll_info))); // Need to have an oopmap that tells fetch_unroll_info where to // find any register it might need. -// oop_maps->add_gc_map(__ pc() - start, map); + oop_maps->add_gc_map(__ pc() - start, map); __ reset_last_Java_frame(false, false); diff -r 7167f487cc31 -r 8021e46f4a99 src/share/vm/c1/c1_Runtime1.cpp --- a/src/share/vm/c1/c1_Runtime1.cpp Wed Feb 22 17:27:11 2012 +0100 +++ b/src/share/vm/c1/c1_Runtime1.cpp Wed Feb 22 16:53:23 2012 -0800 @@ -558,7 +558,7 @@ thread->set_exception_pc(pc); // the exception cache is used only by non-implicit exceptions - if (continuation != NULL) { + if (continuation != NULL && !SharedRuntime::deopt_blob()->contains(continuation)) { nm->add_handler_for_exception_and_pc(exception, pc, continuation); } } @@ -595,7 +595,6 @@ continuation = exception_handler_for_pc_helper(thread, exception, pc, nm); } // Back in JAVA, use no oops DON'T safepoint - // Now check to see if the nmethod we were called from is now deoptimized. // If so we must return to the deopt blob and deoptimize the nmethod if (nm != NULL && caller_is_deopted()) { diff -r 7167f487cc31 -r 8021e46f4a99 src/share/vm/runtime/sharedRuntime.cpp --- a/src/share/vm/runtime/sharedRuntime.cpp Wed Feb 22 17:27:11 2012 +0100 +++ b/src/share/vm/runtime/sharedRuntime.cpp Wed Feb 22 16:53:23 2012 -0800 @@ -716,9 +716,16 @@ if (t == NULL && nm->is_compiled_by_c1()) { #ifdef GRAAL nm->make_not_entrant(); - JavaThread::current()->set_exception_pc(ret_pc); - JavaThread::current()->set_exception_oop(exception()); - JavaThread::current()->clear_pending_exception(); + JavaThread* thread = JavaThread::current(); + // save the exception for deoptimization + thread->set_exception_pc(ret_pc); + thread->set_exception_oop(exception()); + // clear the pending exception and deoptimize the frame + thread->clear_pending_exception(); + RegisterMap reg_map(thread, false); + frame runtime_frame = thread->last_frame(); + frame caller_frame = runtime_frame.sender(®_map); + Deoptimization::deoptimize_frame(thread, caller_frame.id()); return SharedRuntime::deopt_blob()->unpack_with_exception_in_tls(); #else assert(nm->unwind_handler_begin() != NULL, "");