RFR: 8303040: linux PPC64le: Implementation of Foreign Function & Memory API (Preview) [v3]

Martin Doerr mdoerr at openjdk.org
Wed Mar 1 13:06:13 UTC 2023


On Tue, 28 Feb 2023 20:51:50 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

>> Martin Doerr has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Remove size restriction for structs. Add TODO for Big Endian.
>
> src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/CallArranger.java line 68:
> 
>> 66: public abstract class CallArranger {
>> 67:     // Linux PPC64 Little Endian uses ABI v2.
>> 68:     private static final boolean useABIv2 = ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN;
> 
> Now that I'm here. This could be a potentially interesting case for having 2 subclasses of CallArranger: one for `useABIv2 == true` and one for `false`.

Yeah, let's wait until we know what changes we need for AIX (and Big Endian linux).

> src/java.base/share/classes/jdk/internal/foreign/abi/ppc64/CallArranger.java line 293:
> 
>> 291:                 } else {
>> 292:                     overlappingReg = new VMStorage(StorageType.STACK_AND_FLOAT,
>> 293:                                                    (short) STACK_SLOT_SIZE, (int) stackOffset - 4);
> 
> I think you could remove the mixed VMStorage types here relatively easily by returning a `VMStorage[][]`, where each element is a single element array, but then for the `needOverlapping` case add another element to the array for the extra store (instead of replacing the existing one).
> 
> Then when unboxing a `STRUCT_HFA`,  `dup` the result of the `bufferLoad` and then do 2 `vmStore`s (one for each element).
> 
> For boxing, you could just ignore the extra storage, and just `vmLoad` the first one (or, whichever one you like :))

Thanks! I need to find extra time for this. Sounds like a good idea and I may be able to get rid of some nasty code.

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

PR: https://git.openjdk.org/jdk/pull/12708


More information about the core-libs-dev mailing list