RFR: 8340205: Native linker allows MemoryLayout consisting of only PaddingLayout [v5]

Vladimir Kozelkov duke at openjdk.org
Mon Oct 7 11:32:37 UTC 2024


On Mon, 23 Sep 2024 16:35:18 GMT, Per Minborg <pminborg at openjdk.org> wrote:

>> This PR prevents sequence layout with padding to be used with the Linker.
>
> Per Minborg has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Reword doce

I'll add this here because the rules are still seems not complete. I can create a structure ending with PaddingLayout

{
    Linker linker = Linker.nativeLinker();
    var sequence0a8 = MemoryLayout.sequenceLayout(0, JAVA_LONG);
    var sequence3a1 = MemoryLayout.sequenceLayout(3, JAVA_BYTE);
    var padding5a1 = MemoryLayout.paddingLayout(5);
    var struct8a8 = MemoryLayout.structLayout(sequence0a8, sequence3a1, padding5a1);
    var fd = FunctionDescriptor.of(struct8a8, struct8a8, struct8a8);
    linker.downcallHandle(fd);
}

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

PR Comment: https://git.openjdk.org/jdk/pull/21041#issuecomment-2396660563


More information about the core-libs-dev mailing list