RFR: 8325681: C2 inliner rejects to inline a deeper callee because the methoddata of caller is immature.

ExE Boss duke at openjdk.org
Fri Feb 23 09:31:53 UTC 2024


On Thu, 22 Feb 2024 05:37:26 GMT, Xin Liu <xliu at openjdk.org> wrote:

> This patch uses the methoddata of a method no matter it is mature or not to initialize `ciCallProfile`. Previously, C2 drops premature methoddata and leaves _count field of ciCallProfile -1. This leads C2 refuses to inline the callsite because its frequency is too low(-1 < MinInlineFrequencyRatio).  
> 
> In the given example, we observes that baz was not inlined because of 'low call site frequency'.  This is wrong because its real frequency is 10% > MinInlineFrequencyRatio. 
> 
> 
> 60 13 b 4 UnderProfiledSubprocedure::foo (9 bytes)
>                               @ 5 UnderProfiledSubprocedure::bar (6 bytes) inline (hot)
>                                 @ 1 UnderProfiledSubprocedure::baz (19 bytes) failed to inline: low call site frequency

test/hotspot/jtreg/compiler/c2/irTests/TestUnderProfiledSubprocedure.java line 78:

> 76:     }
> 77: 
> 78:     // method baz must be greater than 6 bytecodes(MaxTrivialSize), or it will be inlined as a trivia

Suggestion:

    // method baz must be greater than 6 bytecodes(MaxTrivialSize), or it will be inlined as a trivial

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17957#discussion_r1500405113


More information about the hotspot-compiler-dev mailing list