RFR: 7903923: Derive C_* layouts directly from the Linker

Jorn Vernee jvernee at openjdk.org
Mon Jan 6 11:44:48 UTC 2025


On Mon, 6 Jan 2025 11:39:52 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Depending on the platform, different `C_*`  correspond to different `JAVA_*` types. We can get those values directly from the linker.
>> 
>> This patch can allows us to have a common class for different platforms.
>> 
>> Please review, and thanks in advance!
>
> src/main/java/org/openjdk/jextract/impl/ToplevelBuilder.java line 81:
> 
>> 79:         if (TypeImpl.IS_WINDOWS) {
>> 80:             first.appendIndentedLines("public static final ValueLayout.OfInt C_LONG = (ValueLayout.OfInt) Linker.nativeLinker().canonicalLayouts().get(\"int\");");
>> 81:             first.appendIndentedLines("public static final ValueLayout.OfDouble C_LONG_DOUBLE = (ValueLayout.OfDouble) Linker.nativeLinker().canonicalLayouts().get(\"double\");");
> 
> Here, there's no canonical layout for `long double`. (but what you did retains compatibility with what we had). But I wonder if FFM should add one? @JornVernee , @minborg  ?

I would be okay with adding `long double` as a canonical layout, just on Windows, if that's what you mean.

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

PR Review Comment: https://git.openjdk.org/jextract/pull/269#discussion_r1904053085


More information about the jextract-dev mailing list