src/share/vm/oops/klassVtable.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/oops

src/share/vm/oops/klassVtable.cpp

Print this page




 259 // Private methods do not override and are not overridden.
 260 // Package Private methods are trickier:
 261 // e.g. P1.A, pub m
 262 // P2.B extends A, package private m
 263 // P1.C extends B, public m
 264 // P1.C.m needs to override P1.A.m and can not override P2.B.m
 265 // Therefore: all package private methods need their own vtable entries for
 266 // them to be the root of an inheritance overriding decision
 267 // Package private methods may also override other vtable entries
 268 InstanceKlass* klassVtable::find_transitive_override(InstanceKlass* initialsuper, methodHandle target_method,
 269                             int vtable_index, Handle target_loader, Symbol* target_classname, Thread * THREAD) {
 270   InstanceKlass* superk = initialsuper;
 271   while (superk != NULL && superk->super() != NULL) {
 272     InstanceKlass* supersuperklass = InstanceKlass::cast(superk->super());
 273     klassVtable* ssVtable = supersuperklass->vtable();
 274     if (vtable_index < ssVtable->length()) {
 275       Method* super_method = ssVtable->method_at(vtable_index);
 276 #ifndef PRODUCT
 277       Symbol* name= target_method()->name();
 278       Symbol* signature = target_method()->signature();
 279       assert(super_method->name() == name && super_method->signature() == signature, "vtable entry name/sig mismatch");
 280 #endif
 281       if (supersuperklass->is_override(super_method, target_loader, target_classname, THREAD)) {
 282 #ifndef PRODUCT
 283         if (PrintVtables && Verbose) {
 284           ResourceMark rm(THREAD);
 285           char* sig = target_method()->name_and_sig_as_C_string();
 286           tty->print("transitive overriding superclass %s with %s::%s index %d, original flags: ",
 287            supersuperklass->internal_name(),
 288            _klass->internal_name(), sig, vtable_index);
 289            super_method->access_flags().print_on(tty);
 290            if (super_method->is_default_method()) {
 291              tty->print("default ");
 292            }
 293            tty->print("overriders flags: ");
 294            target_method->access_flags().print_on(tty);
 295            if (target_method->is_default_method()) {
 296              tty->print("default ");
 297            }
 298         }
 299 #endif /*PRODUCT*/


 325   Array<int>* def_vtable_indices = NULL;
 326   bool is_default = false;
 327   // default methods are concrete methods in superinterfaces which are added to the vtable
 328   // with their real method_holder
 329   // Since vtable and itable indices share the same storage, don't touch
 330   // the default method's real vtable/itable index
 331   // default_vtable_indices stores the vtable value relative to this inheritor
 332   if (default_index >= 0 ) {
 333     is_default = true;
 334     def_vtable_indices = klass->default_vtable_indices();
 335     assert(def_vtable_indices != NULL, "def vtable alloc?");
 336     assert(default_index <= def_vtable_indices->length(), "def vtable len?");
 337   } else {
 338     assert(klass == target_method()->method_holder(), "caller resp.");
 339     // Initialize the method's vtable index to "nonvirtual".
 340     // If we allocate a vtable entry, we will update it to a non-negative number.
 341     target_method()->set_vtable_index(Method::nonvirtual_vtable_index);
 342   }
 343 
 344   // Static and <init> methods are never in
 345   if (target_method()->is_static() || target_method()->name() ==  vmSymbols::object_initializer_name()) {
 346     return false;
 347   }
 348 
 349   if (target_method->is_final_method(klass->access_flags())) {
 350     // a final method never needs a new entry; final methods can be statically
 351     // resolved and they have to be present in the vtable only if they override
 352     // a super's method, in which case they re-use its entry
 353     allocate_new = false;
 354   } else if (klass->is_interface()) {
 355     allocate_new = false;  // see note below in needs_new_vtable_entry
 356     // An interface never allocates new vtable slots, only inherits old ones.
 357     // This method will either be assigned its own itable index later,
 358     // or be assigned an inherited vtable index in the loop below.
 359     // default methods inherited by classes store their vtable indices
 360     // in the inheritor's default_vtable_indices
 361     // default methods inherited by interfaces may already have a
 362     // valid itable index, if so, don't change it
 363     // overpass methods in an interface will be assigned an itable index later
 364     // by an inheriting class
 365     if (!is_default || !target_method()->has_itable_index()) {


 382 
 383   // search through the vtable and update overridden entries
 384   // Since check_signature_loaders acquires SystemDictionary_lock
 385   // which can block for gc, once we are in this loop, use handles
 386   // For classfiles built with >= jdk7, we now look for transitive overrides
 387 
 388   Symbol* name = target_method()->name();
 389   Symbol* signature = target_method()->signature();
 390 
 391   KlassHandle target_klass(THREAD, target_method()->method_holder());
 392   if (target_klass == NULL) {
 393     target_klass = _klass;
 394   }
 395 
 396   Handle target_loader(THREAD, target_klass->class_loader());
 397 
 398   Symbol* target_classname = target_klass->name();
 399   for(int i = 0; i < super_vtable_len; i++) {
 400     Method* super_method = method_at(i);
 401     // Check if method name matches
 402     if (super_method->name() == name && super_method->signature() == signature) {
 403 
 404       // get super_klass for method_holder for the found method
 405       InstanceKlass* super_klass =  super_method->method_holder();
 406 
 407       if (is_default
 408           || ((super_klass->is_override(super_method, target_loader, target_classname, THREAD))
 409           || ((klass->major_version() >= VTABLE_TRANSITIVE_OVERRIDE_VERSION)
 410           && ((super_klass = find_transitive_override(super_klass,
 411                              target_method, i, target_loader,
 412                              target_classname, THREAD))
 413                              != (InstanceKlass*)NULL))))
 414         {
 415         // Package private methods always need a new entry to root their own
 416         // overriding. They may also override other methods.
 417         if (!target_method()->is_package_private()) {
 418           allocate_new = false;
 419         }
 420 
 421         if (checkconstraints) {
 422         // Override vtable entry if passes loader constraint check


 556 bool klassVtable::needs_new_vtable_entry(methodHandle target_method,
 557                                          Klass* super,
 558                                          Handle classloader,
 559                                          Symbol* classname,
 560                                          AccessFlags class_flags,
 561                                          TRAPS) {
 562   if (class_flags.is_interface()) {
 563     // Interfaces do not use vtables, except for java.lang.Object methods,
 564     // so there is no point to assigning
 565     // a vtable index to any of their local methods.  If we refrain from doing this,
 566     // we can use Method::_vtable_index to hold the itable index
 567     return false;
 568   }
 569 
 570   if (target_method->is_final_method(class_flags) ||
 571       // a final method never needs a new entry; final methods can be statically
 572       // resolved and they have to be present in the vtable only if they override
 573       // a super's method, in which case they re-use its entry
 574       (target_method()->is_static()) ||
 575       // static methods don't need to be in vtable
 576       (target_method()->name() ==  vmSymbols::object_initializer_name())
 577       // <init> is never called dynamically-bound
 578       ) {
 579     return false;
 580   }
 581 
 582   // Concrete interface methods do not need new entries, they override
 583   // abstract method entries using default inheritance rules
 584   if (target_method()->method_holder() != NULL &&
 585       target_method()->method_holder()->is_interface()  &&
 586       !target_method()->is_abstract() ) {
 587     return false;
 588   }
 589 
 590   // we need a new entry if there is no superclass
 591   if (super == NULL) {
 592     return true;
 593   }
 594 
 595   // private methods in classes always have a new entry in the vtable
 596   // specification interpretation since classic has


 646   // miranda method in the super, whose entry it should re-use.
 647   // Actually, to handle cases that javac would not generate, we need
 648   // this check for all access permissions.
 649   InstanceKlass *sk = InstanceKlass::cast(super);
 650   if (sk->has_miranda_methods()) {
 651     if (sk->lookup_method_in_all_interfaces(name, signature, Klass::find_defaults) != NULL) {
 652       return false;  // found a matching miranda; we do not need a new entry
 653     }
 654   }
 655   return true; // found no match; we need a new entry
 656 }
 657 
 658 // Support for miranda methods
 659 
 660 // get the vtable index of a miranda method with matching "name" and "signature"
 661 int klassVtable::index_of_miranda(Symbol* name, Symbol* signature) {
 662   // search from the bottom, might be faster
 663   for (int i = (length() - 1); i >= 0; i--) {
 664     Method* m = table()[i].method();
 665     if (is_miranda_entry_at(i) &&
 666         m->name() == name && m->signature() == signature) {
 667       return i;
 668     }
 669   }
 670   return Method::invalid_vtable_index;
 671 }
 672 
 673 // check if an entry at an index is miranda
 674 // requires that method m at entry be declared ("held") by an interface.
 675 bool klassVtable::is_miranda_entry_at(int i) {
 676   Method* m = method_at(i);
 677   Klass* method_holder = m->method_holder();
 678   InstanceKlass *mhk = InstanceKlass::cast(method_holder);
 679 
 680   // miranda methods are public abstract instance interface methods in a class's vtable
 681   if (mhk->is_interface()) {
 682     assert(m->is_public(), "should be public");
 683     assert(ik()->implements_interface(method_holder) , "this class should implement the interface");
 684     // the search could find a miranda or a default method
 685     if (is_miranda(m, ik()->methods(), ik()->default_methods(), ik()->super())) {
 686       return true;


 741 // in super (superclass).  These mirandas are added to all_mirandas if it is
 742 // not null; in addition, those that are not duplicates of miranda methods
 743 // inherited by super from its interfaces are added to new_mirandas.
 744 // Thus, new_mirandas will be the set of mirandas that this class introduces,
 745 // all_mirandas will be the set of all mirandas applicable to this class
 746 // including all defined in superclasses.
 747 void klassVtable::add_new_mirandas_to_lists(
 748     GrowableArray<Method*>* new_mirandas, GrowableArray<Method*>* all_mirandas,
 749     Array<Method*>* current_interface_methods, Array<Method*>* class_methods,
 750     Array<Method*>* default_methods, Klass* super) {
 751 
 752   // iterate thru the current interface's method to see if it a miranda
 753   int num_methods = current_interface_methods->length();
 754   for (int i = 0; i < num_methods; i++) {
 755     Method* im = current_interface_methods->at(i);
 756     bool is_duplicate = false;
 757     int num_of_current_mirandas = new_mirandas->length();
 758     // check for duplicate mirandas in different interfaces we implement
 759     for (int j = 0; j < num_of_current_mirandas; j++) {
 760       Method* miranda = new_mirandas->at(j);
 761       if ((im->name() == miranda->name()) &&
 762           (im->signature() == miranda->signature())) {
 763         is_duplicate = true;
 764         break;
 765       }
 766     }
 767 
 768     if (!is_duplicate) { // we don't want duplicate miranda entries in the vtable
 769       if (is_miranda(im, class_methods, default_methods, super)) { // is it a miranda at all?
 770         InstanceKlass *sk = InstanceKlass::cast(super);
 771         // check if it is a duplicate of a super's miranda
 772         if (sk->lookup_method_in_all_interfaces(im->name(), im->signature(), Klass::find_defaults) == NULL) {
 773           new_mirandas->append(im);
 774         }
 775         if (all_mirandas != NULL) {
 776           all_mirandas->append(im);
 777         }
 778       }
 779     }
 780   }
 781 }
 782 


1415   oop* end_of_vtable = (oop *)&table()[_length];
1416   if (end_of_vtable > end_of_obj) {
1417     fatal(err_msg("klass %s: klass object too short (vtable extends beyond "
1418                   "end)", _klass->internal_name()));
1419   }
1420 
1421   for (int i = 0; i < _length; i++) table()[i].verify(this, st);
1422   // verify consistency with superKlass vtable
1423   Klass* super = _klass->super();
1424   if (super != NULL) {
1425     InstanceKlass* sk = InstanceKlass::cast(super);
1426     klassVtable* vt = sk->vtable();
1427     for (int i = 0; i < vt->length(); i++) {
1428       verify_against(st, vt, i);
1429     }
1430   }
1431 }
1432 
1433 void klassVtable::verify_against(outputStream* st, klassVtable* vt, int index) {
1434   vtableEntry* vte = &vt->table()[index];
1435   if (vte->method()->name()      != table()[index].method()->name() ||
1436       vte->method()->signature() != table()[index].method()->signature()) {
1437     fatal("mismatched name/signature of vtable entries");
1438   }
1439 }
1440 
1441 #ifndef PRODUCT
1442 void klassVtable::print() {
1443   ResourceMark rm;
1444   tty->print("klassVtable for klass %s (length %d):\n", _klass->internal_name(), length());
1445   for (int i = 0; i < length(); i++) {
1446     table()[i].print();
1447     tty->cr();
1448   }
1449 }
1450 #endif
1451 
1452 void vtableEntry::verify(klassVtable* vt, outputStream* st) {
1453   NOT_PRODUCT(FlagSetting fs(IgnoreLockingAssertions, true));
1454   assert(method() != NULL, "must have set method");
1455   method()->verify();
1456   // we sub_type, because it could be a miranda method




 259 // Private methods do not override and are not overridden.
 260 // Package Private methods are trickier:
 261 // e.g. P1.A, pub m
 262 // P2.B extends A, package private m
 263 // P1.C extends B, public m
 264 // P1.C.m needs to override P1.A.m and can not override P2.B.m
 265 // Therefore: all package private methods need their own vtable entries for
 266 // them to be the root of an inheritance overriding decision
 267 // Package private methods may also override other vtable entries
 268 InstanceKlass* klassVtable::find_transitive_override(InstanceKlass* initialsuper, methodHandle target_method,
 269                             int vtable_index, Handle target_loader, Symbol* target_classname, Thread * THREAD) {
 270   InstanceKlass* superk = initialsuper;
 271   while (superk != NULL && superk->super() != NULL) {
 272     InstanceKlass* supersuperklass = InstanceKlass::cast(superk->super());
 273     klassVtable* ssVtable = supersuperklass->vtable();
 274     if (vtable_index < ssVtable->length()) {
 275       Method* super_method = ssVtable->method_at(vtable_index);
 276 #ifndef PRODUCT
 277       Symbol* name= target_method()->name();
 278       Symbol* signature = target_method()->signature();
 279       assert(super_method->name()->equals(name) && super_method->signature()->equals(signature), "vtable entry name/sig mismatch");
 280 #endif
 281       if (supersuperklass->is_override(super_method, target_loader, target_classname, THREAD)) {
 282 #ifndef PRODUCT
 283         if (PrintVtables && Verbose) {
 284           ResourceMark rm(THREAD);
 285           char* sig = target_method()->name_and_sig_as_C_string();
 286           tty->print("transitive overriding superclass %s with %s::%s index %d, original flags: ",
 287            supersuperklass->internal_name(),
 288            _klass->internal_name(), sig, vtable_index);
 289            super_method->access_flags().print_on(tty);
 290            if (super_method->is_default_method()) {
 291              tty->print("default ");
 292            }
 293            tty->print("overriders flags: ");
 294            target_method->access_flags().print_on(tty);
 295            if (target_method->is_default_method()) {
 296              tty->print("default ");
 297            }
 298         }
 299 #endif /*PRODUCT*/


 325   Array<int>* def_vtable_indices = NULL;
 326   bool is_default = false;
 327   // default methods are concrete methods in superinterfaces which are added to the vtable
 328   // with their real method_holder
 329   // Since vtable and itable indices share the same storage, don't touch
 330   // the default method's real vtable/itable index
 331   // default_vtable_indices stores the vtable value relative to this inheritor
 332   if (default_index >= 0 ) {
 333     is_default = true;
 334     def_vtable_indices = klass->default_vtable_indices();
 335     assert(def_vtable_indices != NULL, "def vtable alloc?");
 336     assert(default_index <= def_vtable_indices->length(), "def vtable len?");
 337   } else {
 338     assert(klass == target_method()->method_holder(), "caller resp.");
 339     // Initialize the method's vtable index to "nonvirtual".
 340     // If we allocate a vtable entry, we will update it to a non-negative number.
 341     target_method()->set_vtable_index(Method::nonvirtual_vtable_index);
 342   }
 343 
 344   // Static and <init> methods are never in
 345   if (target_method()->is_static() || target_method()->name()->equals(vmSymbols::object_initializer_name())) {
 346     return false;
 347   }
 348 
 349   if (target_method->is_final_method(klass->access_flags())) {
 350     // a final method never needs a new entry; final methods can be statically
 351     // resolved and they have to be present in the vtable only if they override
 352     // a super's method, in which case they re-use its entry
 353     allocate_new = false;
 354   } else if (klass->is_interface()) {
 355     allocate_new = false;  // see note below in needs_new_vtable_entry
 356     // An interface never allocates new vtable slots, only inherits old ones.
 357     // This method will either be assigned its own itable index later,
 358     // or be assigned an inherited vtable index in the loop below.
 359     // default methods inherited by classes store their vtable indices
 360     // in the inheritor's default_vtable_indices
 361     // default methods inherited by interfaces may already have a
 362     // valid itable index, if so, don't change it
 363     // overpass methods in an interface will be assigned an itable index later
 364     // by an inheriting class
 365     if (!is_default || !target_method()->has_itable_index()) {


 382 
 383   // search through the vtable and update overridden entries
 384   // Since check_signature_loaders acquires SystemDictionary_lock
 385   // which can block for gc, once we are in this loop, use handles
 386   // For classfiles built with >= jdk7, we now look for transitive overrides
 387 
 388   Symbol* name = target_method()->name();
 389   Symbol* signature = target_method()->signature();
 390 
 391   KlassHandle target_klass(THREAD, target_method()->method_holder());
 392   if (target_klass == NULL) {
 393     target_klass = _klass;
 394   }
 395 
 396   Handle target_loader(THREAD, target_klass->class_loader());
 397 
 398   Symbol* target_classname = target_klass->name();
 399   for(int i = 0; i < super_vtable_len; i++) {
 400     Method* super_method = method_at(i);
 401     // Check if method name matches
 402     if (super_method->name()->equals(name) && super_method->signature()->equals(signature)) {
 403 
 404       // get super_klass for method_holder for the found method
 405       InstanceKlass* super_klass =  super_method->method_holder();
 406 
 407       if (is_default
 408           || ((super_klass->is_override(super_method, target_loader, target_classname, THREAD))
 409           || ((klass->major_version() >= VTABLE_TRANSITIVE_OVERRIDE_VERSION)
 410           && ((super_klass = find_transitive_override(super_klass,
 411                              target_method, i, target_loader,
 412                              target_classname, THREAD))
 413                              != (InstanceKlass*)NULL))))
 414         {
 415         // Package private methods always need a new entry to root their own
 416         // overriding. They may also override other methods.
 417         if (!target_method()->is_package_private()) {
 418           allocate_new = false;
 419         }
 420 
 421         if (checkconstraints) {
 422         // Override vtable entry if passes loader constraint check


 556 bool klassVtable::needs_new_vtable_entry(methodHandle target_method,
 557                                          Klass* super,
 558                                          Handle classloader,
 559                                          Symbol* classname,
 560                                          AccessFlags class_flags,
 561                                          TRAPS) {
 562   if (class_flags.is_interface()) {
 563     // Interfaces do not use vtables, except for java.lang.Object methods,
 564     // so there is no point to assigning
 565     // a vtable index to any of their local methods.  If we refrain from doing this,
 566     // we can use Method::_vtable_index to hold the itable index
 567     return false;
 568   }
 569 
 570   if (target_method->is_final_method(class_flags) ||
 571       // a final method never needs a new entry; final methods can be statically
 572       // resolved and they have to be present in the vtable only if they override
 573       // a super's method, in which case they re-use its entry
 574       (target_method()->is_static()) ||
 575       // static methods don't need to be in vtable
 576       (target_method()->name()->equals(vmSymbols::object_initializer_name()))
 577       // <init> is never called dynamically-bound
 578       ) {
 579     return false;
 580   }
 581 
 582   // Concrete interface methods do not need new entries, they override
 583   // abstract method entries using default inheritance rules
 584   if (target_method()->method_holder() != NULL &&
 585       target_method()->method_holder()->is_interface()  &&
 586       !target_method()->is_abstract() ) {
 587     return false;
 588   }
 589 
 590   // we need a new entry if there is no superclass
 591   if (super == NULL) {
 592     return true;
 593   }
 594 
 595   // private methods in classes always have a new entry in the vtable
 596   // specification interpretation since classic has


 646   // miranda method in the super, whose entry it should re-use.
 647   // Actually, to handle cases that javac would not generate, we need
 648   // this check for all access permissions.
 649   InstanceKlass *sk = InstanceKlass::cast(super);
 650   if (sk->has_miranda_methods()) {
 651     if (sk->lookup_method_in_all_interfaces(name, signature, Klass::find_defaults) != NULL) {
 652       return false;  // found a matching miranda; we do not need a new entry
 653     }
 654   }
 655   return true; // found no match; we need a new entry
 656 }
 657 
 658 // Support for miranda methods
 659 
 660 // get the vtable index of a miranda method with matching "name" and "signature"
 661 int klassVtable::index_of_miranda(Symbol* name, Symbol* signature) {
 662   // search from the bottom, might be faster
 663   for (int i = (length() - 1); i >= 0; i--) {
 664     Method* m = table()[i].method();
 665     if (is_miranda_entry_at(i) &&
 666         m->name()->equals(name) && m->signature()->equals(signature)) {
 667       return i;
 668     }
 669   }
 670   return Method::invalid_vtable_index;
 671 }
 672 
 673 // check if an entry at an index is miranda
 674 // requires that method m at entry be declared ("held") by an interface.
 675 bool klassVtable::is_miranda_entry_at(int i) {
 676   Method* m = method_at(i);
 677   Klass* method_holder = m->method_holder();
 678   InstanceKlass *mhk = InstanceKlass::cast(method_holder);
 679 
 680   // miranda methods are public abstract instance interface methods in a class's vtable
 681   if (mhk->is_interface()) {
 682     assert(m->is_public(), "should be public");
 683     assert(ik()->implements_interface(method_holder) , "this class should implement the interface");
 684     // the search could find a miranda or a default method
 685     if (is_miranda(m, ik()->methods(), ik()->default_methods(), ik()->super())) {
 686       return true;


 741 // in super (superclass).  These mirandas are added to all_mirandas if it is
 742 // not null; in addition, those that are not duplicates of miranda methods
 743 // inherited by super from its interfaces are added to new_mirandas.
 744 // Thus, new_mirandas will be the set of mirandas that this class introduces,
 745 // all_mirandas will be the set of all mirandas applicable to this class
 746 // including all defined in superclasses.
 747 void klassVtable::add_new_mirandas_to_lists(
 748     GrowableArray<Method*>* new_mirandas, GrowableArray<Method*>* all_mirandas,
 749     Array<Method*>* current_interface_methods, Array<Method*>* class_methods,
 750     Array<Method*>* default_methods, Klass* super) {
 751 
 752   // iterate thru the current interface's method to see if it a miranda
 753   int num_methods = current_interface_methods->length();
 754   for (int i = 0; i < num_methods; i++) {
 755     Method* im = current_interface_methods->at(i);
 756     bool is_duplicate = false;
 757     int num_of_current_mirandas = new_mirandas->length();
 758     // check for duplicate mirandas in different interfaces we implement
 759     for (int j = 0; j < num_of_current_mirandas; j++) {
 760       Method* miranda = new_mirandas->at(j);
 761       if ((im->name()->equals(miranda->name())) &&
 762           (im->signature()->equals(miranda->signature()))) {
 763         is_duplicate = true;
 764         break;
 765       }
 766     }
 767 
 768     if (!is_duplicate) { // we don't want duplicate miranda entries in the vtable
 769       if (is_miranda(im, class_methods, default_methods, super)) { // is it a miranda at all?
 770         InstanceKlass *sk = InstanceKlass::cast(super);
 771         // check if it is a duplicate of a super's miranda
 772         if (sk->lookup_method_in_all_interfaces(im->name(), im->signature(), Klass::find_defaults) == NULL) {
 773           new_mirandas->append(im);
 774         }
 775         if (all_mirandas != NULL) {
 776           all_mirandas->append(im);
 777         }
 778       }
 779     }
 780   }
 781 }
 782 


1415   oop* end_of_vtable = (oop *)&table()[_length];
1416   if (end_of_vtable > end_of_obj) {
1417     fatal(err_msg("klass %s: klass object too short (vtable extends beyond "
1418                   "end)", _klass->internal_name()));
1419   }
1420 
1421   for (int i = 0; i < _length; i++) table()[i].verify(this, st);
1422   // verify consistency with superKlass vtable
1423   Klass* super = _klass->super();
1424   if (super != NULL) {
1425     InstanceKlass* sk = InstanceKlass::cast(super);
1426     klassVtable* vt = sk->vtable();
1427     for (int i = 0; i < vt->length(); i++) {
1428       verify_against(st, vt, i);
1429     }
1430   }
1431 }
1432 
1433 void klassVtable::verify_against(outputStream* st, klassVtable* vt, int index) {
1434   vtableEntry* vte = &vt->table()[index];
1435   if (vte->method()->name()->not_equals(table()[index].method()->name()) ||
1436       vte->method()->signature()->not_equals(table()[index].method()->signature())) {
1437     fatal("mismatched name/signature of vtable entries");
1438   }
1439 }
1440 
1441 #ifndef PRODUCT
1442 void klassVtable::print() {
1443   ResourceMark rm;
1444   tty->print("klassVtable for klass %s (length %d):\n", _klass->internal_name(), length());
1445   for (int i = 0; i < length(); i++) {
1446     table()[i].print();
1447     tty->cr();
1448   }
1449 }
1450 #endif
1451 
1452 void vtableEntry::verify(klassVtable* vt, outputStream* st) {
1453   NOT_PRODUCT(FlagSetting fs(IgnoreLockingAssertions, true));
1454   assert(method() != NULL, "must have set method");
1455   method()->verify();
1456   // we sub_type, because it could be a miranda method


src/share/vm/oops/klassVtable.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File