JDK-8372285 : G1: Micro-optimize x86 barrier code
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 25,26
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2025-11-20
  • Updated: 2025-11-21
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Relates :  
Description
I noticed in disassembly for G1 barriers that we have are missing a few easy things for code density in our hand-written assembly for G1 barriers:
 *) cmpptr(reg, 0) -> testptr(reg, reg)
 *) jcc -> jccb for forward branches, where obvious
 *) jmp -> jmpb for forward jumps, where obvious

A simple patch already gives me about 1.2% savings even without compiling a lot of code.

for I in `seq 1 3`; do build/linux-x86_64-server-release/images/jdk/bin/java -Xcomp -XX:+CITime 2>&1 | grep "nmethod code"; done 

# Before
  nmethod code size         :  5764304 bytes
  nmethod code size         :  5764336 bytes
  nmethod code size         :  5764480 bytes

# After
  nmethod code size         :  5691032 bytes
  nmethod code size         :  5691032 bytes
  nmethod code size         :  5691000 bytes
Comments
A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/28446 Date: 2025-11-21 09:06:54 +0000
21-11-2025