On Wed, 1 Mar 2023 06:26:20 GMT, Martin Doerr <[email protected]> wrote:
>> 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.
Done by
https://github.com/openjdk/jdk/pull/12708/commits/98e242c24c07ea977b7709b9f8d0c10ce87e84c0
(using a record instead of a `VMStorage[][]` because I think this is better
readable). Note that it's a bit more complicated. I couldn't use your `dup`
trick, because I need to put the value into a GP reg and one half of it to a FP
reg. The Panama code doesn't support that (IllegalArgumentException: Invalid
operand type: interface java.lang.foreign.MemorySegment. float expected).
-------------
PR: https://git.openjdk.org/jdk/pull/12708