-
Notifications
You must be signed in to change notification settings - Fork 61
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
8255903: Enable multi-register return values for native invokers #603
8255903: Enable multi-register return values for native invokers #603
Conversation
👋 Welcome back jvernee! A progress list of the required criteria for merging this PR into |
src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/CLinker.java
Outdated
Show resolved
Hide resolved
assert(!target_uses_register(tmp1->as_VMReg()), "conflict"); | ||
assert(!target_uses_register(tmp2->as_VMReg()), "conflict"); | ||
assert(!target_uses_register(rthread->as_VMReg()), "conflict"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realized these checks were bogus now that we shuffle arguments as part of the native invoker stub. It is fine for the call to use these registers. Though, if rthread
is clobbered by the call, we would need to save and restore it (currently that's not the case on any platform though, so we assume it doesn't happen).
@@ -100,35 +104,10 @@ ForeignGlobals::ForeignGlobals() { | |||
CallConvOffsets.ret_regs_offset = field_offset(k_CC, "retRegs", symVMSArray); | |||
} | |||
|
|||
int CallRegs::calling_convention(BasicType* sig_bt, VMRegPair *regs, int num_args) const { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this was essentially the same as DownCallNativeConv
after making the target address part of the normal list of arguments, I've removed this implementation of calling_convetion
and am now using (DownCall)NativeConv
for both down and up calls.
src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/abi/ProgrammableInvoker.java
Show resolved
Hide resolved
Webrevs
|
src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/abi/ProgrammableInvoker.java
Show resolved
Hide resolved
src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/abi/SharedUtils.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes look good and I like the various simplification. The MH adaptation logic went up in complexity, but this is transient since we're looking into replace combinators with bytecode generation anyway. Overall a good change.
When building and testing the patch I noted one test failure:
TestAarch64CallArranger
It seems varargs related, so I wonder if this patch undoes the fix for 8275332.
src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/FunctionDescriptor.java
Outdated
Show resolved
Hide resolved
src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/abi/CallingSequenceBuilder.java
Outdated
Show resolved
Hide resolved
src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/abi/SharedUtils.java
Show resolved
Hide resolved
src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/abi/CallingSequenceBuilder.java
Outdated
Show resolved
Hide resolved
src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/abi/ProgrammableInvoker.java
Outdated
Show resolved
Hide resolved
src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/abi/ProgrammableInvoker.java
Outdated
Show resolved
Hide resolved
src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/abi/ProgrammableInvoker.java
Outdated
Show resolved
Hide resolved
src/jdk.incubator.foreign/share/classes/jdk/internal/foreign/abi/SharedUtils.java
Show resolved
Hide resolved
I've just pushed a new iteration that basically renames The tests failures were a case of the newly added tests needing changes for the changes in this PR (fixed as well). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
test/micro/org/openjdk/bench/jdk/incubator/foreign/Upcalls.java
Outdated
Show resolved
Hide resolved
@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:
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 83 new commits pushed to the
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 |
/integrate |
Going to push as commit 818dcfc.
Your commit was automatically rebased without conflicts. |
@JornVernee Pushed as commit 818dcfc. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Hi,
This patch implements support for multi-register returns in native invokers, and removes the buffered invocation strategy for downcalls. This is achieved, essentially, by using an in memory return: the caller allocates a bit of memory, and the native invoker stub writes the values of the return register to that memory. Then, the post processing code reads the register values back from there.
Currently, the target address of a downcall is handled separately from the other arguments. I initially implemented passing the IMR address the same way, but I realized the removal of the buffered invocation strategy affords us a better way of doing things: we can just make the target address and the IMR address part of the normal calling sequence, and remove a bunch of special-casing code to handle these. We now just use a binding recipe to unbox these arguments and shuffle them into registers, and the ABIDescriptor tells the native invoker stub which registers to pick up these arguments from.
Thanks,
Jorn
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/panama-foreign pull/603/head:pull/603
$ git checkout pull/603
Update a local copy of the PR:
$ git checkout pull/603
$ git pull https://git.openjdk.java.net/panama-foreign pull/603/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 603
View PR using the GUI difftool:
$ git pr show -t 603
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/panama-foreign/pull/603.diff