RFR: 8340205: Native linker allows MemoryLayout consisting of only PaddingLayout [v16]
Maurizio Cimadamore
mcimadamore at openjdk.org
Thu Nov 14 13:15:02 UTC 2024
On Wed, 13 Nov 2024 15:21:24 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:
>
> Fix failing test
src/java.base/share/classes/java/lang/foreign/Linker.java line 271:
> 269: * </ul>
> 270: * <p>
> 271: * Well-formed layouts in function descriptions consumed by a native linker constitute
Let's simplify this, and make it more direct:
A function descriptors is well-formed if its argument and return layouts are well-formed and are not sequence layouts. A native linker is guaranteed to reject function descriptors that are not well-formed. However, a native linker can still reject well-formed function descriptors, according to platform-specific rules. For example, some native linkers may reject <em>packed</em> struct layouts -- struct layouts whose member layouts feature relaxed alignment constraints, to avoid the insertion of additional padding.
Let's skip the example -- we're not after a tutorial of what packed structs are or aren't. We're just making an example of a layout that, while being well-formed, might still not be accepted by all linkers.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21041#discussion_r1842199959
More information about the core-libs-dev
mailing list