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

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

On Tue, 23 Feb 2021 11:03:30 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Jorn Vernee has updated the pull request incrementally with two additional commits since the last revision:
>>  - Tab to spaces
>>  - Added TestMatrix test that test all configurations of TestUpcall TestDowncall and TestUpcallHightArity
> 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.


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

More information about the panama-dev mailing list