[foreign-memaccess+abi] RFR: 8299181: PaddingLayout unable to return byteAlignment value
Per Minborg
pminborg at openjdk.org
Mon Jan 16 15:13:25 UTC 2023
On Mon, 16 Jan 2023 14:10:00 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> This PR proposes bit-aligning `PaddingLayout` to 8 by default as opposed to the current value of 1.
>>
>> More generally, the PR restricts `PaddingLayout` bit-alignment to non-negative values that are an even multiple of 8 (i.e. 0, 8, 16, ...). There are no mechanism to derive `VarHandle` objects for sub-byte access anyhow and trying to obtain a miss-aligned `VarHandle` would throw an exception.
>>
>> If integrated, all `MemoryLayout` types would be byte-aligned.
>
> src/java.base/share/classes/jdk/internal/foreign/layout/AbstractLayout.java line 141:
>
>> 139: }
>> 140:
>> 141: private static long requirePowerOfTwoAndGreaterOrEqualToEight(long value) {
>
> Should this stay here, or be merged inside MemoryLayoutUtil? It seems the same as `requireBitSizeValid`, except for the zero behavior?
This method also checks if the parameter is an even power of two.
-------------
PR: https://git.openjdk.org/panama-foreign/pull/766
More information about the panama-dev
mailing list