8159149: Several compiler tests fail with minimal VM
authoriignatyev
Thu, 16 Jun 2016 01:43:11 +0300 (2016-06-15)
changeset 39428 24cb2cb4ae0b
parent 39427 c154eca6daa5
child 39429 2c9cde29cd3f
8159149: Several compiler tests fail with minimal VM Reviewed-by: kvn, psandoz
hotspot/test/compiler/c2/8004867/TestIntUnsafeOrdered.java
hotspot/test/compiler/codegen/8011901/Test8011901.java
hotspot/test/compiler/compilercontrol/jcmd/PrintDirectivesTest.java
hotspot/test/compiler/compilercontrol/logcompilation/LogTest.java
hotspot/test/compiler/compilercontrol/mixed/RandomValidCommandsTest.java
hotspot/test/compiler/jsr292/NonInlinedCall/RedefineTest.java
--- a/hotspot/test/compiler/c2/8004867/TestIntUnsafeOrdered.java	Wed Jun 15 22:58:04 2016 +0300
+++ b/hotspot/test/compiler/c2/8004867/TestIntUnsafeOrdered.java	Thu Jun 16 01:43:11 2016 +0300
@@ -32,8 +32,8 @@
  * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:+OptimizeFill TestIntUnsafeOrdered
  */
 
-import sun.misc.Unsafe;
-import java.lang.reflect.*;
+import jdk.internal.misc.Unsafe;
+import java.lang.reflect.Field;
 
 public class TestIntUnsafeOrdered {
   private static final int ARRLEN = 97;
@@ -47,10 +47,10 @@
   private static final int BASE;
   static {
     try {
-      Class c = TestIntUnsafeOrdered.class.getClassLoader().loadClass("sun.misc.Unsafe");
+      Class<?> c = Unsafe.class;
       Field f = c.getDeclaredField("theUnsafe");
       f.setAccessible(true);
-      unsafe = (Unsafe)f.get(c);
+      unsafe = (Unsafe) f.get(c);
       BASE = unsafe.arrayBaseOffset(int[].class);
     } catch (Exception e) {
       InternalError err = new InternalError();
@@ -771,213 +771,213 @@
 
   static void test_ci(int[] a) {
     for (int i = 0; i < ARRLEN; i+=1) {
-      unsafe.putOrderedInt(a, byte_offset(i), -123);
+      unsafe.putIntRelease(a, byte_offset(i), -123);
     }
   }
   static void test_vi(int[] a, int b, int old) {
     for (int i = 0; i < ARRLEN; i+=1) {
-      unsafe.putOrderedInt(a, byte_offset(i), b);
+      unsafe.putIntRelease(a, byte_offset(i), b);
     }
   }
   static void test_cp(int[] a, int[] b) {
     for (int i = 0; i < ARRLEN; i+=1) {
-      unsafe.putOrderedInt(a, byte_offset(i), b[i]);
+      unsafe.putIntRelease(a, byte_offset(i), b[i]);
     }
   }
   static void test_2ci(int[] a, int[] b) {
     for (int i = 0; i < ARRLEN; i+=1) {
-      unsafe.putOrderedInt(a, byte_offset(i), -123);
-      unsafe.putOrderedInt(b, byte_offset(i), -103);
+      unsafe.putIntRelease(a, byte_offset(i), -123);
+      unsafe.putIntRelease(b, byte_offset(i), -103);
     }
   }
   static void test_2vi(int[] a, int[] b, int c, int d) {
     for (int i = 0; i < ARRLEN; i+=1) {
-      unsafe.putOrderedInt(a, byte_offset(i), c);
-      unsafe.putOrderedInt(b, byte_offset(i), d);
+      unsafe.putIntRelease(a, byte_offset(i), c);
+      unsafe.putIntRelease(b, byte_offset(i), d);
     }
   }
   static void test_ci_neg(int[] a, int old) {
     for (int i = ARRLEN-1; i >= 0; i-=1) {
-      unsafe.putOrderedInt(a, byte_offset(i), -123);
+      unsafe.putIntRelease(a, byte_offset(i), -123);
     }
   }
   static void test_vi_neg(int[] a, int b, int old) {
     for (int i = ARRLEN-1; i >= 0; i-=1) {
-      unsafe.putOrderedInt(a, byte_offset(i), b);
+      unsafe.putIntRelease(a, byte_offset(i), b);
     }
   }
   static void test_cp_neg(int[] a, int[] b) {
     for (int i = ARRLEN-1; i >= 0; i-=1) {
-      unsafe.putOrderedInt(a, byte_offset(i), b[i]);
+      unsafe.putIntRelease(a, byte_offset(i), b[i]);
     }
   }
   static void test_2ci_neg(int[] a, int[] b) {
     for (int i = ARRLEN-1; i >= 0; i-=1) {
-      unsafe.putOrderedInt(a, byte_offset(i), -123);
-      unsafe.putOrderedInt(b, byte_offset(i), -103);
+      unsafe.putIntRelease(a, byte_offset(i), -123);
+      unsafe.putIntRelease(b, byte_offset(i), -103);
     }
   }
   static void test_2vi_neg(int[] a, int[] b, int c, int d) {
     for (int i = ARRLEN-1; i >= 0; i-=1) {
-      unsafe.putOrderedInt(a, byte_offset(i), c);
-      unsafe.putOrderedInt(b, byte_offset(i), d);
+      unsafe.putIntRelease(a, byte_offset(i), c);
+      unsafe.putIntRelease(b, byte_offset(i), d);
     }
   }
   static void test_ci_oppos(int[] a, int old) {
     int limit = ARRLEN-1;
     for (int i = 0; i < ARRLEN; i+=1) {
-      unsafe.putOrderedInt(a, byte_offset(limit-i), -123);
+      unsafe.putIntRelease(a, byte_offset(limit-i), -123);
     }
   }
   static void test_vi_oppos(int[] a, int b, int old) {
     int limit = ARRLEN-1;
     for (int i = limit; i >= 0; i-=1) {
-      unsafe.putOrderedInt(a, byte_offset(limit-i), b);
+      unsafe.putIntRelease(a, byte_offset(limit-i), b);
     }
   }
   static void test_cp_oppos(int[] a, int[] b) {
     int limit = ARRLEN-1;
     for (int i = 0; i < ARRLEN; i+=1) {
-      unsafe.putOrderedInt(a, byte_offset(i), b[limit-i]);
+      unsafe.putIntRelease(a, byte_offset(i), b[limit-i]);
     }
   }
   static void test_2ci_oppos(int[] a, int[] b) {
     int limit = ARRLEN-1;
     for (int i = 0; i < ARRLEN; i+=1) {
-      unsafe.putOrderedInt(a, byte_offset(limit-i), -123);
-      unsafe.putOrderedInt(b, byte_offset(i), -103);
+      unsafe.putIntRelease(a, byte_offset(limit-i), -123);
+      unsafe.putIntRelease(b, byte_offset(i), -103);
     }
   }
   static void test_2vi_oppos(int[] a, int[] b, int c, int d) {
     int limit = ARRLEN-1;
     for (int i = limit; i >= 0; i-=1) {
-      unsafe.putOrderedInt(a, byte_offset(i), c);
-      unsafe.putOrderedInt(b, byte_offset(limit-i), d);
+      unsafe.putIntRelease(a, byte_offset(i), c);
+      unsafe.putIntRelease(b, byte_offset(limit-i), d);
     }
   }
   static void test_ci_off(int[] a, int old) {
     for (int i = 0; i < ARRLEN-OFFSET; i+=1) {
-      unsafe.putOrderedInt(a, byte_offset(i+OFFSET), -123);
+      unsafe.putIntRelease(a, byte_offset(i+OFFSET), -123);
     }
   }
   static void test_vi_off(int[] a, int b, int old) {
     for (int i = 0; i < ARRLEN-OFFSET; i+=1) {
-      unsafe.putOrderedInt(a, byte_offset(i+OFFSET), b);
+      unsafe.putIntRelease(a, byte_offset(i+OFFSET), b);
     }
   }
   static void test_cp_off(int[] a, int[] b) {
     for (int i = 0; i < ARRLEN-OFFSET; i+=1) {
-      unsafe.putOrderedInt(a, byte_offset(i+OFFSET), b[i+OFFSET]);
+      unsafe.putIntRelease(a, byte_offset(i+OFFSET), b[i+OFFSET]);
     }
   }
   static void test_2ci_off(int[] a, int[] b) {
     for (int i = 0; i < ARRLEN-OFFSET; i+=1) {
-      unsafe.putOrderedInt(a, byte_offset(i+OFFSET), -123);
-      unsafe.putOrderedInt(b, byte_offset(i+OFFSET), -103);
+      unsafe.putIntRelease(a, byte_offset(i+OFFSET), -123);
+      unsafe.putIntRelease(b, byte_offset(i+OFFSET), -103);
     }
   }
   static void test_2vi_off(int[] a, int[] b, int c, int d) {
     for (int i = 0; i < ARRLEN-OFFSET; i+=1) {
-      unsafe.putOrderedInt(a, byte_offset(i+OFFSET), c);
-      unsafe.putOrderedInt(b, byte_offset(i+OFFSET), d);
+      unsafe.putIntRelease(a, byte_offset(i+OFFSET), c);
+      unsafe.putIntRelease(b, byte_offset(i+OFFSET), d);
     }
   }
   static void test_ci_inv(int[] a, int k, int old) {
     for (int i = 0; i < ARRLEN-k; i+=1) {
-      unsafe.putOrderedInt(a, byte_offset(i+k), -123);
+      unsafe.putIntRelease(a, byte_offset(i+k), -123);
     }
   }
   static void test_vi_inv(int[] a, int b, int k, int old) {
     for (int i = 0; i < ARRLEN-k; i+=1) {
-      unsafe.putOrderedInt(a, byte_offset(i+k), b);
+      unsafe.putIntRelease(a, byte_offset(i+k), b);
     }
   }
   static void test_cp_inv(int[] a, int[] b, int k) {
     for (int i = 0; i < ARRLEN-k; i+=1) {
-      unsafe.putOrderedInt(a, byte_offset(i+k), b[i+k]);
+      unsafe.putIntRelease(a, byte_offset(i+k), b[i+k]);
     }
   }
   static void test_2ci_inv(int[] a, int[] b, int k) {
     for (int i = 0; i < ARRLEN-k; i+=1) {
-      unsafe.putOrderedInt(a, byte_offset(i+k), -123);
-      unsafe.putOrderedInt(b, byte_offset(i+k), -103);
+      unsafe.putIntRelease(a, byte_offset(i+k), -123);
+      unsafe.putIntRelease(b, byte_offset(i+k), -103);
     }
   }
   static void test_2vi_inv(int[] a, int[] b, int c, int d, int k) {
     for (int i = 0; i < ARRLEN-k; i+=1) {
-      unsafe.putOrderedInt(a, byte_offset(i+k), c);
-      unsafe.putOrderedInt(b, byte_offset(i+k), d);
+      unsafe.putIntRelease(a, byte_offset(i+k), c);
+      unsafe.putIntRelease(b, byte_offset(i+k), d);
     }
   }
   static void test_ci_scl(int[] a, int old) {
     for (int i = 0; i*SCALE < ARRLEN; i+=1) {
-      unsafe.putOrderedInt(a, byte_offset(i*SCALE), -123);
+      unsafe.putIntRelease(a, byte_offset(i*SCALE), -123);
     }
   }
   static void test_vi_scl(int[] a, int b, int old) {
     for (int i = 0; i*SCALE < ARRLEN; i+=1) {
-      unsafe.putOrderedInt(a, byte_offset(i*SCALE), b);
+      unsafe.putIntRelease(a, byte_offset(i*SCALE), b);
     }
   }
   static void test_cp_scl(int[] a, int[] b) {
     for (int i = 0; i*SCALE < ARRLEN; i+=1) {
-      unsafe.putOrderedInt(a, byte_offset(i*SCALE), b[i*SCALE]);
+      unsafe.putIntRelease(a, byte_offset(i*SCALE), b[i*SCALE]);
     }
   }
   static void test_2ci_scl(int[] a, int[] b) {
     for (int i = 0; i*SCALE < ARRLEN; i+=1) {
-      unsafe.putOrderedInt(a, byte_offset(i*SCALE), -123);
-      unsafe.putOrderedInt(b, byte_offset(i*SCALE), -103);
+      unsafe.putIntRelease(a, byte_offset(i*SCALE), -123);
+      unsafe.putIntRelease(b, byte_offset(i*SCALE), -103);
     }
   }
   static void test_2vi_scl(int[] a, int[] b, int c, int d) {
     for (int i = 0; i*SCALE < ARRLEN; i+=1) {
-      unsafe.putOrderedInt(a, byte_offset(i*SCALE), c);
-      unsafe.putOrderedInt(b, byte_offset(i*SCALE), d);
+      unsafe.putIntRelease(a, byte_offset(i*SCALE), c);
+      unsafe.putIntRelease(b, byte_offset(i*SCALE), d);
     }
   }
   static void test_cp_alndst(int[] a, int[] b) {
     for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) {
-      unsafe.putOrderedInt(a, byte_offset(i+ALIGN_OFF), b[i]);
+      unsafe.putIntRelease(a, byte_offset(i+ALIGN_OFF), b[i]);
     }
   }
   static void test_cp_alnsrc(int[] a, int[] b) {
     for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) {
-      unsafe.putOrderedInt(a, byte_offset(i), b[i+ALIGN_OFF]);
+      unsafe.putIntRelease(a, byte_offset(i), b[i+ALIGN_OFF]);
     }
   }
   static void test_2ci_aln(int[] a, int[] b) {
     for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) {
-      unsafe.putOrderedInt(a, byte_offset(i+ALIGN_OFF), -123);
-      unsafe.putOrderedInt(b, byte_offset(i), -103);
+      unsafe.putIntRelease(a, byte_offset(i+ALIGN_OFF), -123);
+      unsafe.putIntRelease(b, byte_offset(i), -103);
     }
   }
   static void test_2vi_aln(int[] a, int[] b, int c, int d) {
     for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) {
-      unsafe.putOrderedInt(a, byte_offset(i), c);
-      unsafe.putOrderedInt(b, byte_offset(i+ALIGN_OFF), d);
+      unsafe.putIntRelease(a, byte_offset(i), c);
+      unsafe.putIntRelease(b, byte_offset(i+ALIGN_OFF), d);
     }
   }
   static void test_cp_unalndst(int[] a, int[] b) {
     for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) {
-      unsafe.putOrderedInt(a, byte_offset(i+UNALIGN_OFF), b[i]);
+      unsafe.putIntRelease(a, byte_offset(i+UNALIGN_OFF), b[i]);
     }
   }
   static void test_cp_unalnsrc(int[] a, int[] b) {
     for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) {
-      unsafe.putOrderedInt(a, byte_offset(i), b[i+UNALIGN_OFF]);
+      unsafe.putIntRelease(a, byte_offset(i), b[i+UNALIGN_OFF]);
     }
   }
   static void test_2ci_unaln(int[] a, int[] b) {
     for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) {
-      unsafe.putOrderedInt(a, byte_offset(i+UNALIGN_OFF), -123);
-      unsafe.putOrderedInt(b, byte_offset(i), -103);
+      unsafe.putIntRelease(a, byte_offset(i+UNALIGN_OFF), -123);
+      unsafe.putIntRelease(b, byte_offset(i), -103);
     }
   }
   static void test_2vi_unaln(int[] a, int[] b, int c, int d) {
     for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) {
-      unsafe.putOrderedInt(a, byte_offset(i), c);
-      unsafe.putOrderedInt(b, byte_offset(i+UNALIGN_OFF), d);
+      unsafe.putIntRelease(a, byte_offset(i), c);
+      unsafe.putIntRelease(b, byte_offset(i+UNALIGN_OFF), d);
     }
   }
 
--- a/hotspot/test/compiler/codegen/8011901/Test8011901.java	Wed Jun 15 22:58:04 2016 +0300
+++ b/hotspot/test/compiler/codegen/8011901/Test8011901.java	Thu Jun 16 01:43:11 2016 +0300
@@ -30,21 +30,21 @@
  *
  */
 
-import java.lang.reflect.*;
-import sun.misc.*;
+import java.lang.reflect.Field;
+import jdk.internal.misc.Unsafe;
 
 public class Test8011901 {
 
     private long ctl;
 
-    private static final sun.misc.Unsafe U;
+    private static final Unsafe U;
     private static final long CTL;
 
     static {
         try {
-            Field unsafe = sun.misc.Unsafe.class.getDeclaredField("theUnsafe");
+            Field unsafe = Unsafe.class.getDeclaredField("theUnsafe");
             unsafe.setAccessible(true);
-            U = (sun.misc.Unsafe) unsafe.get(null);
+            U = (Unsafe) unsafe.get(null);
             CTL = U.objectFieldOffset(Test8011901.class.getDeclaredField("ctl"));
         } catch (Exception e) {
             throw new Error(e);
--- a/hotspot/test/compiler/compilercontrol/jcmd/PrintDirectivesTest.java	Wed Jun 15 22:58:04 2016 +0300
+++ b/hotspot/test/compiler/compilercontrol/jcmd/PrintDirectivesTest.java	Thu Jun 16 01:43:11 2016 +0300
@@ -27,6 +27,7 @@
  * @summary Tests jcmd to be able to add a directive to compile only specified methods
  * @modules java.base/jdk.internal.misc
  * @library /testlibrary /test/lib /compiler/testlibrary ../share /
+ * @requires vm.flavor != "minimal"
  * @build compiler.compilercontrol.jcmd.PrintDirectivesTest
  *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
  *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
--- a/hotspot/test/compiler/compilercontrol/logcompilation/LogTest.java	Wed Jun 15 22:58:04 2016 +0300
+++ b/hotspot/test/compiler/compilercontrol/logcompilation/LogTest.java	Thu Jun 16 01:43:11 2016 +0300
@@ -32,8 +32,7 @@
  *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
- *  -XX:+UnlockDiagnosticVMOptions compiler.compilercontrol.logcompilation.LogTest
+ * @run driver compiler.compilercontrol.logcompilation.LogTest
  */
 
 package compiler.compilercontrol.logcompilation;
@@ -45,6 +44,8 @@
     public static void main(String[] args) {
         Scenario.Builder builder = Scenario.getBuilder();
         builder.addFlag("-XX:+UnlockDiagnosticVMOptions");
+        builder.addFlag("-Xbootclasspath/a:.");
+        builder.addFlag("-XX:+WhiteBoxAPI");
         builder.addFlag("-XX:+LogCompilation");
         builder.addFlag("-XX:LogFile=" + LogProcessor.LOG_FILE);
         Scenario scenario = builder.build();
--- a/hotspot/test/compiler/compilercontrol/mixed/RandomValidCommandsTest.java	Wed Jun 15 22:58:04 2016 +0300
+++ b/hotspot/test/compiler/compilercontrol/mixed/RandomValidCommandsTest.java	Thu Jun 16 01:43:11 2016 +0300
@@ -32,7 +32,7 @@
  *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm/timeout=600 compiler.compilercontrol.mixed.RandomValidCommandsTest
+ * @run driver/timeout=600 compiler.compilercontrol.mixed.RandomValidCommandsTest
  */
 
 package compiler.compilercontrol.mixed;
--- a/hotspot/test/compiler/jsr292/NonInlinedCall/RedefineTest.java	Wed Jun 15 22:58:04 2016 +0300
+++ b/hotspot/test/compiler/jsr292/NonInlinedCall/RedefineTest.java	Thu Jun 16 01:43:11 2016 +0300
@@ -28,6 +28,7 @@
  *          java.base/jdk.internal.misc
  *          java.base/jdk.internal.vm.annotation
  * @library /testlibrary /test/lib / ../patches
+ * @requires vm.flavor != "minimal"
  * @build sun.hotspot.WhiteBox
  * @build java.base/java.lang.invoke.MethodHandleHelper
  * @build compiler.jsr292.NonInlinedCall.RedefineTest