RFR: 8373633: C2: Use interface receiver type to improve CHA decisions
Damon Fenacci
dfenacci at openjdk.org
Mon Jan 5 09:08:02 UTC 2026
On Sat, 13 Dec 2025 02:01:10 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:
> Strength-reducing an interface call to a virtual call for interfaces with
> unique implementors can use receiver type information to narrow the context.
>
> C2 tracks interface types and receiver type information can be used to reveal
> an interface with a unique implementor which can't be derived from the call
> site itself.
>
> Since C2 effectively accumulates a union interface type from multiple subtype checks, iterating over individual components of a type may reveal a candidate for a strength-reduction. The only prerequisite is that a candidate has to be a subtype of the declared interface.
>
> Testing: hs-tier1 - hs-tier5
src/hotspot/share/opto/doCall.cpp line 340:
> 338: // number of implementors for decl_interface is 0 or 1. If
> 339: // it's 0 then no class implements decl_interface and there's
> 340: // no point in inlining.
Does the above comment still hold? Or did you remove it because it is not relevant anymore?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28811#discussion_r2640468378
More information about the hotspot-compiler-dev
mailing list