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

Andrew Haley aph at redhat.com
Wed Jun 14 15:58:03 UTC 2017


On 14/06/17 14:33, Sergey Nazarkin wrote:
> Hi Andrew,
> 
> we are at top frame, but temps and extra_args are 0
> 
> #0  AbstractInterpreter::size_activation (max_stack=3, temps=0, extra_args=0, monitors=1, callee_params=0, callee_locals=0,
>     is_top_frame=true) at /media/psf/Home/projects/zulu8-arm64-dev/hotspot/src/cpu/aarch64/vm/templateInterpreter_aarch64.cpp:1635
> #1  0x0000007fb78c6b10 in vframeArrayElement::on_stack_size (this=0x7f840014b8, callee_parameters=0, callee_locals=0,
>     is_top_frame=true, popframe_extra_stack_expression_els=0)
>     at /media/psf/Home/projects/zulu8-arm64-dev/hotspot/src/share/vm/runtime/vframeArray.cpp:442

In the method above,CodeEmitInfo::interpreter_frame_size(),

  int extra_args = state->scope()->method()->max_stack() - state->stack_size();

and

  int temps = state->stack_size();

    int frame_size = BytesPerWord * Interpreter::size_activation(method->max_stack(),
               temps + callee_parameters,
               extra_args,
               locks,
               callee_parameters,
               callee_locals,
               is_top_frame);

so,

   extra_args == max_stack - temps

So, it looks right in that case, and it doesn't make sense to add in
extra_args twice.  In the case of vframeArrayElement::on_stack_size,
we need to know whether we are the top frame or not in order to
determine the amount of stack we need because we don't allocate
max_stack at call sites, only the stack we need.  We are passed the
information about whether we're a top frame or not.

PPC uses

  const int max_alignment_space = StackAlignmentInBytes / Interpreter::stackElementSize;
  const int abi_scratch = is_top_frame ? (frame::abi_reg_args_size / Interpreter::stackElementSize) :
                                         (frame::abi_minframe_size / Interpreter::stackElementSize);
  const int size =
    max_stack                                                +
    (callee_locals - callee_params)                          +
    monitors * frame::interpreter_frame_monitor_size()       +
    max_alignment_space                                      +
    abi_scratch                                              +
    frame::ijava_state_size / Interpreter::stackElementSize;

  // Fixed size of an interpreter frame, align to 16-byte.
  return (size & -2);

which looks reasonable: it must allocate max_stack at every call, but
we don't do that on AArch64.

I think this might be correct for us:

  int size = overhead +
             (callee_locals - callee_params) +
             monitors * frame::interpreter_frame_monitor_size() +
             is_top_frame ? max_stack : temps + extra_args;

I'm going to try to run the test to see for myself.

-- 
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