RFR: 8290700: Optimize AArch64 nmethod entry barriers [v3]

Erik Österlund eosterlund at openjdk.org
Fri Jul 22 15:09:13 UTC 2022


> 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: 
> 
> 1. 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.
> 
> 2. 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.

Erik Österlund has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains six commits:

 - Merge branch 'master' into 8290700_faster_aarch64_entry_barriers
 - 8290700: Optimize AArch64 nmethod entry barriers
 - fixing 32 bit build again
 - fix 32 bit build again
 - 32 bit build fix
 - Optimize x86 nmethod entry barriers

-------------

Changes: https://git.openjdk.org/jdk/pull/9574/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=9574&range=02
  Stats: 179 lines in 14 files changed: 121 ins; 22 del; 36 mod
  Patch: https://git.openjdk.org/jdk/pull/9574.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/9574/head:pull/9574

PR: https://git.openjdk.org/jdk/pull/9574


More information about the shenandoah-dev mailing list