hotspot/src/share/vm/runtime/deoptimization.cpp
changeset 7106 867c9d296c6b
parent 6740 2bc601284215
child 7397 5b173b4ca846
--- a/hotspot/src/share/vm/runtime/deoptimization.cpp	Mon Oct 18 15:43:29 2010 -0700
+++ b/hotspot/src/share/vm/runtime/deoptimization.cpp	Tue Oct 19 16:14:34 2010 -0700
@@ -1065,7 +1065,9 @@
 }
 
 
-void Deoptimization::deoptimize_frame(JavaThread* thread, intptr_t* id) {
+void Deoptimization::deoptimize_frame_internal(JavaThread* thread, intptr_t* id) {
+  assert(thread == Thread::current() || SafepointSynchronize::is_at_safepoint(),
+         "can only deoptimize other thread at a safepoint");
   // Compute frame and register map based on thread and sp.
   RegisterMap reg_map(thread, UseBiasedLocking);
   frame fr = thread->last_frame();
@@ -1076,6 +1078,16 @@
 }
 
 
+void Deoptimization::deoptimize_frame(JavaThread* thread, intptr_t* id) {
+  if (thread == Thread::current()) {
+    Deoptimization::deoptimize_frame_internal(thread, id);
+  } else {
+    VM_DeoptimizeFrame deopt(thread, id);
+    VMThread::execute(&deopt);
+  }
+}
+
+
 // JVMTI PopFrame support
 JRT_LEAF(void, Deoptimization::popframe_preserve_args(JavaThread* thread, int bytes_to_save, void* start_address))
 {