src/hotspot/share/oops/klassVtable.cpp
changeset 50735 2f2af62dfac7
parent 50036 e0dbf14885b8
child 51096 695dff91a997
equal deleted inserted replaced
50734:0828a0f6676b 50735:2f2af62dfac7
  1120 
  1120 
  1121 
  1121 
  1122 inline bool interface_method_needs_itable_index(Method* m) {
  1122 inline bool interface_method_needs_itable_index(Method* m) {
  1123   if (m->is_static())           return false;   // e.g., Stream.empty
  1123   if (m->is_static())           return false;   // e.g., Stream.empty
  1124   if (m->is_initializer())      return false;   // <init> or <clinit>
  1124   if (m->is_initializer())      return false;   // <init> or <clinit>
  1125   if (m->is_private())          return false;   // requires invokeSpecial
  1125   if (m->is_private())          return false;   // uses direct call
  1126   // If an interface redeclares a method from java.lang.Object,
  1126   // If an interface redeclares a method from java.lang.Object,
  1127   // it should already have a vtable index, don't touch it.
  1127   // it should already have a vtable index, don't touch it.
  1128   // e.g., CharSequence.toString (from initialize_vtable)
  1128   // e.g., CharSequence.toString (from initialize_vtable)
  1129   // if (m->has_vtable_index())  return false; // NO!
  1129   // if (m->has_vtable_index())  return false; // NO!
  1130   return true;
  1130   return true;
  1209   for (int i = 0; i < nof_methods; i++) {
  1209   for (int i = 0; i < nof_methods; i++) {
  1210     Method* m = methods->at(i);
  1210     Method* m = methods->at(i);
  1211     methodHandle target;
  1211     methodHandle target;
  1212     if (m->has_itable_index()) {
  1212     if (m->has_itable_index()) {
  1213       // This search must match the runtime resolution, i.e. selection search for invokeinterface
  1213       // This search must match the runtime resolution, i.e. selection search for invokeinterface
  1214       // to correctly enforce loader constraints for interface method inheritance
  1214       // to correctly enforce loader constraints for interface method inheritance.
  1215       target = LinkResolver::lookup_instance_method_in_klasses(_klass, m->name(), m->signature(), CHECK);
  1215       // Private methods are skipped as a private class method can never be the implementation
       
  1216       // of an interface method.
       
  1217       // Invokespecial does not perform selection based on the receiver, so it does not use
       
  1218       // the cached itable.
       
  1219       target = LinkResolver::lookup_instance_method_in_klasses(_klass, m->name(), m->signature(),
       
  1220                                                                Klass::skip_private, CHECK);
  1216     }
  1221     }
  1217     if (target == NULL || !target->is_public() || target->is_abstract() || target->is_overpass()) {
  1222     if (target == NULL || !target->is_public() || target->is_abstract() || target->is_overpass()) {
  1218       assert(target == NULL || !target->is_overpass() || target->is_public(),
  1223       assert(target == NULL || !target->is_overpass() || target->is_public(),
  1219              "Non-public overpass method!");
  1224              "Non-public overpass method!");
  1220       // Entry does not resolve. Leave it empty for AbstractMethodError or other error.
  1225       // Entry does not resolve. Leave it empty for AbstractMethodError or other error.