RFR: 8348855: G1: Implement G1BarrierSetC2::estimate_stub_size

Aleksey Shipilev shade at openjdk.org
Tue Jan 28 15:37:02 UTC 2025


We run into peculiar problem in Leyden: due to current prototype limitation, we cannot yet store the generated code that has the expanded code buffer. The code buffer expansion routinely happens with late G1 barrier expansion, as `G1BarrierSetC2` does not report any estimate for stub sizes.

So a method rich in these G1 stubs would blow the initial code size estimate, force the buffer resize, and thus disqualify itself from storing C2 code in Leyden. Whoops. Fortunately, we just need to implement `G1BarrierSetC2::estimate_stub_size()` in mainline to avoid a significant part of this problem. 

I also fixed the misattribution of "stub" sizes in insn section, this part is also important to get the stub sizes right. I can do that separately, but it would only matter for ZGC without G1 stub size estimation implemented.

You can see the impact it has on Leyden here:
https://github.com/openjdk/leyden/pull/28#issuecomment-2619077625

Additional testing:
 - [ ] Linux x86_64 server fastdebug, `all`
 - [ ] Linux AArch64 server fastdebug, `all`

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

Commit messages:
 - Fix

Changes: https://git.openjdk.org/jdk/pull/23333/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=23333&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8348855
  Stats: 21 lines in 3 files changed: 20 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/23333.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/23333/head:pull/23333

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


More information about the hotspot-dev mailing list