aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormbalao <unknown>2019-10-08 10:26:17 -0400
committerbell-sw <liberica@bell-sw.com>2020-01-19 09:12:38 +0300
commit7614eb54977b9865371c0edbc7f19ad3c9b28d84 (patch)
treee5b2e0dee7c682f7698db6e2aa1cc7a9b83d8c42
parent3d9c27964fba085177a83af136ee2b1d7b512f52 (diff)
downloadjdk8u_hotspot-7614eb54977b9865371c0edbc7f19ad3c9b28d84.tar.gz
8225261: Better method resolutions
Reviewed-by: andrew Contributed-by: lois.foltan@oracle.com
-rw-r--r--src/share/vm/oops/klassVtable.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/share/vm/oops/klassVtable.cpp b/src/share/vm/oops/klassVtable.cpp
index 61dd4c21d..b3f477cd0 100644
--- a/src/share/vm/oops/klassVtable.cpp
+++ b/src/share/vm/oops/klassVtable.cpp
@@ -289,22 +289,25 @@ InstanceKlass* klassVtable::find_transitive_override(InstanceKlass* initialsuper
int vtable_index, Handle target_loader, Symbol* target_classname, Thread * THREAD) {
InstanceKlass* superk = initialsuper;
while (superk != NULL && superk->super() != NULL) {
- InstanceKlass* supersuperklass = InstanceKlass::cast(superk->super());
- klassVtable* ssVtable = supersuperklass->vtable();
+ klassVtable* ssVtable = (superk->super())->vtable();
if (vtable_index < ssVtable->length()) {
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
Symbol* name= target_method()->name();
Symbol* signature = target_method()->signature();
assert(super_method->name() == name && super_method->signature() == signature, "vtable entry name/sig mismatch");
#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
if (PrintVtables && Verbose) {
ResourceMark rm(THREAD);
char* sig = target_method()->name_and_sig_as_C_string();
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);
super_method->access_flags().print_on(tty);
if (super_method->is_default_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
// a new entry
- ResourceMark rm;
+ ResourceMark rm(THREAD);
Symbol* name = target_method()->name();
Symbol* signature = target_method()->signature();
Klass* k = super;