8182581: aarch64: fix for crash caused by earlyret of compiled method
authorfyang
Tue, 20 Jun 2017 17:00:07 +0800
changeset 45631 db8ea3a102f2
parent 45630 0aa7752bc392
child 45633 459f03270e86
8182581: aarch64: fix for crash caused by earlyret of compiled method Summary: fix jvm crash caused by earlyret of compiled method for aarch64 port Reviewed-by: aph Contributed-by: snazarkin@azul.com
hotspot/src/cpu/aarch64/vm/abstractInterpreter_aarch64.cpp
--- a/hotspot/src/cpu/aarch64/vm/abstractInterpreter_aarch64.cpp	Sat Jun 17 11:50:50 2017 -0700
+++ b/hotspot/src/cpu/aarch64/vm/abstractInterpreter_aarch64.cpp	Tue Jun 20 17:00:07 2017 +0800
@@ -109,9 +109,15 @@
   // for the callee's params we only need to account for the extra
   // locals.
   int size = overhead +
-         (callee_locals - callee_params)*Interpreter::stackElementWords +
+         (callee_locals - callee_params) +
          monitors * frame::interpreter_frame_monitor_size() +
-         temps* Interpreter::stackElementWords + extra_args;
+         // On the top frame, at all times SP <= ESP, and SP is
+         // 16-aligned.  We ensure this by adjusting SP on method
+         // entry and re-entry to allow room for the maximum size of
+         // the expression stack.  When we call another method we bump
+         // SP so that no stack space is wasted.  So, only on the top
+         // frame do we need to allow max_stack words.
+         (is_top_frame ? max_stack : temps + extra_args);
 
   // On AArch64 we always keep the stack pointer 16-aligned, so we
   // must round up here.