RFR: 8339299: C1 will miss type profile when inline final method

Vladimir Ivanov vlivanov at openjdk.org
Fri Aug 30 22:31:24 UTC 2024


On Fri, 30 Aug 2024 07:25:59 GMT, kuaiwei <duke at openjdk.org> wrote:

> I found sometimes C1 will miss type profile and I tried to write a test to demonstrate it.
> It will happen with these conditions
> 1 It's a virtual call and the callee is a final method. So c1 will think it's static bound.
> 2 The interpreter never touch the callsite, so interpreter does not add type profile.
> 3 In c1 compilation, it will be inlined based on CHA.
> 4 In c2 compilation, the CHA is broken, but type profile is missing, so c2 can not inline it.

test/hotspot/jtreg/compiler/cha/TypeProfileFinalMethod.java line 43:

> 41: public class TypeProfileFinalMethod {
> 42:     public static void main(String[] args) throws Exception {
> 43:         if (args.length == 1 && args[0].equals("Run")) {

Instead of a check at runtime, you can introduce a separate class which drives test logic. Take a look at `compiler/jsr292/MHInlineTest.java` for an example (or grep for `class Launcher` under `test/hotspot/jtreg`).

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20786#discussion_r1739478622


More information about the hotspot-compiler-dev mailing list