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

8266682: sync jextract for LibraryLookup removal #529

Closed

Conversation

@sundararajana
Copy link
Member

@sundararajana sundararajana commented May 7, 2021

Using System.load/.loadLibrary in generated code and jextract code. Class initialisation dummy method to take sure constants classes initialise header-class before looking up names.


Progress

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

Issue

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/panama-foreign pull/529/head:pull/529
$ git checkout pull/529

Update a local copy of the PR:
$ git checkout pull/529
$ git pull https://git.openjdk.java.net/panama-foreign pull/529/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 529

View PR using the GUI difftool:
$ git pr show -t 529

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/panama-foreign/pull/529.diff

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented May 7, 2021

👋 Welcome back sundar! 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 May 7, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented May 7, 2021

}
})
.toArray(LibraryLookup[]::new);
static final void loadLibraries(String... libNames) {
Copy link
Collaborator

@mcimadamore mcimadamore May 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps this can be removed? E.g. can't we just emit a static block wherever we call loadLibraries ? It seems like we can do the analysis of whether to call load/loadLibrary at jextract time.

@@ -49,12 +48,14 @@
//this is an hack - needed because clang_toggleCrashRecovery only takes effect _after_ the
//first call to createIndex.
Copy link
Collaborator

@mcimadamore mcimadamore May 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a link to:
https://reviews.llvm.org/D23662

This should really get fixed upstream.

decrAlign();
}

private void emitInit() {
Copy link
Collaborator

@mcimadamore mcimadamore May 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following offline discussion, I think we can simplify this by removing library loading logic from header classes and sticking it in runtime helper.

}
})
.toArray(LibraryLookup[]::new);
static final void loadLibraries(String... libNames) {
Copy link
Collaborator

@mcimadamore mcimadamore May 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be able to remove this


private String generateLoadLibraries() {
StringBuilder buf = new StringBuilder();
buf.append("RuntimeHelper.loadLibraries(new String[] {");
Copy link
Collaborator

@mcimadamore mcimadamore May 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of calling load libraries, we can just emit calls to System.load/loadLibraries here

Copy link
Collaborator

@mcimadamore mcimadamore left a comment

Looks good - I've tested it on a couple of samples on linux and performance numbers seems good. Tests all pass here.

@openjdk
Copy link

@openjdk openjdk bot commented May 7, 2021

@sundararajana 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:

8266682: sync jextract for LibraryLookup removal

Reviewed-by: mcimadamore, 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 104 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 May 7, 2021
Copy link
Member

@JornVernee JornVernee left a comment

Works on Windows as well.

@sundararajana
Copy link
Member Author

@sundararajana sundararajana commented May 7, 2021

/integrate

@openjdk openjdk bot closed this May 7, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels May 7, 2021
@openjdk
Copy link

@openjdk openjdk bot commented May 7, 2021

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

Your commit was automatically rebased without conflicts.

Pushed as commit 990758e.

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

@sundararajana sundararajana deleted the JDK-8266682 branch May 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants