RFR: 8372285: G1: Micro-optimize x86 barrier code [v5]

Aleksey Shipilev shade at openjdk.org
Mon Nov 24 09:45:14 UTC 2025


> We know from [JDK-8372284](https://bugs.openjdk.org/browse/JDK-8372284) that G1 C2 stubs can take ~10% of total instructions. So minor optimizations in hand-written assembly pay off for code density. This PR does a little x86-specific polishing: `testptr` where possible, short forward branches where possible. I rewired some code to make it abundantly clear the branches in question are short. It also makes clear that lots of the affected methods are essentially fall-through.
> 
> The patch is deliberately on simpler side, so we can backport it to 25u, if need arises.
> 
> Additional testing:
>  - [x] Linux x86_64 server fastdebug, `tier1`
>  - [ ]  Linux x86_64 server fastdebug, `all`

Aleksey Shipilev has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 15 additional commits since the last revision:

 - More label renames
 - Jump back to L_done without shortening branch
 - Indent comments
 - Rename labels
 - Merge branch 'master' into JDK-8372285-g1-barrier-micro
 - Adjust label name
 - Merge branch 'master' into JDK-8372285-g1-barrier-micro
 - Make some backward branches explicitly short
 - Comment
 - Shorten a few more branches
 - ... and 5 more: https://git.openjdk.org/jdk/compare/33fcc038...b4c98d88

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/28446/files
  - new: https://git.openjdk.org/jdk/pull/28446/files/c23bac46..b4c98d88

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=28446&range=04
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=28446&range=03-04

  Stats: 1556 lines in 19 files changed: 1169 ins; 205 del; 182 mod
  Patch: https://git.openjdk.org/jdk/pull/28446.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/28446/head:pull/28446

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


More information about the hotspot-dev mailing list