[foreign-jextract] RFR: 8274155 Foreign API refresh - jextract update

Maurizio Cimadamore mcimadamore at openjdk.java.net
Wed Sep 22 15:48:55 UTC 2021


On Wed, 22 Sep 2021 15:31:43 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

> These are the jextract changes for the recent refresh of the Foreign Memory Access/Foreign Linker API. The biggest change in this API refresh comes from the removal of layout attributes. Jextract used to store several information in the form of layouts attributes. After some analysis, it turned out that in all cases, the use of layout attributes was not necessary, and it was really driven by the fact that jextract was, in certain places, using `MemoryLayout` as its main internal representation, instead of using the more flexible `Declaration`/`Type` APIs. Unfortunately, updating `RecordLayoutComputer` to work on `Declaration` rather than `MemoryLayout` caused changes in several part of the jextract parsing frontend.
> 
> Other minor changes were required, to adjust jextract to the new API changes - but most of these are small. I've dropped several now redundant overloads (so the size of the generated bindings should be smaller). There's also an additional piece of code which is used to emit typedef for common C primitive types such as `C_INT` and the likes (since the layouts for these are no longer in `CLinker`).
> 
> The test changes are mostly trivial updates to use the new API.

Warning: there's a lot of changes in the generated libclang bindings, as I had to make these compatible with the new API. I basically bulk replaced code to use new API idioms using regular expressions, so the changes in these classes are not very interesting (as long as the thing still builds). We should probably regenerate the bindings after we're done, and clean them up.

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

PR: https://git.openjdk.java.net/panama-foreign/pull/577


More information about the panama-dev mailing list