Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8254983: jextract fails to hande layout paths nested structs/union #384

Closed
wants to merge 2 commits into from

Conversation

@mcimadamore
Copy link
Collaborator

@mcimadamore mcimadamore commented Oct 19, 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.


Progress

  • Change must not contain extraneous whitespace
  • Change must be properly reviewed

Testing

Linux x64 Windows x64 macOS x64
Build (5/5 failed) (2/2 failed) (2/2 failed)

Failed test tasks

Issue

  • JDK-8254983: jextract fails to hande layout paths nested structs/union

Reviewers

Download

$ git fetch https://git.openjdk.java.net/panama-foreign pull/384/head:pull/384
$ git checkout pull/384

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Oct 19, 2020

👋 Welcome back mcimadamore! A progress list of the required criteria for merging this PR into foreign-jextract will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr label Oct 19, 2020
* Add missing copyright header
* Cleanup code
@mlbridge
Copy link

@mlbridge mlbridge bot commented Oct 19, 2020

Webrevs

@mcimadamore mcimadamore changed the title 8254983: jextract fails to hande layout paths nested structs/union# 8254983: jextract fails to hande layout paths nested structs/union Oct 19, 2020
@openjdk
Copy link

@openjdk openjdk bot commented Oct 19, 2020

@mcimadamore This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8254983: jextract fails to hande layout paths nested structs/union

Reviewed-by: jvernee, sundar

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 110 new commits pushed to the foreign-jextract branch:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the foreign-jextract branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready label Oct 19, 2020
Copy link
Member

@sundararajana sundararajana left a comment

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

@mcimadamore
Copy link
Collaborator Author

@mcimadamore mcimadamore commented Oct 20, 2020

/integrate

@openjdk openjdk bot closed this Oct 20, 2020
@openjdk openjdk bot added integrated and removed ready rfr labels Oct 20, 2020
@openjdk
Copy link

@openjdk openjdk bot commented Oct 20, 2020

@mcimadamore Since your change was applied there have been 110 commits pushed to the foreign-jextract branch:

Your commit was automatically rebased without conflicts.

Pushed as commit d841b84.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@mcimadamore mcimadamore deleted the mcimadamore:8254983 branch Nov 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants