RFR: 8170455: C2: Access to [].clone from interfaces fails

Vladimir Ivanov vladimir.x.ivanov at oracle.com
Mon Feb 6 13:52:51 UTC 2017


> revised webrev: http://cr.openjdk.java.net/~jcm/8170455/webrev.01/

Looks good.

Best regards,
Vladimir Ivanov

> On 1/31/2017 3:55 PM, Jamsheed C m wrote:
>> Hi,
>>
>> Array type are treated as Object type in Compiler  (see [1]) and
>> lookup happens in Object Class in compiler interface. This used to
>> work before default method got introduced. with default methods
>> protected Object methods are inaccessible from interface , so lookup
>> fails,   caller method always deopt as unloaded and decompile in C2.
>> This causes considerable degradation in performance.
>>
>> Fix: array types are directly passed to lookup code(fix), all other
>> code is kept as it is.
>>
>> bug id: https://bugs.openjdk.java.net/browse/JDK-8170455
>>
>> webrev:  http://cr.openjdk.java.net/~jcm/8170455/webrev.00/
>>
>> Best Regards,
>>
>> Jamsheed
>>
>> [1]
>>
>> ciInstanceKlass*
>> ciEnv::get_instance_klass_for_declared_method_holder(ciKlass*
>> method_holder) {
>>   // For the case of <array>.clone(), the method holder can be a
>> ciArrayKlass
>>   // instead of a ciInstanceKlass.  For that case simply pretend that the
>>   // declared holder is Object.clone since that's where the call will
>> bottom out.
>>   // A more correct fix would trickle out through many interfaces in CI,
>>   // requiring ciInstanceKlass* to become ciKlass* and many more
>> places would
>>   // require checks to make sure the expected type was found. Given
>> that this
>>   // only occurs for clone() the more extensive fix seems like
>> overkill so
>>   // instead we simply smear the array type into Object.
>>
>>
>>
>>
>>
>


More information about the hotspot-compiler-dev mailing list