提交 c56e2833 编写于 作者: M mbalao

8225261: Better method resolutions

Reviewed-by: andrew
Contributed-by: lois.foltan@oracle.com
上级 3c494420
...@@ -289,22 +289,25 @@ InstanceKlass* klassVtable::find_transitive_override(InstanceKlass* initialsuper ...@@ -289,22 +289,25 @@ InstanceKlass* klassVtable::find_transitive_override(InstanceKlass* initialsuper
int vtable_index, Handle target_loader, Symbol* target_classname, Thread * THREAD) { int vtable_index, Handle target_loader, Symbol* target_classname, Thread * THREAD) {
InstanceKlass* superk = initialsuper; InstanceKlass* superk = initialsuper;
while (superk != NULL && superk->super() != NULL) { while (superk != NULL && superk->super() != NULL) {
InstanceKlass* supersuperklass = InstanceKlass::cast(superk->super()); klassVtable* ssVtable = (superk->super())->vtable();
klassVtable* ssVtable = supersuperklass->vtable();
if (vtable_index < ssVtable->length()) { if (vtable_index < ssVtable->length()) {
Method* super_method = ssVtable->method_at(vtable_index); Method* super_method = ssVtable->method_at(vtable_index);
// get the class holding the matching method
// make sure you use that class for is_override
InstanceKlass* supermethodholder = super_method->method_holder();
#ifndef PRODUCT #ifndef PRODUCT
Symbol* name= target_method()->name(); Symbol* name= target_method()->name();
Symbol* signature = target_method()->signature(); Symbol* signature = target_method()->signature();
assert(super_method->name() == name && super_method->signature() == signature, "vtable entry name/sig mismatch"); assert(super_method->name() == name && super_method->signature() == signature, "vtable entry name/sig mismatch");
#endif #endif
if (supersuperklass->is_override(super_method, target_loader, target_classname, THREAD)) {
if (supermethodholder->is_override(super_method, target_loader, target_classname, THREAD)) {
#ifndef PRODUCT #ifndef PRODUCT
if (PrintVtables && Verbose) { if (PrintVtables && Verbose) {
ResourceMark rm(THREAD); ResourceMark rm(THREAD);
char* sig = target_method()->name_and_sig_as_C_string(); char* sig = target_method()->name_and_sig_as_C_string();
tty->print("transitive overriding superclass %s with %s::%s index %d, original flags: ", tty->print("transitive overriding superclass %s with %s::%s index %d, original flags: ",
supersuperklass->internal_name(), supermethodholder->internal_name(),
_klass->internal_name(), sig, vtable_index); _klass->internal_name(), sig, vtable_index);
super_method->access_flags().print_on(tty); super_method->access_flags().print_on(tty);
if (super_method->is_default_method()) { if (super_method->is_default_method()) {
...@@ -656,7 +659,7 @@ bool klassVtable::needs_new_vtable_entry(methodHandle target_method, ...@@ -656,7 +659,7 @@ bool klassVtable::needs_new_vtable_entry(methodHandle target_method,
// search through the super class hierarchy to see if we need // search through the super class hierarchy to see if we need
// a new entry // a new entry
ResourceMark rm; ResourceMark rm(THREAD);
Symbol* name = target_method()->name(); Symbol* name = target_method()->name();
Symbol* signature = target_method()->signature(); Symbol* signature = target_method()->signature();
Klass* k = super; Klass* k = super;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册