mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8162477: [JVMCI] assert(wf.check_method_context(ctxk, m)) failed: proper context
Reviewed-by: kvn
This commit is contained in:
parent
7ffefd9bf6
commit
d77fbe8b1b
5 changed files with 122 additions and 15 deletions
|
@ -1082,11 +1082,10 @@ class ClassHierarchyWalker {
|
|||
if (!(m->is_public() || m->is_protected()))
|
||||
// The override story is complex when packages get involved.
|
||||
return true; // Must punt the assertion to true.
|
||||
Klass* k = ctxk;
|
||||
Method* lm = k->lookup_method(m->name(), m->signature());
|
||||
if (lm == NULL && k->is_instance_klass()) {
|
||||
Method* lm = ctxk->lookup_method(m->name(), m->signature());
|
||||
if (lm == NULL && ctxk->is_instance_klass()) {
|
||||
// It might be an interface method
|
||||
lm = InstanceKlass::cast(k)->lookup_method_in_ordered_interfaces(m->name(),
|
||||
lm = InstanceKlass::cast(ctxk)->lookup_method_in_ordered_interfaces(m->name(),
|
||||
m->signature());
|
||||
}
|
||||
if (lm == m)
|
||||
|
@ -1101,12 +1100,20 @@ class ClassHierarchyWalker {
|
|||
// Static methods don't override non-static so punt
|
||||
return true;
|
||||
}
|
||||
if ( !Dependencies::is_concrete_method(lm, k)
|
||||
&& !Dependencies::is_concrete_method(m, ctxk)
|
||||
&& lm->method_holder()->is_subtype_of(m->method_holder()))
|
||||
if (!Dependencies::is_concrete_method(lm, ctxk) &&
|
||||
!Dependencies::is_concrete_method(m, ctxk)) {
|
||||
// They are both non-concrete
|
||||
if (lm->method_holder()->is_subtype_of(m->method_holder())) {
|
||||
// Method m is overridden by lm, but both are non-concrete.
|
||||
return true;
|
||||
}
|
||||
if (lm->method_holder()->is_interface() && m->method_holder()->is_interface() &&
|
||||
ctxk->is_subtype_of(m->method_holder()) && ctxk->is_subtype_of(lm->method_holder())) {
|
||||
// Interface method defined in multiple super interfaces
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
ResourceMark rm;
|
||||
tty->print_cr("Dependency method not found in the associated context:");
|
||||
tty->print_cr(" context = %s", ctxk->external_name());
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package compiler.jvmci.common.testcases;
|
||||
|
||||
public interface DuplicateSimpleSingleImplementerInterface {
|
||||
void interfaceMethod();
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package compiler.jvmci.common.testcases;
|
||||
|
||||
public abstract class MultipleSuperImplementers implements DuplicateSimpleSingleImplementerInterface, SimpleSingleImplementerInterface {
|
||||
public void finalize() {
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package compiler.jvmci.common.testcases;
|
||||
|
||||
public interface SimpleSingleImplementerInterface {
|
||||
void interfaceMethod();
|
||||
}
|
|
@ -32,6 +32,8 @@
|
|||
* java.base/jdk.internal.org.objectweb.asm.tree
|
||||
* jdk.vm.ci/jdk.vm.ci.hotspot
|
||||
* jdk.vm.ci/jdk.vm.ci.code
|
||||
* jdk.vm.ci/jdk.vm.ci.meta
|
||||
* jdk.vm.ci/jdk.vm.ci.runtime
|
||||
* @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
|
||||
* @build compiler.jvmci.compilerToVM.FindUniqueConcreteMethodTest
|
||||
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
|
||||
|
@ -41,7 +43,10 @@
|
|||
package compiler.jvmci.compilerToVM;
|
||||
|
||||
import compiler.jvmci.common.CTVMUtilities;
|
||||
import compiler.jvmci.common.testcases.DuplicateSimpleSingleImplementerInterface;
|
||||
import compiler.jvmci.common.testcases.SimpleSingleImplementerInterface;
|
||||
import compiler.jvmci.common.testcases.MultipleImplementer1;
|
||||
import compiler.jvmci.common.testcases.MultipleSuperImplementers;
|
||||
import compiler.jvmci.common.testcases.SingleImplementer;
|
||||
import compiler.jvmci.common.testcases.SingleImplementerInterface;
|
||||
import compiler.jvmci.common.testcases.SingleSubclass;
|
||||
|
@ -96,6 +101,11 @@ public class FindUniqueConcreteMethodTest {
|
|||
// static method
|
||||
result.add(new TestCase(false, SingleSubclass.class,
|
||||
SingleSubclass.class, "staticMethod"));
|
||||
// interface method
|
||||
result.add(new TestCase(false, MultipleSuperImplementers.class,
|
||||
DuplicateSimpleSingleImplementerInterface.class, "interfaceMethod", false));
|
||||
result.add(new TestCase(false, MultipleSuperImplementers.class,
|
||||
SimpleSingleImplementerInterface.class, "interfaceMethod", false));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -103,7 +113,7 @@ public class FindUniqueConcreteMethodTest {
|
|||
System.out.println(tcase);
|
||||
Method method = tcase.holder.getDeclaredMethod(tcase.methodName);
|
||||
HotSpotResolvedJavaMethod testMethod = CTVMUtilities
|
||||
.getResolvedMethod(tcase.receiver, method);
|
||||
.getResolvedMethod(tcase.methodFromReceiver ? tcase.receiver : tcase.holder, method);
|
||||
HotSpotResolvedObjectType resolvedType = CompilerToVMHelper
|
||||
.lookupType(Utils.toJVMTypeSignature(tcase.receiver), getClass(),
|
||||
/* resolve = */ true);
|
||||
|
@ -118,20 +128,25 @@ public class FindUniqueConcreteMethodTest {
|
|||
public final Class<?> holder;
|
||||
public final String methodName;
|
||||
public final boolean isPositive;
|
||||
public final boolean methodFromReceiver;
|
||||
|
||||
public TestCase(boolean isPositive, Class<?> clazz, Class<?> holder,
|
||||
String methodName) {
|
||||
String methodName, boolean methodFromReceiver) {
|
||||
this.receiver = clazz;
|
||||
this.methodName = methodName;
|
||||
this.isPositive = isPositive;
|
||||
this.holder = holder;
|
||||
this.methodFromReceiver = methodFromReceiver;
|
||||
}
|
||||
|
||||
public TestCase(boolean isPositive, Class<?> clazz, Class<?> holder, String methodName) {
|
||||
this(isPositive, clazz, holder, methodName, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("CASE: receiver=%s, holder=%s, method=%s,"
|
||||
+ " isPositive=%s", receiver.getName(),
|
||||
holder.getName(), methodName, isPositive);
|
||||
return String.format("CASE: receiver=%s, holder=%s, method=%s, isPositive=%s, methodFromReceiver=%s",
|
||||
receiver.getName(), holder.getName(), methodName, isPositive, methodFromReceiver);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue