RFR: 8366681: [leyden] Precompile more C1 code [v2]
Aleksey Shipilev
shade at openjdk.org
Wed Sep 3 10:18:38 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`
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 two additional commits since the last revision:
- Merge branch 'premain' into JDK-8366681-precompile-more-c1
- Fix
-------------
Changes:
- all: https://git.openjdk.org/leyden/pull/93/files
- new: https://git.openjdk.org/leyden/pull/93/files/0bdea338..fe24290f
Webrevs:
- full: https://webrevs.openjdk.org/?repo=leyden&pr=93&range=01
- incr: https://webrevs.openjdk.org/?repo=leyden&pr=93&range=00-01
Stats: 114 lines in 9 files changed: 36 ins; 30 del; 48 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