8067480: Crash in klassItable::initialize_itable_for_interface when running vm.runtime.defmeth.StaticMethodsTest

A static method should be skipped in entirety by find_instance_method(), searching should continue to find an overpass method of the same name and signature if present.

Reviewed-by: acorn, hseigel
This commit is contained in:
Lois Foltan 2015-01-23 09:54:33 -05:00
parent e1bfe8762e
commit 5f8b5ceaee
11 changed files with 76 additions and 53 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -289,11 +289,11 @@ void LinkResolver::lookup_method_in_klasses(methodHandle& result, KlassHandle kl
// returns first instance method
// Looks up method in classes, then looks up local default methods
void LinkResolver::lookup_instance_method_in_klasses(methodHandle& result, KlassHandle klass, Symbol* name, Symbol* signature, TRAPS) {
Method* result_oop = klass->uncached_lookup_method(name, signature, Klass::normal);
Method* result_oop = klass->uncached_lookup_method(name, signature, Klass::find_overpass);
result = methodHandle(THREAD, result_oop);
while (!result.is_null() && result->is_static() && result->method_holder()->super() != NULL) {
KlassHandle super_klass = KlassHandle(THREAD, result->method_holder()->super());
result = methodHandle(THREAD, super_klass->uncached_lookup_method(name, signature, Klass::normal));
result = methodHandle(THREAD, super_klass->uncached_lookup_method(name, signature, Klass::find_overpass));
}
if (klass->oop_is_array()) {
@ -320,7 +320,8 @@ int LinkResolver::vtable_index_of_interface_method(KlassHandle klass,
// First check in default method array
if (!resolved_method->is_abstract() &&
(InstanceKlass::cast(klass())->default_methods() != NULL)) {
int index = InstanceKlass::find_method_index(InstanceKlass::cast(klass())->default_methods(), name, signature, false);
int index = InstanceKlass::find_method_index(InstanceKlass::cast(klass())->default_methods(),
name, signature, Klass::find_overpass, Klass::find_static);
if (index >= 0 ) {
vtable_index = InstanceKlass::cast(klass())->default_vtable_indices()->at(index);
}