On Tue, 29 Oct 2024 10:19:36 GMT, Per Minborg <pminb...@openjdk.org> wrote:
>> This PR prevents sequence layout with padding to be used with the Linker. > > Per Minborg has updated the pull request with a new target base due to a > merge or a rebase. The incremental webrev excludes the unrelated changes > brought in by the merge/rebase. The pull request contains 15 additional > commits since the last revision: > > - Add rule checkings in AbstractLinker and add tests > - Merge branch 'master' into linker-padding-layout-only > - Update Linker docs > - Merge branch 'master' into linker-padding-layout-only > - Reword doce > - Add to specification and refine detection of PL GLs > - Add specific message for group layouts with only padding layouts > - Merge branch 'master' into linker-padding-layout-only > - Check exception message > - Remove redundant doc section > - ... and 5 more: https://git.openjdk.org/jdk/compare/d106d510...8e4ee286 src/java.base/share/classes/java/lang/foreign/Linker.java line 271: > 269: * </ul> > 270: * > 271: * Linker implementations may optionally impose additional > platform-specific constraints I think this sentence needs to be better joined with the next. Because here we now say that we can reject more stuff -- but the para after still says that a Linker can accept more stuff. We should basically say that some layouts, such as packed struct layouts, even if well-formed, might be rejected by the Linker. In other words we should make it clear that being well-formed is a necessary condition, not a sufficient one. Unfortunately attempting to capture a sufficient condition is problematic (what we did before), because that has too much platform-dependency variations. But this should be spelled out somehow, because it's easy, when reading the doc, to think that the set of rules above are both necessary and sufficient (e.g. if well-formed then is accepted by Linker and vice-versa) which is a big part of the discussion that happened in this PR. The main point to drive home is that some rules cannot be fully specified as they vary too much. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/21041#discussion_r1822360580