RFR: 8290688: Optimize x86_64 nmethod entry barriers [v2]
Erik Österlund
eosterlund at openjdk.org
Wed Jul 20 12:16:36 UTC 2022
> The current x86_64 nmethod entry barrier is good, but it could be a bit better. In particular, this enhancement targets the following ideas.
>
> 1. The alignment of the cmp instruction is 8 bytes. However, we only patch 4 bytes and the instruction length is always 8 bytes. So if we align the start of the instruction to 4 bytes only, that is enough to ensure that the immediate part of the instruction is 4 byte aligned, which is all we need (cf. http://cr.openjdk.java.net/~jrose/jvm/hotspot-cmc.html).
>
> 2. Today the fast path (conditionally) jumps over a call to a stub. It is not uncommon for the branch not taken path being better optimized, making it favourable to move the call to a stub out-of-line. This has the additional benefit of not polluting the instruction caches at the nmethod entry with instructions not used in the fast path. A bit messy but we can do it for at least C2 code.
>
> 3. For C1 and native wrappers, I don't think they are hot enough to warrant the stub machinery. But at least the jump that jumps over the cold stuff, can be shortened. I can get behind that.
>
> Before addressing this, turning nmethod entry barriers on with G1 (e.g. by enabling loom) leads to a regression in DaCapo tradesoap-large. With this enhancement, the regression goes away, so that the cost of nmethod entry barriers is not visible.
Erik Österlund has updated the pull request incrementally with one additional commit since the last revision:
32 bit build fix
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/9569/files
- new: https://git.openjdk.org/jdk/pull/9569/files/2e8dd854..a71e4ae7
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=9569&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=9569&range=00-01
Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/9569.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/9569/head:pull/9569
PR: https://git.openjdk.org/jdk/pull/9569
More information about the hotspot-dev
mailing list