RFR: 7903625: Simplify API of the generated code [v3]

Maurizio Cimadamore mcimadamore at openjdk.org
Fri Jan 19 16:17:05 UTC 2024


> 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).

Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision:

  Add test for global struct getter/setters

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

Changes:
  - all: https://git.openjdk.org/jextract/pull/187/files
  - new: https://git.openjdk.org/jextract/pull/187/files/6244c83a..52607ac8

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jextract&pr=187&range=02
 - incr: https://webrevs.openjdk.org/?repo=jextract&pr=187&range=01-02

  Stats: 100 lines in 6 files changed: 85 ins; 9 del; 6 mod
  Patch: https://git.openjdk.org/jextract/pull/187.diff
  Fetch: git fetch https://git.openjdk.org/jextract.git pull/187/head:pull/187

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


More information about the jextract-dev mailing list