[foreign-jextract] RFR: 8249810: Jextract should generate parameter types with Addressable type
Henry Jen
henryjen at openjdk.java.net
Tue Jul 21 22:05:45 UTC 2020
On Tue, 21 Jul 2020 21:38:14 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> src/jdk.incubator.jextract/share/classes/jdk/incubator/jextract/HeaderBuilder.java line 76:
>>
>>> 75: }
>>> 76: if (sigtype.parameterType(i).equals(Addressable.class)) {
>>> 77: pExprs.add(pName + ".address()");
>>
>> Here we assume the method handle have MemoryAddress type, while this is true in current implementation, it's possible
>> that mhtype actually have Addressable if caller chose to do so otherwise.
>
> No, that's not possible. The ABI does not support Addressable as a carrier type for parameter/returns. In other words,
> Addressable is a fiction that's only valid in jextract - it is not really taken into account by the guts of the ABI
> support.
It is true at ABI level, the method handle can only handle MemoryAddress. But there is nothing preventing something
like ConstantHelper to adapt the ABI-level MH to take Addressable as you do here.
What I am suggesting is simply saying you don't need add sigtype, simply take the incoming method type and adapt
MemoryAddress into Addressable.address().
-------------
PR: https://git.openjdk.java.net/panama-foreign/pull/257
More information about the panama-dev
mailing list