RFR: 8267807: C2: Downcast receiver to target holder during inlining

Roland Westrelin roland at openjdk.java.net
Thu May 27 08:27:06 UTC 2021


On Wed, 26 May 2021 17:58:52 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:

> Virtual method calls involve an implicit subtype check against callee holder. 
> But if receiver type is too broad, it has to be narrowed before parsing the callee method.
> Otherwise, it may cause problems during parsing and currently it simply blocks inlining. 
> 
> Proposed fix implements the narrowing step and re-enables inlining.
> 
> Testing:
> - [x] hs-tier1 - hs-tier9

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

> 1136:     bool is_interface_holder = cha_monomorphic_target->holder()->is_interface();
> 1137:     if (has_receiver && !is_interface_holder) {
> 1138:       if (!cha_monomorphic_target->holder()->is_subtype_of(receiver_type->klass())) {

Given we can't trust interface types, shouldn't we test for receiver_type not an interface here?

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

PR: https://git.openjdk.java.net/jdk/pull/4212


More information about the hotspot-compiler-dev mailing list