1.1 --- a/src/share/vm/code/dependencies.cpp Mon Dec 01 19:09:54 2014 -0800 1.2 +++ b/src/share/vm/code/dependencies.cpp Fri Dec 12 14:39:40 2014 -0800 1.3 @@ -879,6 +879,8 @@ 1.4 bool is_witness(Klass* k) { 1.5 if (doing_subtype_search()) { 1.6 return Dependencies::is_concrete_klass(k); 1.7 + } else if (!k->oop_is_instance()) { 1.8 + return false; // no methods to find in an array type 1.9 } else { 1.10 // Search class hierarchy first. 1.11 Method* m = InstanceKlass::cast(k)->find_instance_method(_name, _signature); 1.12 @@ -1094,7 +1096,7 @@ 1.13 Klass* chain; // scratch variable 1.14 #define ADD_SUBCLASS_CHAIN(k) { \ 1.15 assert(chaini < CHAINMAX, "oob"); \ 1.16 - chain = InstanceKlass::cast(k)->subklass(); \ 1.17 + chain = k->subklass(); \ 1.18 if (chain != NULL) chains[chaini++] = chain; } 1.19 1.20 // Look for non-abstract subclasses. 1.21 @@ -1105,35 +1107,37 @@ 1.22 // (Their subclasses are additional indirect implementors. 1.23 // See InstanceKlass::add_implementor.) 1.24 // (Note: nof_implementors is always zero for non-interfaces.) 1.25 - int nof_impls = InstanceKlass::cast(context_type)->nof_implementors(); 1.26 - if (nof_impls > 1) { 1.27 - // Avoid this case: *I.m > { A.m, C }; B.m > C 1.28 - // Here, I.m has 2 concrete implementations, but m appears unique 1.29 - // as A.m, because the search misses B.m when checking C. 1.30 - // The inherited method B.m was getting missed by the walker 1.31 - // when interface 'I' was the starting point. 1.32 - // %%% Until this is fixed more systematically, bail out. 1.33 - // (Old CHA had the same limitation.) 1.34 - return context_type; 1.35 - } 1.36 - if (nof_impls > 0) { 1.37 - Klass* impl = InstanceKlass::cast(context_type)->implementor(); 1.38 - assert(impl != NULL, "just checking"); 1.39 - // If impl is the same as the context_type, then more than one 1.40 - // implementor has seen. No exact info in this case. 1.41 - if (impl == context_type) { 1.42 - return context_type; // report an inexact witness to this sad affair 1.43 + if (top_level_call) { 1.44 + int nof_impls = InstanceKlass::cast(context_type)->nof_implementors(); 1.45 + if (nof_impls > 1) { 1.46 + // Avoid this case: *I.m > { A.m, C }; B.m > C 1.47 + // Here, I.m has 2 concrete implementations, but m appears unique 1.48 + // as A.m, because the search misses B.m when checking C. 1.49 + // The inherited method B.m was getting missed by the walker 1.50 + // when interface 'I' was the starting point. 1.51 + // %%% Until this is fixed more systematically, bail out. 1.52 + // (Old CHA had the same limitation.) 1.53 + return context_type; 1.54 } 1.55 - if (do_counts) 1.56 - { NOT_PRODUCT(deps_find_witness_steps++); } 1.57 - if (is_participant(impl)) { 1.58 - if (!participants_hide_witnesses) { 1.59 + if (nof_impls > 0) { 1.60 + Klass* impl = InstanceKlass::cast(context_type)->implementor(); 1.61 + assert(impl != NULL, "just checking"); 1.62 + // If impl is the same as the context_type, then more than one 1.63 + // implementor has seen. No exact info in this case. 1.64 + if (impl == context_type) { 1.65 + return context_type; // report an inexact witness to this sad affair 1.66 + } 1.67 + if (do_counts) 1.68 + { NOT_PRODUCT(deps_find_witness_steps++); } 1.69 + if (is_participant(impl)) { 1.70 + if (!participants_hide_witnesses) { 1.71 + ADD_SUBCLASS_CHAIN(impl); 1.72 + } 1.73 + } else if (is_witness(impl) && !ignore_witness(impl)) { 1.74 + return impl; 1.75 + } else { 1.76 ADD_SUBCLASS_CHAIN(impl); 1.77 } 1.78 - } else if (is_witness(impl) && !ignore_witness(impl)) { 1.79 - return impl; 1.80 - } else { 1.81 - ADD_SUBCLASS_CHAIN(impl); 1.82 } 1.83 } 1.84