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

8312615: Ensure jdk_foreign tests pass on linux-x86 #849

Closed
wants to merge 4 commits into from

Conversation

JornVernee
Copy link
Member

@JornVernee JornVernee commented Jul 24, 2023

Ensure that the jdk_foreign tests pass on linux-x86.

This is useful to ensure that there are no hard to fix issues (that would require API changes) when trying to use the linker API on a 32-bit platform. This is a good indication that the FFM API is ready for finalization.


Progress

  • Change must not contain extraneous whitespace
  • Change must be properly reviewed (1 review required, with at least 1 Committer)

Issue

  • JDK-8312615: Ensure jdk_foreign tests pass on linux-x86 (Enhancement - P3)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/panama-foreign.git pull/849/head:pull/849
$ git checkout pull/849

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 849

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/panama-foreign/pull/849.diff

Webrev

Link to Webrev Comment

Sorry, something went wrong.

@bridgekeeper
Copy link

bridgekeeper bot commented Jul 24, 2023

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

Comment on lines +429 to +436
dependencies: ["devkit", "gtest", "libffi"],
configure_args: concat(common.configure_args_32bit, [
"--with-jvm-variants=minimal,server",
"--with-zlib=system",
"--with-libffi=" + input.get("libffi", "home_path"),
"--enable-libffi-bundling",
"--enable-fallback-linker"
])
Copy link
Member Author

Choose a reason for hiding this comment

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

Here I'm adding the libffi dependency and enabling the fallback linker on linux-x86 (in our CI)

@@ -184,18 +186,23 @@ enum LayoutKind {
this.layout = segment;
}

private static final Pattern LAYOUT_PATTERN = Pattern.compile("^(?<align>\\d+%)?(?<char>[azcsifjdAZCSIFJD])\\d+$");
Copy link
Member Author

Choose a reason for hiding this comment

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

On 32-bit platforms, the string representation of e.g. long is 4%j8. This pattern helps to filter out the 4%.

Comment on lines +28 to 29
* @requires vm.bits == 64
* @run testng/othervm -Xmx4G -XX:MaxDirectMemorySize=1M --enable-native-access=ALL-UNNAMED TestSegments
Copy link
Member Author

@JornVernee JornVernee Jul 24, 2023

Choose a reason for hiding this comment

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

This test fails on 32-bit platforms due to the -Xmx4G flag. I've disabled it there.

Comment on lines +133 to +144
public static final MemoryLayout S_PDI_LAYOUT = switch ((int) ValueLayout.ADDRESS.byteSize()) {
case 8 -> MemoryLayout.structLayout(
C_POINTER.withName("p0"),
C_DOUBLE.withName("p1"),
C_INT.withName("p2"),
MemoryLayout.paddingLayout(4));
case 4 -> MemoryLayout.structLayout(
C_POINTER.withName("p0"),
C_DOUBLE.withName("p1"),
C_INT.withName("p2"));
default -> throw new UnsupportedOperationException("Unsupported address size");
};
Copy link
Member Author

@JornVernee JornVernee Jul 24, 2023

Choose a reason for hiding this comment

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

Both TestUpcallHighArity and TestUpcallStructScope use this layout. I've moved it here to avoid declaring it twice.

@JornVernee JornVernee marked this pull request as ready for review July 24, 2023 16:38
@openjdk openjdk bot added the rfr Ready for review label Jul 24, 2023
@mlbridge
Copy link

mlbridge bot commented Jul 24, 2023

Webrevs

/**
* The layout for the {@code size_t} C type
*/
public static final ValueLayout C_SIZE_T = ValueLayout.ADDRESS.byteSize() == 8 ? C_LONG_LONG : C_INT;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can't you set SIZE_T using the canonical layout API?

Copy link
Member Author

Choose a reason for hiding this comment

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

True. We could change the other layouts in this file over to that too.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've update this list of layouts to use canonicalLayouts() instead

Copy link
Collaborator

@mcimadamore mcimadamore left a comment

Choose a reason for hiding this comment

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

Looks good!

@openjdk
Copy link

openjdk bot commented Jul 25, 2023

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

8312615: Ensure jdk_foreign tests pass on linux-x86

Reviewed-by: mcimadamore

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 no new commits pushed to the foreign-memaccess+abi branch. If another commit should be pushed before you perform the /integrate command, your PR will be automatically rebased. If you prefer to avoid any potential 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-memaccess+abi branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Ready to be integrated label Jul 25, 2023
@JornVernee
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Jul 25, 2023

Going to push as commit f31c46c.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jul 25, 2023
@openjdk openjdk bot closed this Jul 25, 2023
@openjdk openjdk bot removed ready Ready to be integrated rfr Ready for review labels Jul 25, 2023
@openjdk
Copy link

openjdk bot commented Jul 25, 2023

@JornVernee Pushed as commit f31c46c.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

None yet

2 participants