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

8253725: Jextract fails to extract big monolithic headers #357

Closed
wants to merge 21 commits into from

Conversation

mcimadamore
Copy link
Collaborator

@mcimadamore mcimadamore commented Sep 28, 2020

This patch adds support for splitting the symbols in the main header class into multiple classes; the header class is then rewrited to extend all these additional classes, so that all symbols would be exposed to users in the classic way.

I've toyed with some ways to split on a by-header basis, but found that in certain cases we would generate near-empty classes - and that would still not prevent issues from occurring in the corner case a single very big header file contained so many symbols.

I've reorganized the code a bit - I noted that we were generating several nested classes, but in some cases (structs) we were using a builder, in other cases (functional interfaces, typedef) we weren't. Now we use builders for classes, and I've added an intermediate nested builder abstraction which does the right thing for all nested cases.

I've also converted the source constant generator to be a JavaSourceBuilder too - since it too is a class, after all, with a classBegin/End and build methods.

Finally, I moved the string builder/indentation logic out to a different class (StringSourceBuilder); since some builders want to have their own string buffer, while others (the nested ones) don't.

The organization of the builder code is still far from optimal, but I think that, moving forward, this consolidation should make it easier to make changes.


Progress

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

Issue

  • JDK-8253725: Jextract fails to extract big monolithic headers

Reviewers

Download

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

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Sep 28, 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 Sep 28, 2020
@mlbridge
Copy link

@mlbridge mlbridge bot commented Sep 28, 2020

Webrevs

@openjdk
Copy link

@openjdk openjdk bot commented Sep 28, 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 more details.

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

8253725: Jextract fails to extract big monolithic headers

Reviewed-by: jvernee

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 2 new commits pushed to the foreign-jextract branch:

  • 746bd36: Automatic merge of foreign-abi into foreign-jextract
  • 48f5c38: Transition back to java on safepoint poll slow-path when returning from an optimized native call

Please see this link for an up-to-date comparison between the source branch of this pull request and 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 Sep 28, 2020
@mcimadamore
Copy link
Collaborator Author

@mcimadamore mcimadamore commented Sep 28, 2020

/integrate

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

@openjdk openjdk bot commented Sep 28, 2020

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

  • 746bd36: Automatic merge of foreign-abi into foreign-jextract
  • 48f5c38: Transition back to java on safepoint poll slow-path when returning from an optimized native call

Your commit was automatically rebased without conflicts.

Pushed as commit a8244b7.

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

@mcimadamore mcimadamore deleted the higher-split branch Nov 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated
2 participants