RFR: 8368465: [leyden] Improve precompiler method selection code [v3]

Vladimir Kozlov kvn at openjdk.org
Fri Oct 17 17:22:46 UTC 2025


On Fri, 17 Oct 2025 07:04:26 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> Forked from [JDK-8366681](https://bugs.openjdk.org/browse/JDK-8366681): there are still some cleanups/performance improvements possible. Current selection code is a bit hairy, and turns out the changes I made for previous patch improve performance.
>> 
>> Notable improvements:
>>  1. Push the compilation level filters downwards. This allows compiling A2 from T2/T3 code more easily, and allows to implement policies for compiling on any A* level based on observing top-compiled T* levels.
>>  2. Sort methods by hotness and code size. This looks to have a positive effect on shorter workloads, I suspect because we are avoiding a lot of C1 compilations by preloading hottest code first.
>> 
>> Additional testing:
>>  - [x] 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 five additional commits since the last revision:
> 
>  - Merge branch 'premain' into JDK-8368465-precompiler-method-select
>  - Merge branch 'premain' into JDK-8368465-precompiler-method-select
>  - Touchup
>  - Touchups
>  - Fix

Few questions

src/hotspot/share/compiler/precompiler.cpp line 76:

> 74:       case CompLevel_full_profile:
> 75:         // We do not include C1 full profiled methods at this time.
> 76:         // TODO: See if it is profitable to do so. This requires MDO support in AOTCache.

We already support reference to MDO from C1 compiled code because we cache tier2 which do profiling.
But we may miss few places in tier3 code.

src/hotspot/share/compiler/precompiler.cpp line 124:

> 122:       MethodData* md = mtd->final_profile();
> 123:       if (md != nullptr) {
> 124:         count += md->backedge_count();

Hmm, this will put methods with hot loop up front.

src/hotspot/share/compiler/precompiler.cpp line 143:

> 141:     if (c1 < c2) return +1;
> 142: 
> 143:     // Otherwise, break the tie by code size: largest methods go first.

What is the reason for larger method be first? Can we use compile ID here instead?

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

PR Review: https://git.openjdk.org/leyden/pull/99#pullrequestreview-3351199210
PR Review Comment: https://git.openjdk.org/leyden/pull/99#discussion_r2440650794
PR Review Comment: https://git.openjdk.org/leyden/pull/99#discussion_r2440657543
PR Review Comment: https://git.openjdk.org/leyden/pull/99#discussion_r2440660187


More information about the leyden-dev mailing list