RFR: 8340205: Native linker allows MemoryLayout consisting of only PaddingLayout [v5]
Maurizio Cimadamore
mcimadamore at openjdk.org
Fri Oct 4 21:21:41 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
Following a discussion offline, we reached consensus around the following javadoc text:
* <li>{@code L} is a group layout {@code G} and all the following conditions hold:
* <ol>
* <li>the alignment constraint of {@code G} is set to its
* <a href="MemoryLayout.html#layout-align">natural alignment</a>;</li>
* <li>the size of {@code G} is a multiple of its alignment constraint;</li>
* <li>each member layout in {@code G.memberLayouts()} is either a padding layout or
* a layout supported by {@code NL}</li>
* <li>each padding member layout in {@code G} is naturaly aligned</li>
* <li>{@code G} contains at least a non-padding member layout, and</li>
* <li>{@code G} contains the least amount of padding members required to align
* its non-padding layout elements, or to satisfy (2).</li>
```
This should clarify that padding inside structs should be "normalized". Meaning no consecutive padding layouts, and no padding nested in sequence layouts, or only-padding structs/unions. The implementation should also be tweaked accordingly.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/21041#issuecomment-2394685349
More information about the core-libs-dev
mailing list