RFR: 8308645: Javadoc of FFM API needs to be refreshed [v4]
Maurizio Cimadamore
mcimadamore at openjdk.org
Thu Jun 1 21:00:16 UTC 2023
On Thu, 1 Jun 2023 19:25:38 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:
>> src/java.base/share/classes/java/lang/foreign/MemoryLayout.java line 645:
>>
>>> 643: * is 1. As such, regardless of its size, in the absence of an {@linkplain #withByteAlignment(long) explicit}
>>> 644: * alignment constraint, a padding layout does not affect the alignment constraint of the group or sequence layout
>>> 645: * it is nested into.
>>
>> It is possible to override the alignment constraints of group and sequence layouts, so maybe this should say _natural alignment_.
>> Suggestion:
>>
>> * alignment constraint, a padding layout does not affect the natural alignment of the group or sequence layout
>> * it is nested into.
>
> On a related note: should we even allow sequences of padding layouts?
I let sequence of padding slide on the basis that groups of padding are allowed. But it's a somewhat arbitrary line. That said, we do use stuff like that in jextract, where we model types we don't support (or bitfields) as padding. I think starting to ban padding in certain places would result in a less compositional API - and perhaps tools would have to workaround some of these limitations.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213672976
More information about the core-libs-dev
mailing list