[foreign-jextract] RFR: 8250518: Jextract should process macros in bulk [v2]

Maurizio Cimadamore mcimadamore at openjdk.java.net
Mon Jul 27 11:17:09 UTC 2020


> This patch adds bulk processing of macros; that is, instead of having a reparsing step for every macro constant, this
> patch tweaks jextract so that all unparsed macros are processed in one go.
> The logic is quite convoluted and this work led to a major refactoring of MacroParserImpl; there is now a *table* where
> unparsed macros are kept - elements in this table are reparsed, and, based on the contents of the reparsed cursors, the
> table state is updated accordingly (the code has quite a bit of doc documenting the possible state transitions).  This
> results in some 2x performance boost in some of the heaviest extraction runs.
> One thing to notice is that one of the test required some tweaks, as the new code seems to be able to infer a sharper
> type for a macro - e.g. `foo*` instead of `void*`. I suspect this is related to `TypeMaker::resolveTypeReferences` but
> I'm not 100% sure - @slowhog  can you please take a look?

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

  Remove use of null in macro state transition.
  Improved code by using switch expression.

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

Changes:
  - all: https://git.openjdk.java.net/panama-foreign/pull/264/files
  - new: https://git.openjdk.java.net/panama-foreign/pull/264/files/50444b6f..455b589e

Webrevs:
 - full: https://webrevs.openjdk.java.net/panama-foreign/264/webrev.01
 - incr: https://webrevs.openjdk.java.net/panama-foreign/264/webrev.00-01

  Stats: 48 lines in 1 file changed: 21 ins; 8 del; 19 mod
  Patch: https://git.openjdk.java.net/panama-foreign/pull/264.diff
  Fetch: git fetch https://git.openjdk.java.net/panama-foreign pull/264/head:pull/264

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


More information about the panama-dev mailing list