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

Paul Sandoz psandoz at openjdk.org
Mon Aug 15 20:54:37 UTC 2022


On Mon, 15 Aug 2022 07:23:22 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.
>
> Per Minborg has updated the pull request incrementally with one additional commit since the last revision:
> 
>   remove comment

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

> 747:      * {@snippet lang=java :
> 748:      * MemoryLayout.valueLayout(MemorySegment.class, ByteOrder.nativeOrder())
> 749:      *             .withBitAlignment(8);

An alternative snippet is to leverage the exiting aligned constant and make it unaligned, like what we would commonly do in internal code:

ADDRESS.withBitAlignment(8);

I think that expresses the intent more clearly.

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

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


More information about the panama-dev mailing list