src/hotspot/cpu/aarch64/frame_aarch64.cpp
changeset 50743 e7519209f7ff
parent 47799 1772ebf07d1f
child 51263 b5aac518b097
--- a/src/hotspot/cpu/aarch64/frame_aarch64.cpp	Sun Jun 24 10:41:51 2018 +0200
+++ b/src/hotspot/cpu/aarch64/frame_aarch64.cpp	Sun Jun 24 15:02:08 2018 +0300
@@ -71,9 +71,20 @@
     return false;
   }
 
-  // unextended sp must be within the stack and above or equal sp
-  bool unextended_sp_safe = (unextended_sp < thread->stack_base()) &&
-                            (unextended_sp >= sp);
+  // When we are running interpreted code the machine stack pointer, SP, is
+  // set low enough so that the Java expression stack can grow and shrink
+  // without ever exceeding the machine stack bounds.  So, ESP >= SP.
+
+  // When we call out of an interpreted method, SP is incremented so that
+  // the space between SP and ESP is removed.  The SP saved in the callee's
+  // frame is the SP *before* this increment.  So, when we walk a stack of
+  // interpreter frames the sender's SP saved in a frame might be less than
+  // the SP at the point of call.
+
+  // So unextended sp must be within the stack but we need not to check
+  // that unextended sp >= sp
+
+  bool unextended_sp_safe = (unextended_sp < thread->stack_base());
 
   if (!unextended_sp_safe) {
     return false;