Skip to content

Conversation

pchilano
Copy link
Contributor

@pchilano pchilano commented Sep 9, 2025

Please review the following patch which adds virtual thread support for the value class calling convention. Most of the changes are needed to handle extended frames, i.e c1 or c2 frames that use more stack space for arguments than the stack space allocated by the caller. These include changes in freeze and thaw code, plus changes in the stackChunk walking code where we now need a similar repair of the caller sp as in the current sender code. In this case though, we only adjust _unextended_sp and keep the value of _sp. This is because frames are walked without a full RegisterMap, but we still need to be able to access the saved fp in the callee for gc purposes. The remaining changes deal with saving and restoring the extra return registers when calling thaw.

Thanks to Tobias for working on the initial changes and for providing the very useful new test TestVirtualThreads.java, included in this PR, which has been great for catching many bugs. I also run the changes with the valhalla-comp-stress job in mach5. It uncovered a couple of extra failures in TestVirtualThreads.java, but I was able to reproduce them with platform threads as well (8367151 and 8367258). I also added extra testing for value classes in existing test Fuzz.java which has proven very useful too.

Thanks,
Patricio


Progress

  • Change must not contain extraneous whitespace

Issue

  • JDK-8336845: [lworld] Virtual threads don't support the value class calling convention (Bug - P2)

Reviewers

Contributors

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/valhalla.git pull/1556/head:pull/1556
$ git checkout pull/1556

Update a local copy of the PR:
$ git checkout pull/1556
$ git pull https://git.openjdk.org/valhalla.git pull/1556/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1556

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/valhalla/pull/1556.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 9, 2025

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

@openjdk
Copy link

openjdk bot commented Sep 9, 2025

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

8336845: [lworld] Virtual threads don't support the value class calling convention

Co-authored-by: Tobias Hartmann <[email protected]>
Reviewed-by: thartmann, coleenp

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 255 new commits pushed to the lworld 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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@TobiHartmann, @coleenp) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@pchilano
Copy link
Contributor Author

pchilano commented Sep 9, 2025

/contributor add @TobiHartmann

@openjdk
Copy link

openjdk bot commented Sep 9, 2025

@pchilano
Contributor Tobias Hartmann <[email protected]> successfully added.

@pchilano pchilano marked this pull request as ready for review September 9, 2025 15:07
@openjdk openjdk bot added ready Pull request is ready to be integrated rfr Pull request is ready for review labels Sep 9, 2025
@mlbridge
Copy link

mlbridge bot commented Sep 9, 2025

Webrevs

Copy link
Member

@TobiHartmann TobiHartmann left a comment

Choose a reason for hiding this comment

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

I'm not an expert in this code but the changes look all good to me. I know this was a lot of effort, great work Patricio!

@pchilano
Copy link
Contributor Author

Thanks Tobias!
/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Sep 11, 2025
@openjdk
Copy link

openjdk bot commented Sep 11, 2025

@pchilano
Your change (at version 3966983) is now ready to be sponsored by a Committer.

RegisterMap::ProcessFrames::skip,
RegisterMap::WalkContinuation::skip);
frame caller = to_frame().sender(&map);
assert(caller.is_compiled_frame() && caller.cb()->as_nmethod()->is_compiled_by_c2(), "");
Copy link
Contributor

Choose a reason for hiding this comment

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

All these asserts with no messages could be precond(). Or they could have strings why these conditions are expected.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If the c2 frame needs stack repair but was not extended, then caller should be c2 compiled too, i.e. there was no need to extend it. How about adding "needs stack repair but was not extended with c1/interpreter caller"?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that sounds good. The strings in these asserts (there are a few that you added) might help with understanding this code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added.

@openjdk openjdk bot removed the sponsor Pull request is ready to be sponsored label Sep 11, 2025
Copy link
Contributor

@coleenp coleenp left a comment

Choose a reason for hiding this comment

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

These changes are written generally enough to upstream to mainline so they can also be part of that code. In case mainline has any improvements in this area, this wouldn't be a complicated merge.

@coleenp
Copy link
Contributor

coleenp commented Sep 12, 2025

/sponsor

@openjdk
Copy link

openjdk bot commented Sep 12, 2025

@coleenp The PR has been updated since the change author (@pchilano) issued the integrate command - the author must perform this command again.

@pchilano
Copy link
Contributor Author

Thanks Coleen!
/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Sep 12, 2025
@openjdk
Copy link

openjdk bot commented Sep 12, 2025

@pchilano
Your change (at version e875956) is now ready to be sponsored by a Committer.

@coleenp
Copy link
Contributor

coleenp commented Sep 12, 2025

/sponsor

@openjdk
Copy link

openjdk bot commented Sep 12, 2025

Going to push as commit 11cee9e.
Since your change was applied there have been 255 commits pushed to the lworld branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Sep 12, 2025
@openjdk openjdk bot closed this Sep 12, 2025
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels Sep 12, 2025
@openjdk
Copy link

openjdk bot commented Sep 12, 2025

@coleenp @pchilano Pushed as commit 11cee9e.

💡 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.

3 participants