< prev index next >

src/hotspot/share/oops/klassVtable.cpp

Print this page
rev 55090 : secret-sfac


1088 
1089     // Iterate through all interfaces
1090     int i;
1091     for(i = 0; i < num_interfaces; i++) {
1092       itableOffsetEntry* ioe = offset_entry(i);
1093       HandleMark hm(THREAD);
1094       Klass* interf = ioe->interface_klass();
1095       assert(interf != NULL && ioe->offset() != 0, "bad offset entry in itable");
1096       initialize_itable_for_interface(ioe->offset(), InstanceKlass::cast(interf), checkconstraints, CHECK);
1097     }
1098 
1099   }
1100   // Check that the last entry is empty
1101   itableOffsetEntry* ioe = offset_entry(size_offset_table() - 1);
1102   guarantee(ioe->interface_klass() == NULL && ioe->offset() == 0, "terminator entry missing");
1103 }
1104 
1105 
1106 inline bool interface_method_needs_itable_index(Method* m) {
1107   if (m->is_static())           return false;   // e.g., Stream.empty
1108   if (m->is_initializer())      return false;   // <init> or <clinit>
1109   if (m->is_private())          return false;   // uses direct call


1110   // If an interface redeclares a method from java.lang.Object,
1111   // it should already have a vtable index, don't touch it.
1112   // e.g., CharSequence.toString (from initialize_vtable)
1113   // if (m->has_vtable_index())  return false; // NO!
1114   return true;
1115 }
1116 
1117 int klassItable::assign_itable_indices_for_interface(InstanceKlass* klass, TRAPS) {
1118   // an interface does not have an itable, but its methods need to be numbered
1119   ResourceMark rm(THREAD);
1120   log_develop_debug(itables)("%3d: Initializing itable indices for interface %s",
1121                              ++initialize_count, klass->name()->as_C_string());
1122   Array<Method*>* methods = klass->methods();
1123   int nof_methods = methods->length();
1124   int ime_num = 0;
1125   for (int i = 0; i < nof_methods; i++) {
1126     Method* m = methods->at(i);
1127     if (interface_method_needs_itable_index(m)) {
1128       assert(!m->is_final_method(), "no final interface methods");
1129       // If m is already assigned a vtable index, do not disturb it.




1088 
1089     // Iterate through all interfaces
1090     int i;
1091     for(i = 0; i < num_interfaces; i++) {
1092       itableOffsetEntry* ioe = offset_entry(i);
1093       HandleMark hm(THREAD);
1094       Klass* interf = ioe->interface_klass();
1095       assert(interf != NULL && ioe->offset() != 0, "bad offset entry in itable");
1096       initialize_itable_for_interface(ioe->offset(), InstanceKlass::cast(interf), checkconstraints, CHECK);
1097     }
1098 
1099   }
1100   // Check that the last entry is empty
1101   itableOffsetEntry* ioe = offset_entry(size_offset_table() - 1);
1102   guarantee(ioe->interface_klass() == NULL && ioe->offset() == 0, "terminator entry missing");
1103 }
1104 
1105 
1106 inline bool interface_method_needs_itable_index(Method* m) {
1107   if (m->is_static())             return false;   // e.g., Stream.empty

1108   if (m->is_private())            return false;   // uses direct call
1109   if (m->is_object_constructor()) return false;   // <init>(...)V
1110   if (m->is_class_initializer())  return false;   // <clinit>()V
1111   // If an interface redeclares a method from java.lang.Object,
1112   // it should already have a vtable index, don't touch it.
1113   // e.g., CharSequence.toString (from initialize_vtable)
1114   // if (m->has_vtable_index())  return false; // NO!
1115   return true;
1116 }
1117 
1118 int klassItable::assign_itable_indices_for_interface(InstanceKlass* klass, TRAPS) {
1119   // an interface does not have an itable, but its methods need to be numbered
1120   ResourceMark rm(THREAD);
1121   log_develop_debug(itables)("%3d: Initializing itable indices for interface %s",
1122                              ++initialize_count, klass->name()->as_C_string());
1123   Array<Method*>* methods = klass->methods();
1124   int nof_methods = methods->length();
1125   int ime_num = 0;
1126   for (int i = 0; i < nof_methods; i++) {
1127     Method* m = methods->at(i);
1128     if (interface_method_needs_itable_index(m)) {
1129       assert(!m->is_final_method(), "no final interface methods");
1130       // If m is already assigned a vtable index, do not disturb it.


< prev index next >