8389130: [lworld] Compiled frame walking is slow due to scalarized calling convention handling - #32148
8389130: [lworld] Compiled frame walking is slow due to scalarized calling convention handling#32148marc-chevalier wants to merge 4 commits into
Conversation
|
👋 Welcome back mchevalier! A progress list of the required criteria for merging this PR into |
|
@marc-chevalier 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 41 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 |
|
@marc-chevalier The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
|
The total number of required reviews for this PR has been set to 2 based on the presence of this label: |
fparain
left a comment
There was a problem hiding this comment.
Changes look semantically correct to me.
This PR replaces the Valhalla draft PR openjdk/valhalla#2687, which was already reviewed by @TobiHartmann and awaiting review from runtime but was not integrated due to the code freeze immediately before the Valhalla mainline integration.
The problem is that Valhalla made
frame::sendera tiny bit bigger, but it is enough for gcc to decide not to inline it anymore. And then, functions such asvoid java_lang_Throwable::fill_in_stack_trace(Handle throwable, const methodHandle& method, TRAPS)have a call, instead of having it inlined all the way tointptr_t* frame::repair_sender_sp(intptr_t* sender_sp, intptr_t** saved_fp_addr) const. While there are a lot of paths, and its job is a bit subtleframe frame::sender_for_compiled_frame(RegisterMap* map) constis mostly doing rather basic arithmetic: a call can easily create some slowdown, Especially in cases where walking the stack is on a hot path.So, to address this, I propose a 2-part solution: trying to shrink the size of
sender, and marking it asALWAYS_INLINE. To shrink the size, I cache whether the method needs stack repairs in its flags rather than recomputing it, since it is a constant. It doesn't seem to make it as small as the mainline version, but quite closer. This change is not satisfactory by itself because, even if it were enough to reenable inlining (which it is not), we are so clone from the inlining threshold that the least change in the future could make it bad again. Since we know we are not far from inlining, force inlining the method cannot be too bad.It is to note that because it is about codesize and inlining problem, the performance issue appear without
--enable-preview. Trying to branch on that just makes the code bigger and the problem worse.Valhalla:
Mainline:
This PR:
We can see the changes for the performances of mainline and this PR overlap. There is still a gap, but of 0.15s, that is about 2% instead of 18.5%. It seems the rest of the slowdown is mostly happening during startup.
For comparison, here are the timing for the given test, with only the flag fix, without forcing inlining:
That is only marginally (but consistently) better than Valhalla's current state, but clearly not good enough.
Thanks,
Marc
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/32148/head:pull/32148$ git checkout pull/32148Update a local copy of the PR:
$ git checkout pull/32148$ git pull https://git.openjdk.org/jdk.git pull/32148/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 32148View PR using the GUI difftool:
$ git pr show -t 32148Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/32148.diff
Using Webrev
Link to Webrev Comment