[foreign-memaccess+abi] RFR: 8262118: Specialize upcalls [v2]

Jorn Vernee jvernee at openjdk.java.net
Tue Feb 23 14:23:55 UTC 2021

On Tue, 23 Feb 2021 14:13:19 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

>> src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/abi/aarch64/CallArranger.java line 325:
>>> 323:                             VMStorage storage = regs[i];
>>> 324:                             final long size = group.memberLayouts().get(i).byteSize();
>>> 325:                             Class<?> type = SharedUtils.primitiveCarrierForSize(size, false);
>> Not sure this is ok - this is a struct of floats passed by register?
> Yes, I found that that the native code passes float-only structs in float registers, but we were trying to load it using an int carrier, which maps to an int register in the Java calling convention. Besides being inefficient to have to move between these registers, it is not possible to move between float and int registers directly in x86, which would complicate the shuffling process by having to go through memory.
> By using float/double as a carrier here instead, the upcall handle expects it's argument to be in a float register as well, and we don't have to move it between registers.

Ah, wait this is AArch64. I've kept this as is so far (it was previously using ints as a carrier as well). You are probably right that this is incorrect.

Currently it doesn't matter though since we always go through an intermediate buffer (AArch64 doesn't support specialized upcalls yet). I simply didn't attempt to pick the correct type here yet.


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

More information about the panama-dev mailing list