[foreign-memaccess+abi] RFR: 8292174: Add unaligned layouts to ValueLayout
Maurizio Cimadamore
mcimadamore at openjdk.org
Wed Aug 10 13:46:58 UTC 2022
On Wed, 10 Aug 2022 13:18:21 GMT, Jorn Vernee <jvernee 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.
I'd like not to have a separate nested class if possible. That will show up in javadoc and make those constants less discoverable.
Also, I think it would be better to use UNALIGNED as a suffix - e.g. JAVA_INT_UNALIGNED.
-------------
PR: https://git.openjdk.org/panama-foreign/pull/705
More information about the panama-dev
mailing list