JDK-8275584 : Incorrect stack spilling in CallArranger on MacOS/AArch64
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang.foreign
  • Affected Version: repo-panama
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • CPU: aarch64
  • Submitted: 2021-10-20
  • Updated: 2022-10-26
  • Resolved: 2022-10-26
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
repo-panamaFixed
Related Reports
Blocks :  
Relates :  
Description
Consider a C function like this:

void f(int, int, int, int, int, int, int, int, char x, short y);

In the standard AArch64 ABI x and y get spilled to the stack as eight byte quantities (as if they were assigned to a register and then spilled) but in the Mac ABI they are spilled to the stack with their original size and natural alignment. AArch64 CallArranger needs to handle this difference.
Comments
A pull request was submitted for review. URL: https://git.openjdk.org/panama-foreign/pull/746 Date: 2022-10-21 15:50:01 +0000
21-10-2022

[~ngasson] Yes please! Thanks
21-10-2022

[~jvernee] I rebased your branch and fixed up a few corner cases to do with spilling structs: https://github.com/nick-arm/panama-foreign/commit/9e9a6eba32d4f84fb All of jdk_foreign is passing now on my M1 Mac. Should I make a PR for this along with your changes?
21-10-2022

Thanks!
05-10-2022

Sure, I can take a look at it. But it might be a few weeks until I am able to.
04-10-2022

[~ngasson] Could you maybe take a look at this? I've been trying to make progress, but other things keep popping up that require my attention as well. I've made a start, if you want to use that: https://github.com/openjdk/panama-foreign/compare/foreign-memaccess+abi...JornVernee:panama-foreign:Mac_Stack There are some failing test cases in TestUpcallStack. I think the issue is the code that aligns structs in CallArranger, but not sure.
04-10-2022