changeset 10806:7cd0ae703ffd

8203481, PR3797: Incorrect constraint for unextended_sp in frame:safe_for_sender Summary: Relaxed assert inside safe_for_sender Reviewed-by: aph, dpochepk
author dsamersoff
date Sun, 24 Jun 2018 15:02:08 +0300
parents e1f00b506d78
children 8c532622ac0b
files src/cpu/aarch64/vm/frame_aarch64.cpp
diffstat 1 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/cpu/aarch64/vm/frame_aarch64.cpp	Tue Dec 20 15:49:30 2016 -0500
+++ b/src/cpu/aarch64/vm/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;