[foreign-memaccess+abi] RFR: 8292174: Add unaligned layouts to ValueLayout

Jorn Vernee jvernee at openjdk.org
Wed Aug 10 13:21:52 UTC 2022


On Wed, 10 Aug 2022 13:03:45 GMT, Per Minborg <duke at openjdk.org> wrote:

> The layouts are placed in a special `Unaligned` class. This prevents the classes to be seen on the top level (for less cluttering) and allows lazy initialization of items that are likely not so much used.

src/java.base/share/classes/java/lang/foreign/ValueLayout.java line 672:

> 670:          *          performance and portability issues.
> 671:          */
> 672:         public static final OfAddress UNALIGNED_ADDRESS = new OfAddress(ByteOrder.nativeOrder());

This seems to create an address layout with the alignment set to the size of the layout? For unaligned layouts we want the alignment set to 1 byte/8 bits I think.

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

PR: https://git.openjdk.org/panama-foreign/pull/705


More information about the panama-dev mailing list