< prev index next >

src/share/vm/runtime/frame.cpp

Print this page

        

@@ -223,10 +223,23 @@
   }
 
   return NULL;
 }
 
+bool frame::entry_frame_is_safe(JavaThread* thread) const {
+  // Validate the JavaCallWrapper an entry frame must have
+  address jcw = (address)entry_frame_call_wrapper();
+  bool jcw_safe = (jcw <= thread->stack_base()) && (jcw > (address)fp());
+  if (!jcw_safe) {
+    return false;
+  }
+
+  // Validate sp saved in the java frame anchor
+  JavaFrameAnchor* jfa = entry_frame_call_wrapper()->anchor();
+  return (jfa->last_Java_sp() > sp());
+}
+
 bool frame::should_be_deoptimized() const {
   if (_deopt_state == is_deoptimized ||
       !is_compiled_frame() ) return false;
   assert(_cb != NULL && _cb->is_compiled(), "must be an nmethod");
   CompiledMethod* nm = (CompiledMethod *)_cb;
< prev index next >