[foreign-jextract] RFR: 8254983: jextract fails to hande layout paths nested structs/union# [v2]

Maurizio Cimadamore mcimadamore at openjdk.java.net
Mon Oct 19 16:47:38 UTC 2020


> This patch fixes an issue with jextract code generation. More specifically, when multiple structs with same name are
> found in an header (this is possible if the structs are at different level of nesting e.g. `Foo.Bar` vs.
> `Foo.Baz.Bar`), jextract erroneously uses the struct simple name to qualifiy the various fields associated with the
> struct (such as the layout field). Because of this, there are cases where, when generating a var handle for a struct
> field, we erroneously pick up the layout corresponding to a different struct, which then causes an error at runtime.
> The fix is to always disambiguate struct names when in nested context, so that `Foo.Bar` and `Foo.Baz.Bar` lead to
> different constant names.

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

  * Make test more robust
  * Add missing copyright header
  * Cleanup code

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

Changes:
  - all: https://git.openjdk.java.net/panama-foreign/pull/384/files
  - new: https://git.openjdk.java.net/panama-foreign/pull/384/files/0059cc42..4577e305

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=panama-foreign&pr=384&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=panama-foreign&pr=384&range=00-01

  Stats: 33 lines in 5 files changed: 28 ins; 0 del; 5 mod
  Patch: https://git.openjdk.java.net/panama-foreign/pull/384.diff
  Fetch: git fetch https://git.openjdk.java.net/panama-foreign pull/384/head:pull/384

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


More information about the panama-dev mailing list