diff src/share/vm/runtime/sharedRuntime.cpp @ 4673:8021e46f4a99

another fix for resolving the issue with biased monitor and deoptimization
author Christian Haeubl <christian.haeubl@oracle.com>
date Wed, 22 Feb 2012 16:53:23 -0800
parents f9811bcf3402
children 6336b144e391
line wrap: on
line diff
--- 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(&reg_map);
+    Deoptimization::deoptimize_frame(thread, caller_frame.id());
     return SharedRuntime::deopt_blob()->unpack_with_exception_in_tls();
 #else
     assert(nm->unwind_handler_begin() != NULL, "");