881 assert(nof_methods > 0, "at least one method must exist for interface to be in vtable"); |
881 assert(nof_methods > 0, "at least one method must exist for interface to be in vtable"); |
882 Handle interface_loader (THREAD, instanceKlass::cast(interf_h())->class_loader()); |
882 Handle interface_loader (THREAD, instanceKlass::cast(interf_h())->class_loader()); |
883 int ime_num = 0; |
883 int ime_num = 0; |
884 |
884 |
885 // Skip first methodOop if it is a class initializer |
885 // Skip first methodOop if it is a class initializer |
886 int i = ((methodOop)methods()->obj_at(0))->name() != vmSymbols::class_initializer_name() ? 0 : 1; |
886 int i = ((methodOop)methods()->obj_at(0))->is_static_initializer() ? 1 : 0; |
887 |
887 |
888 // m, method_name, method_signature, klass reset each loop so they |
888 // m, method_name, method_signature, klass reset each loop so they |
889 // don't need preserving across check_signature_loaders call |
889 // don't need preserving across check_signature_loaders call |
890 // methods needs a handle in case of gc from check_signature_loaders |
890 // methods needs a handle in case of gc from check_signature_loaders |
891 for(; i < nof_methods; i++) { |
891 for(; i < nof_methods; i++) { |
1119 while(methods->obj_at(index) != m) { |
1119 while(methods->obj_at(index) != m) { |
1120 index++; |
1120 index++; |
1121 assert(index < methods->length(), "should find index for resolve_invoke"); |
1121 assert(index < methods->length(), "should find index for resolve_invoke"); |
1122 } |
1122 } |
1123 // Adjust for <clinit>, which is left out of table if first method |
1123 // Adjust for <clinit>, which is left out of table if first method |
1124 if (methods->length() > 0 && ((methodOop)methods->obj_at(0))->name() == vmSymbols::class_initializer_name()) { |
1124 if (methods->length() > 0 && ((methodOop)methods->obj_at(0))->is_static_initializer()) { |
1125 index--; |
1125 index--; |
1126 } |
1126 } |
1127 return index; |
1127 return index; |
1128 } |
1128 } |
1129 |
1129 |
1133 assert(instanceKlass::cast(intf)->is_interface(), "sanity check"); |
1133 assert(instanceKlass::cast(intf)->is_interface(), "sanity check"); |
1134 objArrayOop methods = instanceKlass::cast(intf)->methods(); |
1134 objArrayOop methods = instanceKlass::cast(intf)->methods(); |
1135 |
1135 |
1136 int index = itable_index; |
1136 int index = itable_index; |
1137 // Adjust for <clinit>, which is left out of table if first method |
1137 // Adjust for <clinit>, which is left out of table if first method |
1138 if (methods->length() > 0 && ((methodOop)methods->obj_at(0))->name() == vmSymbols::class_initializer_name()) { |
1138 if (methods->length() > 0 && ((methodOop)methods->obj_at(0))->is_static_initializer()) { |
1139 index++; |
1139 index++; |
1140 } |
1140 } |
1141 |
1141 |
1142 if (itable_index < 0 || index >= methods->length()) |
1142 if (itable_index < 0 || index >= methods->length()) |
1143 return NULL; // help caller defend against bad indexes |
1143 return NULL; // help caller defend against bad indexes |