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
8290700: Optimize AArch64 nmethod entry barriers #9574
Conversation
|
Note that this PR is dependent on #9569 |
The dependent pull request has now been integrated, and the target branch of this pull request has been updated. This means that changes from the dependent pull request can start to show up as belonging to this pull request, which may be confusing for reviewers. To remedy this situation, simply merge the latest changes from the new target branch into this pull request by running commands similar to these in the local repository for your personal fork: git checkout 8290700_faster_aarch64_entry_barriers
git fetch https://git.openjdk.org/jdk master
git merge FETCH_HEAD
# if there are conflicts, follow the instructions given by git merge
git commit -m "Merge master"
git push |
@fisk this pull request can not be integrated into git checkout 8290700_faster_aarch64_entry_barriers
git fetch https://git.openjdk.org/jdk master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push |
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 reasonable to me.
Someone familiar with aarch64 code have to review it.
@fisk This change now passes all automated pre-integration checks. 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 2 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the
|
Thanks for the review, @vnkozlov! |
} | ||
} | ||
ShouldNotReachHere(); | ||
} |
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'm guessing this function is not performance-critical. If it was, then we could consider adding a new field to the nmethod to keep track of the offset for the guard.
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.
Yeah I thought about adding a new entry to CodeOffsets, but it seemed like this C2-only AArch64-only detail seemed a bit noisy in the shared code then. And it didn't seem warranted, given how cold this path is by design.
Thanks for the review @dean-long! |
/integrate |
Going to push as commit 228e8e9.
Your commit was automatically rebased without conflicts. |
The original nmethod entry barrier supported only concurrent patching of data and was used by ZGC to solve concurrent class unloading problems. Now it is starting to see more uses. Notably, loom uses nmethod entry barriers to figure out what nmethods have been seen on-stack, needed to remove nmethods safely. However, the concurrent data patching variation was too slow for loom (showed a few regressions), so I brought over a faster nmethod entry barrier that we use in the generational ZGC repo, which additionally handles concurrent patching of data and instructions, which is needed there.
However, I still see some small regressions. So for the uses in loom, the classic GCs don't really patch anything interesting concurrently. This leads to the following possible enhancements to improve the situation:
Make a dedicated nmethod entry barrier for GCs that don't patch data nor code concurrently, consisting of basically only a conditional branch. There is no need to penalize STW GCs with seat belts protecting against concurrent races that simply do not exist.
Move the "guard" word and call into the VM trampoline, to an out-of-line stub towards the end of the nmethod, ensuring instruction caches are not polluted by non-hot instructions at the nmethod entry. Some machines also better optimize the branch-not-taken path of conditional branches.
With these optimizations, the small regressions did go away.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/9574/head:pull/9574
$ git checkout pull/9574
Update a local copy of the PR:
$ git checkout pull/9574
$ git pull https://git.openjdk.org/jdk pull/9574/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 9574
View PR using the GUI difftool:
$ git pr show -t 9574
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/9574.diff