RFR: 8308293: A linker should expose the layouts it supports [v6]

Maurizio Cimadamore mcimadamore at openjdk.org
Fri May 26 16:34:08 UTC 2023


On Wed, 24 May 2023 09:36:34 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> This patch adds an instance method on `Linker`, namely `Linker::canonicalLayouts` which returns all the layouts known by the linker as implementing some ABI type. For instance, if I call this on my machine (Linux/x64) I get this:
>> 
>> 
>> jshell> import java.lang.foreign.*;
>> 
>> jshell> Linker.nativeLinker().canonicalLayouts()
>> $2 ==> {char16_t=c16, int8_t=b8, long=j64, size_t=j64, bool=z8, int=i32, long long=j64, int64_t=j64, void*=a64, float=f32, char=b8, int16_t=s16, int32_t=i32, short=s16, double=d64}
>> 
>> 
>> This can be useful to discover the ABI types supported by a linker implementation, as well as for, in the future, add support for more exotic (and platform-dependent) linker types, such as `long double` or `complex long`.
>
> Maurizio Cimadamore has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains eight commits:
> 
>  - Merge branch 'master' into linker_types
>  - Drop "unsigned short"
>    Beef up javadoc
>  - Address further review comments
>  - Address review comments
>  - More javadoc tweaks
>  - Tweak javadoc
>  - Tweak javadoc
>    Add char type
>  - Initial push

Thanks for taking the time to review. After some more consideration, I will withdraw this PR. While this API is largely not problematic, we need to make sure that this API fits with how the FFM API will be evolved to support other types besides the C basic types we know and love (e.g. `long double`, vectors, `complex` types). So adding this API point now seems premature.

I will bring over relevant javadoc improvements in the other javadoc PR I have open: https://github.com/openjdk/panama-foreign/pull/833

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

PR Comment: https://git.openjdk.org/jdk/pull/14037#issuecomment-1564641545


More information about the core-libs-dev mailing list