src/hotspot/share/oops/klassVtable.cpp
changeset 48819 ee513596f3ee
parent 48608 1dab70e20292
parent 48794 ea0d0781c63c
child 49359 59f6547e151f
equal deleted inserted replaced
48818:ec4a84ba2aaf 48819:ee513596f3ee
  1198 
  1198 
  1199 void klassItable::initialize_itable_for_interface(int method_table_offset, Klass* interf, bool checkconstraints, TRAPS) {
  1199 void klassItable::initialize_itable_for_interface(int method_table_offset, Klass* interf, bool checkconstraints, TRAPS) {
  1200   Array<Method*>* methods = InstanceKlass::cast(interf)->methods();
  1200   Array<Method*>* methods = InstanceKlass::cast(interf)->methods();
  1201   int nof_methods = methods->length();
  1201   int nof_methods = methods->length();
  1202   HandleMark hm;
  1202   HandleMark hm;
  1203   assert(nof_methods > 0, "at least one method must exist for interface to be in vtable");
       
  1204   Handle interface_loader (THREAD, InstanceKlass::cast(interf)->class_loader());
  1203   Handle interface_loader (THREAD, InstanceKlass::cast(interf)->class_loader());
  1205 
  1204 
  1206   int ime_count = method_count_for_interface(interf);
  1205   int ime_count = method_count_for_interface(interf);
  1207   for (int i = 0; i < nof_methods; i++) {
  1206   for (int i = 0; i < nof_methods; i++) {
  1208     Method* m = methods->at(i);
  1207     Method* m = methods->at(i);
  1367           method_count++;
  1366           method_count++;
  1368         }
  1367         }
  1369       }
  1368       }
  1370     }
  1369     }
  1371 
  1370 
  1372     // Only count interfaces with at least one method
  1371     // Visit all interfaces which either have any methods or can participate in receiver type check.
  1373     if (method_count > 0) {
  1372     // We do not bother to count methods in transitive interfaces, although that would allow us to skip
       
  1373     // this step in the rare case of a zero-method interface extending another zero-method interface.
       
  1374     if (method_count > 0 || InstanceKlass::cast(intf)->transitive_interfaces()->length() > 0) {
  1374       blk->doit(intf, method_count);
  1375       blk->doit(intf, method_count);
  1375     }
  1376     }
  1376   }
  1377   }
  1377 }
  1378 }
  1378 
  1379