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

Jorn Vernee jvernee at openjdk.org
Wed Nov 13 17:32:48 UTC 2024


On Wed, 13 Nov 2024 10:24:14 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 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 32 additional commits since the last revision:
> 
>  - Update after comments
>  - Merge branch 'master' into linker-padding-layout-only
>  - Simplify exception testing
>  - Merge branch 'master' into linker-padding-layout-only
>  - Remove redundant check
>  - Rephrase doc
>  - Improve language
>  - Add checks of exception messages
>  - Update test/jdk/java/foreign/TestLinker.java
>    
>    Co-authored-by: Jorn Vernee <JornVernee at users.noreply.github.com>
>  - Update src/java.base/share/classes/jdk/internal/foreign/abi/AbstractLinker.java
>    
>    Co-authored-by: Jorn Vernee <JornVernee at users.noreply.github.com>
>  - ... and 22 more: https://git.openjdk.org/jdk/compare/d58b6a2d...786b1737

src/java.base/share/classes/jdk/internal/foreign/abi/AbstractLinker.java line 202:

> 200:                     lastUnpaddedOffset = offset;
> 201:                     if (preceedingPadding != null) {
> 202:                         assertIsAlignedBy(sl, preceedingPadding, member);

Alignment of members is already checked by `checkMemberOffset`, so `assertIsAlignedBy` should not be needed AFAICT. The only thing we should have to do in this branch is set `preceedingPadding` to `null`.

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

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


More information about the core-libs-dev mailing list