8225261: Better method resolutions
Correct the class used to perform the overriding check in klassVtable::find_transitive_override Reviewed-by: ahgross, dholmes, hseigel, jwilhelm, rhalade
This commit is contained in:
parent
10b010d0f5
commit
40429eea41
@ -291,23 +291,26 @@ 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(methodHandle(THREAD, super_method), target_loader, target_classname, THREAD)) {
|
|
||||||
|
if (supermethodholder->is_override(methodHandle(THREAD, super_method), target_loader, target_classname, THREAD)) {
|
||||||
if (log_develop_is_enabled(Trace, vtables)) {
|
if (log_develop_is_enabled(Trace, vtables)) {
|
||||||
ResourceMark rm(THREAD);
|
ResourceMark rm(THREAD);
|
||||||
LogTarget(Trace, vtables) lt;
|
LogTarget(Trace, vtables) lt;
|
||||||
LogStream ls(lt);
|
LogStream ls(lt);
|
||||||
char* sig = target_method()->name_and_sig_as_C_string();
|
char* sig = target_method()->name_and_sig_as_C_string();
|
||||||
ls.print("transitive overriding superclass %s with %s index %d, original flags: ",
|
ls.print("transitive overriding superclass %s with %s index %d, original flags: ",
|
||||||
supersuperklass->internal_name(),
|
supermethodholder->internal_name(),
|
||||||
sig, vtable_index);
|
sig, vtable_index);
|
||||||
super_method->print_linkage_flags(&ls);
|
super_method->print_linkage_flags(&ls);
|
||||||
ls.print("overriders flags: ");
|
ls.print("overriders flags: ");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user