[foreign-jextract] Integrated: 8276136: functional interface extraction broken after API refresh
Maurizio Cimadamore
mcimadamore at openjdk.java.net
Fri Oct 29 12:48:31 UTC 2021
On Thu, 28 Oct 2021 22:32:18 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
> This addresses the issue discovered in this thread:
>
> https://mail.openjdk.java.net/pipermail/panama-dev/2021-September/015144.html
>
> The issue is causes by the fact that the new linker changes introduce an asymmetry between the method type of the downcall and that of an upcall. Downcall have `Addressable` for parameters passed by-reference, and `MemoryAddress` for by-reference returns. Upcalls adopt the dual scheme (`MemoryAddress` for parameters, `Addressable` for return values).
>
> This patch bridges the two schemes by inserting the required casts which keep `invokeExact` happy in the case where we generate a functional interface implementation which calls the upcall stub address.
>
> To do that I had to dig a bit in `TypeTranslator` to make the type translation context-dependent. I also had to enhance `FunctionInfo` so that it could carry the "reverse" method type in the upcall case.
>
> I've added a test which checks a function pointer which takes an address and returns another address - which stresses both argument and return mismatch.
This pull request has now been integrated.
Changeset: ac0b4a1b
Author: Maurizio Cimadamore <mcimadamore at openjdk.org>
URL: https://git.openjdk.java.net/panama-foreign/commit/ac0b4a1bed065cd58b5bb62e07dc3836c7f7aca2
Stats: 91 lines in 9 files changed: 27 ins; 24 del; 40 mod
8276136: functional interface extraction broken after API refresh
Reviewed-by: jvernee
-------------
PR: https://git.openjdk.java.net/panama-foreign/pull/605
More information about the panama-dev
mailing list