On Tue, 17 Sep 2024 14:12:58 GMT, Per Minborg <pminb...@openjdk.org> wrote:

> This PR prevents sequence layout with padding to be used with the Linker.

src/java.base/share/classes/java/lang/foreign/Linker.java line 252:

> 250:  * <li>the alignment constraint of {@code S} is set to its
> 251:  *     <a href="MemoryLayout.html#layout-align">natural alignment</a>, 
> and</li>
> 252:  * <li>{@code S.elementLayout()} is not a padding layout.</li>

I think the existing text already covers this case, so no addition should be 
needed. Padding layouts on their own are not supported layouts. (Note e.g. how 
for group layouts we say: 'each member layout ... is either a padding layout or 
a layout supported by {@code NL}'.

Though, either way we'll need a CSR for the behavior change.

test/jdk/java/foreign/TestLinker.java line 165:

> 163:         FunctionDescriptor fd = FunctionDescriptor.of(struct, struct);
> 164:         Linker linker = Linker.nativeLinker();
> 165:         assertThrows(IllegalArgumentException.class, () -> 
> linker.downcallHandle(fd));

Could you please verify the exception message here as well? (Since there are 
multiple IAEs possible)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21041#discussion_r1768366549
PR Review Comment: https://git.openjdk.org/jdk/pull/21041#discussion_r1768363927

Reply via email to