RFR: 8277948: AArch64: Print the correct native stack if -XX:+PreserveFramePointer when crash

Denghui Dong ddong at openjdk.java.net
Mon Dec 6 12:15:15 UTC 2021


On Tue, 30 Nov 2021 10:21:05 GMT, Andrew Haley <aph at openjdk.org> wrote:

> Thank you for this. I'll have a look.
> 
> Stack unwinding on AArch64 C/C++ uses call frame information, which is in a separate section in the binary file. This allows the stack to be fully traced, even if there is no frame pointer. There is a library, libunwind, which does this. But that won't work with Java, which has its own way to do it
> 
> It would be nice to get -XX:+PreserveFramePointer working correctly.

Thanks for the response.

I also noticed that a java method will reserve 2 words when this method makes a vm leaf call:


aarch64.ad

aarch64_enc_java_to_runtime

      Label retaddr;
      __ adr(rscratch2, retaddr);
      __ lea(rscratch1, RuntimeAddress(entry));
      // Leave a breadcrumb for JavaFrameAnchor::capture_last_Java_pc()
      __ stp(zr, rscratch2, Address(__ pre(sp, -2 * wordSize)));
      __ blr(rscratch1);
      __ bind(retaddr);
      __ add(sp, sp, 2 * wordSize);




MacroAssembler::call_VM_leaf_base


  stp(rscratch1, rmethod, Address(pre(sp, -2 * wordSize)));

  mov(rscratch1, entry_point);
  blr(rscratch1);
  if (retaddr)
    bind(*retaddr);

  ldp(rscratch1, rmethod, Address(post(sp, 2 * wordSize)));



I haven't figured out the specific purpose of this operation, but I think it will make the logic of stack walking more complicated.

-------------

PR: https://git.openjdk.java.net/jdk/pull/6597


More information about the hotspot-dev mailing list