RFR: 8304265: Implementation of Foreign Function and Memory API (Third Preview) [v5]
Per Minborg
pminborg at openjdk.org
Wed Mar 22 12:10:46 UTC 2023
On Wed, 22 Mar 2023 11:55:09 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> Per Minborg has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Add example for Option::captureStateLayout
>
> src/java.base/share/classes/java/lang/foreign/MemoryLayout.java line 694:
>
>> 692: * @param bitSize the padding size in bits.
>> 693: * @return the new selector layout.
>> 694: * @throws IllegalArgumentException if {@code bitSize < 0} or {@code bitSize % 8 != 0}
>
> I'm not sure if this change in the `@throws` was deliberate - e.g. the new API seems to allow creation of padding layouts of zero size (which I did not realize). This can hide issues for code generators (e.g. I stumbled upon this when working on jextract, which was silently emitting zero-length paddings in some struct layouts). Perhaps better to revert to old semantics?
Agreed. Having zero-length padding does not make much sense.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13079#discussion_r1144707890
More information about the core-libs-dev
mailing list