On Fri, 25 Aug 2023 00:10:11 GMT, Maurizio Cimadamore <[email protected]>
wrote:
>> I've found a way to solve the remaining FFI problem on linux PPC64 Big
>> Endian. Large structs (>8 Bytes) which are passed in registers or on stack
>> require shifting the Bytes in the last slot if the size is not a multiple of
>> 8. This PR adds the required functionality to the Java code.
>>
>> Please review and provide feedback. There may be better ways to implement
>> it. I just found one which works and makes the tests pass:
>>
>> Test summary
>> ==============================
>> TEST TOTAL PASS FAIL ERROR
>>
>> jtreg:test/jdk/java/foreign 88 88 0 0
>>
>>
>>
>> Note: This PR should be considered as preparation work for AIX which also
>> uses ABIv1.
>
> src/java.base/share/classes/jdk/internal/foreign/abi/Binding.java line 717:
>
>> 715: public void interpret(Deque<Object> stack, StoreFunc storeFunc,
>> 716: LoadFunc loadFunc, SegmentAllocator
>> allocator) {
>> 717: if (shiftAmount > 0) {
>
> Why do we assume we can only deal with ints or longs?
I have inserted casts into `public Binding.Builder shiftLeft(int shiftAmount,
Class<?> type)` (similar to other bindings). The VM handles integral types
smaller than `int` like `int` and uses 4 Bytes for arithmetic operations.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15417#discussion_r1305321446