Integrated: 7903625: Simplify API of the generated code

Maurizio Cimadamore mcimadamore at openjdk.org
Fri Jan 19 16:30:57 UTC 2024


On Fri, 19 Jan 2024 12:16:27 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

> This PR simplifies the API of the code generated by jextract. Here's a list of the changes implemented:
> 
> * the struct layout accessor is now just named `layout()`
> * functional pointer code generation is different now: we generate a toplevel _class_ which defines a nested functional interface that is used for the factory method. This means that we can hide some of the constants associated with the function pointer. The descriptor accessor remains, but is called `descriptor()`.
> * For global variables, accessors such as `x$SEGMENT` and `x$LAYOUT` were made `private`
> * As for struct fields, I've made the accessors for global variable work for the case where the global is a struct/array too (the getter/setter will work on a MemorySegment).

This pull request has now been integrated.

Changeset: 2c7b9805
Author:    Maurizio Cimadamore <mcimadamore at openjdk.org>
URL:       https://git.openjdk.org/jextract/commit/2c7b9805c27092b23299e4c555db2a137570a82f
Stats:     296 lines in 38 files changed: 111 ins; 42 del; 143 mod

7903625: Simplify API of the generated code

Reviewed-by: jvernee

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

PR: https://git.openjdk.org/jextract/pull/187


More information about the jextract-dev mailing list