[foreign-jextract] RFR 8237809: Use platform independent layout constants in jextract generated code

Jorn Vernee jorn.vernee at oracle.com
Fri Jan 24 11:29:07 UTC 2020


Ah yes,  sorry. I got tripped up by the fact that this is not code used 
by jextract itself, but is included in the generated bindings. And, 
there was some discussion earlier about changing this out for using 
platform independent constant: 
https://mail.openjdk.java.net/pipermail/panama-dev/2020-January/007210.html

We had some offline discussion about this as well. One argument for not 
using constants that get selected at runtime in the generated bindings, 
is that we don't know what the right selection strategy is. e.g. we can 
select the native ABI's 'char' layout on each platform, but maybe the 
native library is expecting 'char' on one platform, and 'int' on another 
(for instance due to compiler switches). So, probably better to generate 
bindings that use constants of the platform jextract runs on by default, 
and leave it up to users to manually implement a strategy for selecting 
the layouts based on the runtime platform.

Jorn

On 24/01/2020 12:17, Maurizio Cimadamore wrote:
> Uhm - no :-)
>
> If I'm reading correctly, this patch will make jextract use platform 
> independent layout - which is not correct, as jextract should always 
> use the layouts which are valid for the platform in which the 
> extraction is being ran.
>
> Maurizio
>
>
> On 24/01/2020 10:14, Jorn Vernee wrote:
>> Looks good.
>>
>> Jorn
>>
>> On 24/01/2020 08:38, sundararajan.athijegannathan at oracle.com wrote:
>>> Please review.
>>>
>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8237809
>>>
>>> Webrev: http://cr.openjdk.java.net/~sundar/8237809/webrev.00/
>>>
>>> Thanks
>>>
>>> -Sundar
>>>


More information about the panama-dev mailing list