[foreign-memaccess+abi] RFR: 8300294: Add tests for by-value unions and structs with nested fixed-length arrays

Maurizio Cimadamore mcimadamore at openjdk.org
Thu Feb 9 14:34:23 UTC 2023


On Thu, 9 Feb 2023 14:11:08 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

>> src/java.base/share/classes/jdk/internal/foreign/abi/aarch64/TypeClass.java line 70:
>> 
>>> 68:     }
>>> 69: 
>>> 70:     private static void scalarLayoutsR(List<MemoryLayout> out, GroupLayout gl) {
>> 
>> where does the `R` in the name comes from?
>
> R stands for 'recursive'. I'll type it out. (or, maybe another name like `scalarLayoutsInternal` is better. That seems to be more common in JDK code at least)

I was about to suggest `internal` - but then I wasn't sure if it was derived from an ABI specific term.

>> test/jdk/java/foreign/nested/TestNested.java line 86:
>> 
>>> 84:     }
>>> 85: 
>>> 86:     static final StructLayout S1 = MemoryLayout.structLayout(
>> 
>> Wouldn't it be better to have these structs defined inline inside the `List.of` call in the provider? That should make it a little easier to just add a new case.
>
> I don't think so, because there are struct and union layouts that are nested inside other layouts, but then _also_ are a test case themselves. So, I think we need some intermediate variables either way (or copy paste), and then it seems cleaner to do that for all the layouts.

I see - missed that, thanks.

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

PR: https://git.openjdk.org/panama-foreign/pull/780


More information about the panama-dev mailing list