changeset 26113:3fbf4befb3a0

8138753: [TESTBUG] compiler/jvmci/compilerToVM/GetResolvedJavaType should be updated according to 26073:cb448d8f764a commit
author dpochepk
date Thu, 08 Oct 2015 07:05:25 -1000
parents 54982b5983d4
children e75d6374ba5b
files test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java
diffstat 1 files changed, 24 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java	Thu Oct 08 07:05:04 2015 -1000
+++ b/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java	Thu Oct 08 07:05:25 2015 -1000
@@ -149,18 +149,6 @@
                         getPtrToKlass() - ptrToClass, COMPRESSED);
             }
         },
-        METASPACE_WRAPPER_BASE {
-            @Override
-            HotSpotResolvedObjectTypeImpl getResolvedJavaType() {
-                return CompilerToVMHelper.getResolvedJavaType(
-                        new MetaspaceWrapperObject() {
-                            @Override
-                            public long getMetaspacePointer() {
-                                return getPtrToKlass();
-                            }
-                        }, 0L, COMPRESSED);
-            }
-        },
         ;
         abstract HotSpotResolvedObjectTypeImpl getResolvedJavaType();
     }
@@ -170,13 +158,15 @@
     private static final long PTR = UNSAFE.getKlassPointer(
             new GetResolvedJavaTypeTest());
     private static final Class TEST_CLASS = GetResolvedJavaTypeTest.class;
-    private static final boolean COMPRESSED
-            = WB.getBooleanVMFlag("UseCompressedClassPointers");
+    /* a compressed parameter for tested method is set to false because
+       unsafe.getKlassPointer always returns uncompressed pointer */
+    private static final boolean COMPRESSED = false;
+            // = WB.getBooleanVMFlag("UseCompressedClassPointers");
 
     private static long getPtrToKlass() {
         Field field;
         try {
-            field = GetResolvedJavaTypeTest.class.getDeclaredField("PTR");
+            field = TEST_CLASS.getDeclaredField("PTR");
         } catch (NoSuchFieldException e) {
             throw new Error("TEST BUG : " + e, e);
         }
@@ -197,6 +187,24 @@
             test.test(testCase);
         }
         testObjectBase();
+        testMetaspaceWrapperBase();
+    }
+
+    private static void testMetaspaceWrapperBase() {
+        try {
+            HotSpotResolvedObjectTypeImpl type
+                    = CompilerToVMHelper.getResolvedJavaType(
+                            new MetaspaceWrapperObject() {
+                                @Override
+                                public long getMetaspacePointer() {
+                                    return getPtrToKlass();
+                                }
+                            }, 0L, COMPRESSED);
+            throw new AssertionError("Test METASPACE_WRAPPER_BASE."
+                    + " Expected IllegalArgumentException has not been caught");
+        } catch (IllegalArgumentException iae) {
+            // expected
+        }
     }
 
     private static void testObjectBase() {
@@ -204,7 +212,7 @@
             HotSpotResolvedObjectTypeImpl type
                     = CompilerToVMHelper.getResolvedJavaType(new Object(), 0L,
                             COMPRESSED);
-            throw new AssertionError("Test TEST_OBJECT_BASE."
+            throw new AssertionError("Test OBJECT_BASE."
                 + " Expected IllegalArgumentException has not been caught");
         } catch (IllegalArgumentException iae) {
             // expected