[aarch64-port-dev ] RFR: fix for crash caused by earlyret of compiled method

Andrew Haley aph at redhat.com
Thu Jun 15 18:12:24 UTC 2017


Hi,

This is the patch I'd like to go with.  It allocates the correct amount of
stack space in every case, as far as I can see, and I've carefully stepped
through your failing test case.

Can you please test it in your environment?  Thanks.

diff --git a/src/cpu/aarch64/vm/abstractInterpreter_aarch64.cpp b/src/cpu/aarch64/vm/abstractInterpreter_aarch64.cpp
--- a/src/cpu/aarch64/vm/abstractInterpreter_aarch64.cpp
+++ b/src/cpu/aarch64/vm/abstractInterpreter_aarch64.cpp
@@ -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.

-- 
Andrew Haley
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671


More information about the aarch64-port-dev mailing list