8212817: [JVMCI] ResolvedJavaMethod.isInVirtualMethodTable throws InternalError
Reviewed-by: never, iveresov
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl.java Tue Oct 23 09:43:16 2018 -0700
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl.java Tue Oct 23 18:49:32 2018 +0200
@@ -725,7 +725,7 @@
return config().invalidVtableIndex;
}
if (holder.isInterface()) {
- if (resolved.isInterface()) {
+ if (resolved.isInterface() || !resolved.isLinked()) {
return config().invalidVtableIndex;
}
return getVtableIndexForInterfaceMethod(resolved);
--- a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java Tue Oct 23 09:43:16 2018 -0700
+++ b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java Tue Oct 23 18:49:32 2018 +0200
@@ -429,11 +429,24 @@
}
}
+ static class UnlinkedType {
+ }
+
/**
* All public non-final methods should be available in the vtable.
*/
@Test
public void testVirtualMethodTableAccess() {
+ ResolvedJavaType unlinkedType = metaAccess.lookupJavaType(UnlinkedType.class);
+ assertTrue(!unlinkedType.isLinked());
+ for (Class<?> c : classes) {
+ if (c.isInterface()) {
+ for (Method m : c.getDeclaredMethods()) {
+ ResolvedJavaMethod method = metaAccess.lookupJavaMethod(m);
+ method.isInVirtualMethodTable(unlinkedType);
+ }
+ }
+ }
for (Class<?> c : classes) {
if (c.isPrimitive() || c.isInterface()) {
continue;