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

Athijegannathan Sundararajan sundar at openjdk.java.net
Tue Oct 20 05:56:21 UTC 2020


On Mon, 19 Oct 2020 16:47:38 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

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

I reviewed the changes. Also I tested all samples (source and binary mode) on Mac. All jextract and run fine.

Marked as reviewed by sundar (Committer).

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

Marked as reviewed by sundar (Committer).

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


More information about the panama-dev mailing list