[foreign-memaccess+abi] RFR: 8275332: Variadic functions don't work on Linux/AArch64

Maurizio Cimadamore mcimadamore at openjdk.java.net
Tue Oct 19 11:08:57 UTC 2021


On Tue, 19 Oct 2021 08:54:24 GMT, Nick Gasson <ngasson at openjdk.org> wrote:

> Variable length argument lists are handled differently in the
> Mac/Windows and Linux ABIs on AArch64.  Following the recent API refresh
> on the foreign-memaccess+abi branch the Mac behaviour was inadvertently
> applied on Linux too.  This patch restores the correct behaviour on
> Linux and adds a CallArranger unit test so regressions can be more
> easily caught.
> 
> I just added an extra varArgsOnStack argument to
> CallArranger.getBindings() as that seemed the simplest fix, although it
> could get unwieldy if there were too many configurable options.

Looks good - thanks for adding the tests!

src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/abi/aarch64/CallArranger.java line 213:

> 211:         }
> 212: 
> 213:         void adjustForVarArgs(boolean varArgsOnStack) {

If I'm right this is the only place where something different needs to happen for the two ABIs? If so - perhaps we could consider a different restacking where we use inheritance from a common abstract class - but that would change the shape of the code a bit.

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

Marked as reviewed by mcimadamore (Committer).

PR: https://git.openjdk.java.net/panama-foreign/pull/601


More information about the panama-dev mailing list