RFR: 8280469: C2: CHA support for interface calls when inlining through method handle linker

Chen Liang liach at openjdk.org
Fri Oct 31 22:36:02 UTC 2025


On Fri, 31 Oct 2025 21:34:27 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:

> Expand the optimization for interface calls introduced by [JDK-6986483](https://bugs.openjdk.org/browse/JDK-6986483) to calls through `MethodHandle.linkToInterface`.
> 
> The implementation is straightforward except the fact that symbolic information is lost during `MemberName` resolution. The fix uses declaring class instead, but it's more conservative than what is done for invokeinterface case.  
> 
> Testing: hs-tier1 - hs-tier5

A small improvement indeed. I wonder if the test verifies the `declared_interface` for the new monomorphic target - I don't see where it does so, yet I believe this may be error-prone.

src/hotspot/share/opto/doCall.cpp line 345:

> 343:       if (orig_callee->intrinsic_id() == vmIntrinsics::_linkToInterface) {
> 344:         // MemberName doesn't keep symbolic information once resolution is over, but
> 345:         // resolved method holder can be used as a conservative approximation.

Is "symbolic information" the referenced interface and the "resolved method holder" the declaring interface? I think including "referenced" vs "declared" would be more clear.

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

PR Review: https://git.openjdk.org/jdk/pull/28094#pullrequestreview-3406367769
PR Review Comment: https://git.openjdk.org/jdk/pull/28094#discussion_r2482808203


More information about the hotspot-compiler-dev mailing list