changeset 52230:fb01ea9dcee3

8212817: [JVMCI] ResolvedJavaMethod.isInVirtualMethodTable throws InternalError Reviewed-by: never, iveresov
author dnsimon
date Tue, 23 Oct 2018 18:49:32 +0200
parents d8843761f478
children 66432f0e91bd
files src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl.java test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java
diffstat 2 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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;