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

Jamsheed C m jamsheed.c.m at oracle.com
Tue Jan 31 10:25:39 UTC 2017


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