[lworld] RFR: 8241764: [lworld] TestC2CCalls fails with SIGSEGV in frame::sender_for_compiled_frame

Tobias Hartmann thartmann at openjdk.java.net
Thu Apr 2 14:38:05 UTC 2020

We crash during frame walking because the return address on the stack is incorrect. The stack slot containing the
return address was accidentally overwritten when packing value type arguments in the scalarized entry of C1 compiled
code. The problem is that even after extending the stack, the same slot that contains the return address might be used
for an argument and is therefore overwritten. C2 has "reserved entries" to account for that.

C1 does not have a reserved stack slot for the return address and we therefore shouldn't reuse the callers frame when
packing. Always extend the stack enough for packing to have its "own" stack space to lay out arguments. This wastes
some stack space but is much simpler than the "reserved entries" solution applied by C2.

I've modified the C2CCalls test to reliable reproduce this issue by sometimes only compiling some methods with C1. Also
did lots of refactoring in preparation of "Calling Convention 2.0". One goal is to get rid of "reserved entries" in C2
as well.


Commit messages:
 - 8241764: [lworld] TestC2CCalls fails with SIGSEGV in frame::sender_for_compiled_frame

Changes: https://git.openjdk.java.net/valhalla/pull/12/files
 Webrev: https://webrevs.openjdk.java.net/valhalla/12/webrev.00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8241764
  Stats: 156 lines in 11 files changed: 45 ins; 41 del; 70 mod
  Patch: https://git.openjdk.java.net/valhalla/pull/12.diff
  Fetch: git fetch https://git.openjdk.java.net/valhalla pull/12/head:pull/12

PR: https://git.openjdk.java.net/valhalla/pull/12

More information about the valhalla-dev mailing list