src/hotspot/share/oops/klassVtable.cpp
changeset 48557 2e867226b914
parent 47765 b7c7428eaab9
child 48608 1dab70e20292
equal deleted inserted replaced
48556:d44d912ea9bb 48557:2e867226b914
  1183 
  1183 
  1184 void klassItable::initialize_itable_for_interface(int method_table_offset, Klass* interf, bool checkconstraints, TRAPS) {
  1184 void klassItable::initialize_itable_for_interface(int method_table_offset, Klass* interf, bool checkconstraints, TRAPS) {
  1185   Array<Method*>* methods = InstanceKlass::cast(interf)->methods();
  1185   Array<Method*>* methods = InstanceKlass::cast(interf)->methods();
  1186   int nof_methods = methods->length();
  1186   int nof_methods = methods->length();
  1187   HandleMark hm;
  1187   HandleMark hm;
  1188   assert(nof_methods > 0, "at least one method must exist for interface to be in vtable");
       
  1189   Handle interface_loader (THREAD, InstanceKlass::cast(interf)->class_loader());
  1188   Handle interface_loader (THREAD, InstanceKlass::cast(interf)->class_loader());
  1190 
  1189 
  1191   int ime_count = method_count_for_interface(interf);
  1190   int ime_count = method_count_for_interface(interf);
  1192   for (int i = 0; i < nof_methods; i++) {
  1191   for (int i = 0; i < nof_methods; i++) {
  1193     Method* m = methods->at(i);
  1192     Method* m = methods->at(i);
  1352           method_count++;
  1351           method_count++;
  1353         }
  1352         }
  1354       }
  1353       }
  1355     }
  1354     }
  1356 
  1355 
  1357     // Only count interfaces with at least one method
  1356     // Visit all interfaces which either have any methods or can participate in receiver type check.
  1358     if (method_count > 0) {
  1357     // We do not bother to count methods in transitive interfaces, although that would allow us to skip
       
  1358     // this step in the rare case of a zero-method interface extending another zero-method interface.
       
  1359     if (method_count > 0 || InstanceKlass::cast(intf)->transitive_interfaces()->length() > 0) {
  1359       blk->doit(intf, method_count);
  1360       blk->doit(intf, method_count);
  1360     }
  1361     }
  1361   }
  1362   }
  1362 }
  1363 }
  1363 
  1364