RFR: 8366681: [leyden] Precompile more C1 code

Aleksey Shipilev shade at openjdk.org
Tue Sep 2 10:45:25 UTC 2025


Looking at how code goes through AOT+JIT pipeline, I believe we have several issues in the way we include the methods for precompilation.

1. AP4 code gets replaced by more efficient A4 code, which can then deopt. Once it does, we go back to the fully normal JIT pipeline, with C1 compiling, C2 compiling, etc. Training run currently does A2 versions only when there is a tier2/3 training data present. We can pessimistically assume that A4/AP4 method should have A2 method generated for the sake of quicker deopt.

2. I suspect a similar thing, but rarer, happens with A4 -> ... -> T1 transition when compiler queues are overloaded. We can generate A1 method for this case.

3. When training is done with default configuration, but at runtime we enable only C1, we summarily miss almost *all* AOT methods, because A1 methods are rarely generated with a normal tiered policy. Generating A1 methods always would be convenient for hybrid C2 AOT + C1 JIT modes as well.

Overall, I think generating more C1 methods even when C2 methods are present in training is beneficial, as we prepare the ground for whatever corner case happens at runtime. Benchmarks show this improves performance model quite a bit. 

Since we now look at methods at all different tiers when deciding to precompile, compile IDs are not working all that well. I have rewritten that to use counters and method sizes. This seems to work well in practice.

Additional testing:
 - [x] `javac` performance tests (see comments)
 - [x] Linux x86_64 server fastdebug, `runtime/cds`

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

Commit messages:
 - Fix

Changes: https://git.openjdk.org/leyden/pull/93/files
  Webrev: https://webrevs.openjdk.org/?repo=leyden&pr=93&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8366681
  Stats: 121 lines in 4 files changed: 64 ins; 27 del; 30 mod
  Patch: https://git.openjdk.org/leyden/pull/93.diff
  Fetch: git fetch https://git.openjdk.org/leyden.git pull/93/head:pull/93

PR: https://git.openjdk.org/leyden/pull/93


More information about the leyden-dev mailing list