[foreign-memaccess+abi] RFR: 8308293: A linker should expose the layouts it supports [v4]

Jorn Vernee jvernee at openjdk.org
Fri Jun 16 15:14:22 UTC 2023


On Fri, 16 Jun 2023 14:12:44 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Add support for `wchar_t`
>
> src/java.base/share/classes/jdk/internal/foreign/abi/fallback/LibFallback.java line 246:
> 
>> 244:         static final MemorySegment DOUBLE_TYPE = MemorySegment.ofAddress(ffi_type_double());
>> 245:         static final MemorySegment POINTER_TYPE = MemorySegment.ofAddress(ffi_type_pointer());
>> 246:         static final int SIZEOF_SHORT = ffi_sizeof_short();
> 
> Decided to change this a bit - e.g. instead of returning FFI type (which we don't use), I return sizeof instead, which seems more directly usable. This leads to some code simplifications (see definition of SIZE_T in FFIType).

This looks good. `ffi_type` also has an alignment field, which we could also theoretically look at, but I think it's fine to assume that we always have naturally aligned types here.

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

PR Review Comment: https://git.openjdk.org/panama-foreign/pull/839#discussion_r1232381995


More information about the panama-dev mailing list