RFR: 8263512: [macos_aarch64] issues with calling va_args functions from invoke_native

Nick Gasson ngasson at openjdk.java.net
Thu May 6 08:25:52 UTC 2021


On Mon, 3 May 2021 15:37:44 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

>> src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/abi/aarch64/macos/StackVaList.java line 131:
>> 
>>> 129:                     MemorySegment struct = allocator.allocate(layout);
>>> 130:                     struct.copyFrom(segment.asSlice(0L, layout.byteSize()));
>>> 131:                     segment = segment.asSlice(VA_SLOT_SIZE_BYTES);
>> 
>> Since arguments are packed according to alignment, I guess the offset could be larger or smaller than 8 bytes as well?
>
> This is using `alignUp(arg.layout.byteSize(), VA_SLOT_SIZE_BYTES)` in the writing code, so I think it should be the same here?

Yes this is a mistake (`skip()` has the same problem). I'll add an extra case to VaListTest to catch it.

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

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


More information about the core-libs-dev mailing list