src/share/vm/oops/klassVtable.cpp

changeset 9806
758c07667682
parent 9756
2be326848943
parent 9803
f37db4bd396c
child 9931
fd44df5e3bc3
equal deleted inserted replaced
9762:c97db0855565 9806:758c07667682
287 // Package private methods may also override other vtable entries 287 // Package private methods may also override other vtable entries
288 InstanceKlass* klassVtable::find_transitive_override(InstanceKlass* initialsuper, methodHandle target_method, 288 InstanceKlass* klassVtable::find_transitive_override(InstanceKlass* initialsuper, methodHandle target_method,
289 int vtable_index, Handle target_loader, Symbol* target_classname, Thread * THREAD) { 289 int vtable_index, Handle target_loader, Symbol* target_classname, Thread * THREAD) {
290 InstanceKlass* superk = initialsuper; 290 InstanceKlass* superk = initialsuper;
291 while (superk != NULL && superk->super() != NULL) { 291 while (superk != NULL && superk->super() != NULL) {
292 InstanceKlass* supersuperklass = InstanceKlass::cast(superk->super()); 292 klassVtable* ssVtable = (superk->super())->vtable();
293 klassVtable* ssVtable = supersuperklass->vtable();
294 if (vtable_index < ssVtable->length()) { 293 if (vtable_index < ssVtable->length()) {
295 Method* super_method = ssVtable->method_at(vtable_index); 294 Method* super_method = ssVtable->method_at(vtable_index);
295 // get the class holding the matching method
296 // make sure you use that class for is_override
297 InstanceKlass* supermethodholder = super_method->method_holder();
296 #ifndef PRODUCT 298 #ifndef PRODUCT
297 Symbol* name= target_method()->name(); 299 Symbol* name= target_method()->name();
298 Symbol* signature = target_method()->signature(); 300 Symbol* signature = target_method()->signature();
299 assert(super_method->name() == name && super_method->signature() == signature, "vtable entry name/sig mismatch"); 301 assert(super_method->name() == name && super_method->signature() == signature, "vtable entry name/sig mismatch");
300 #endif 302 #endif
301 if (supersuperklass->is_override(super_method, target_loader, target_classname, THREAD)) { 303
304 if (supermethodholder->is_override(super_method, target_loader, target_classname, THREAD)) {
302 #ifndef PRODUCT 305 #ifndef PRODUCT
303 if (PrintVtables && Verbose) { 306 if (PrintVtables && Verbose) {
304 ResourceMark rm(THREAD); 307 ResourceMark rm(THREAD);
305 char* sig = target_method()->name_and_sig_as_C_string(); 308 char* sig = target_method()->name_and_sig_as_C_string();
306 tty->print("transitive overriding superclass %s with %s::%s index %d, original flags: ", 309 tty->print("transitive overriding superclass %s with %s::%s index %d, original flags: ",
307 supersuperklass->internal_name(), 310 supermethodholder->internal_name(),
308 _klass->internal_name(), sig, vtable_index); 311 _klass->internal_name(), sig, vtable_index);
309 super_method->access_flags().print_on(tty); 312 super_method->access_flags().print_on(tty);
310 if (super_method->is_default_method()) { 313 if (super_method->is_default_method()) {
311 tty->print("default "); 314 tty->print("default ");
312 } 315 }
654 return true; 657 return true;
655 } 658 }
656 659
657 // search through the super class hierarchy to see if we need 660 // search through the super class hierarchy to see if we need
658 // a new entry 661 // a new entry
659 ResourceMark rm; 662 ResourceMark rm(THREAD);
660 Symbol* name = target_method()->name(); 663 Symbol* name = target_method()->name();
661 Symbol* signature = target_method()->signature(); 664 Symbol* signature = target_method()->signature();
662 Klass* k = super; 665 Klass* k = super;
663 Method* super_method = NULL; 666 Method* super_method = NULL;
664 InstanceKlass *holder = NULL; 667 InstanceKlass *holder = NULL;

mercurial