[13] RFR (S): 8223171: Redundant nmethod dependencies for effectively final methods

Vladimir Ivanov vladimir.x.ivanov at oracle.com
Wed May 1 16:52:16 UTC 2019


> Does this allow us to assert !uniqm->can_be_statically_bound() in 
> Dependencies::assert_unique_concrete_method?

In general, no. It doesn't hold for final methods: dependency is still 
needed when context is broad enough, since an overriding method can be 
loaded in a different part of the hierarchy (under the same context 
class).

In case of the adjusted checks it's safe, since context == method holder 
when actual_receiver->is_final() == true.

    if (!callee->is_final_method() && !callee->is_private() && 
!actual_receiver->is_final()) {
       dependencies()->assert_unique_concrete_method(actual_receiver, 
cha_monomorphic_target);
     }

I refactored the patch a bit:
   http://cr.openjdk.java.net/~vlivanov/8223171/webrev.01/

>> Moreover, C2 does add dependencies for private methods.

I take it back. Earlier checks handle private methods. Only methods on 
final classes get redundant dependencies.

Best regards,
Vladimir Ivanov


More information about the hotspot-compiler-dev mailing list