Mercurial > hg > truffle
comparison src/share/vm/code/dependencies.cpp @ 21826:41c3c456e326 jdk8u45-b01
Merge
author | asaha |
---|---|
date | Fri, 12 Dec 2014 14:39:40 -0800 |
parents | d5b74c583ec1 bee8095780db |
children | 7622232b7efa |
comparison
equal
deleted
inserted
replaced
21825:d6a05415f1f4 | 21826:41c3c456e326 |
---|---|
877 } | 877 } |
878 | 878 |
879 bool is_witness(Klass* k) { | 879 bool is_witness(Klass* k) { |
880 if (doing_subtype_search()) { | 880 if (doing_subtype_search()) { |
881 return Dependencies::is_concrete_klass(k); | 881 return Dependencies::is_concrete_klass(k); |
882 } else if (!k->oop_is_instance()) { | |
883 return false; // no methods to find in an array type | |
882 } else { | 884 } else { |
883 // Search class hierarchy first. | 885 // Search class hierarchy first. |
884 Method* m = InstanceKlass::cast(k)->find_instance_method(_name, _signature); | 886 Method* m = InstanceKlass::cast(k)->find_instance_method(_name, _signature); |
885 if (!Dependencies::is_concrete_method(m, k)) { | 887 if (!Dependencies::is_concrete_method(m, k)) { |
886 // Check interface defaults also, if any exist. | 888 // Check interface defaults also, if any exist. |
1092 Klass* chains[CHAINMAX]; | 1094 Klass* chains[CHAINMAX]; |
1093 int chaini = 0; // index into worklist | 1095 int chaini = 0; // index into worklist |
1094 Klass* chain; // scratch variable | 1096 Klass* chain; // scratch variable |
1095 #define ADD_SUBCLASS_CHAIN(k) { \ | 1097 #define ADD_SUBCLASS_CHAIN(k) { \ |
1096 assert(chaini < CHAINMAX, "oob"); \ | 1098 assert(chaini < CHAINMAX, "oob"); \ |
1097 chain = InstanceKlass::cast(k)->subklass(); \ | 1099 chain = k->subklass(); \ |
1098 if (chain != NULL) chains[chaini++] = chain; } | 1100 if (chain != NULL) chains[chaini++] = chain; } |
1099 | 1101 |
1100 // Look for non-abstract subclasses. | 1102 // Look for non-abstract subclasses. |
1101 // (Note: Interfaces do not have subclasses.) | 1103 // (Note: Interfaces do not have subclasses.) |
1102 ADD_SUBCLASS_CHAIN(context_type); | 1104 ADD_SUBCLASS_CHAIN(context_type); |
1103 | 1105 |
1104 // If it is an interface, search its direct implementors. | 1106 // If it is an interface, search its direct implementors. |
1105 // (Their subclasses are additional indirect implementors. | 1107 // (Their subclasses are additional indirect implementors. |
1106 // See InstanceKlass::add_implementor.) | 1108 // See InstanceKlass::add_implementor.) |
1107 // (Note: nof_implementors is always zero for non-interfaces.) | 1109 // (Note: nof_implementors is always zero for non-interfaces.) |
1108 int nof_impls = InstanceKlass::cast(context_type)->nof_implementors(); | 1110 if (top_level_call) { |
1109 if (nof_impls > 1) { | 1111 int nof_impls = InstanceKlass::cast(context_type)->nof_implementors(); |
1110 // Avoid this case: *I.m > { A.m, C }; B.m > C | 1112 if (nof_impls > 1) { |
1111 // Here, I.m has 2 concrete implementations, but m appears unique | 1113 // Avoid this case: *I.m > { A.m, C }; B.m > C |
1112 // as A.m, because the search misses B.m when checking C. | 1114 // Here, I.m has 2 concrete implementations, but m appears unique |
1113 // The inherited method B.m was getting missed by the walker | 1115 // as A.m, because the search misses B.m when checking C. |
1114 // when interface 'I' was the starting point. | 1116 // The inherited method B.m was getting missed by the walker |
1115 // %%% Until this is fixed more systematically, bail out. | 1117 // when interface 'I' was the starting point. |
1116 // (Old CHA had the same limitation.) | 1118 // %%% Until this is fixed more systematically, bail out. |
1117 return context_type; | 1119 // (Old CHA had the same limitation.) |
1118 } | 1120 return context_type; |
1119 if (nof_impls > 0) { | 1121 } |
1120 Klass* impl = InstanceKlass::cast(context_type)->implementor(); | 1122 if (nof_impls > 0) { |
1121 assert(impl != NULL, "just checking"); | 1123 Klass* impl = InstanceKlass::cast(context_type)->implementor(); |
1122 // If impl is the same as the context_type, then more than one | 1124 assert(impl != NULL, "just checking"); |
1123 // implementor has seen. No exact info in this case. | 1125 // If impl is the same as the context_type, then more than one |
1124 if (impl == context_type) { | 1126 // implementor has seen. No exact info in this case. |
1125 return context_type; // report an inexact witness to this sad affair | 1127 if (impl == context_type) { |
1126 } | 1128 return context_type; // report an inexact witness to this sad affair |
1127 if (do_counts) | 1129 } |
1128 { NOT_PRODUCT(deps_find_witness_steps++); } | 1130 if (do_counts) |
1129 if (is_participant(impl)) { | 1131 { NOT_PRODUCT(deps_find_witness_steps++); } |
1130 if (!participants_hide_witnesses) { | 1132 if (is_participant(impl)) { |
1133 if (!participants_hide_witnesses) { | |
1134 ADD_SUBCLASS_CHAIN(impl); | |
1135 } | |
1136 } else if (is_witness(impl) && !ignore_witness(impl)) { | |
1137 return impl; | |
1138 } else { | |
1131 ADD_SUBCLASS_CHAIN(impl); | 1139 ADD_SUBCLASS_CHAIN(impl); |
1132 } | 1140 } |
1133 } else if (is_witness(impl) && !ignore_witness(impl)) { | |
1134 return impl; | |
1135 } else { | |
1136 ADD_SUBCLASS_CHAIN(impl); | |
1137 } | 1141 } |
1138 } | 1142 } |
1139 | 1143 |
1140 // Recursively process each non-trivial sibling chain. | 1144 // Recursively process each non-trivial sibling chain. |
1141 while (chaini > 0) { | 1145 while (chaini > 0) { |