changeset 55087:82fe7292ca5c

8223660: jtreg: Decouple Unsafe from RTM tests Reviewed-by: mdoerr, shade
author gromero
date Wed, 22 May 2019 12:17:26 -0400
parents dcda4663a926
children 69a35cd74f7d
files test/hotspot/jtreg/compiler/rtm/locking/TestRTMAbortRatio.java test/hotspot/jtreg/compiler/rtm/locking/TestRTMAbortThreshold.java test/hotspot/jtreg/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java test/hotspot/jtreg/compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java test/hotspot/jtreg/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java test/hotspot/jtreg/compiler/rtm/locking/TestRTMLockingCalculationDelay.java test/hotspot/jtreg/compiler/rtm/locking/TestRTMLockingThreshold.java test/hotspot/jtreg/compiler/rtm/locking/TestRTMTotalCountIncrRate.java test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMAfterLockInflation.java test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMDeopt.java test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMForInflatedLocks.java test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMForStackLocks.java test/hotspot/jtreg/compiler/rtm/method_options/TestNoRTMLockElidingOption.java test/hotspot/jtreg/compiler/rtm/method_options/TestUseRTMLockElidingOption.java test/hotspot/jtreg/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java test/hotspot/jtreg/compiler/testlibrary/rtm/XAbortProvoker.java test/hotspot/jtreg/compiler/testlibrary/rtm/libXAbortProvoker.c
diffstat 17 files changed, 132 insertions(+), 87 deletions(-) [+]
line wrap: on
line diff
--- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMAbortRatio.java	Wed May 29 07:48:27 2019 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMAbortRatio.java	Wed May 22 12:17:26 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, 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
@@ -33,18 +33,18 @@
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI
- *                   compiler.rtm.locking.TestRTMAbortRatio
+ * @run main/othervm/native -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                          -XX:+WhiteBoxAPI
+ *                          compiler.rtm.locking.TestRTMAbortRatio
  */
 
 package compiler.rtm.locking;
 
 import compiler.testlibrary.rtm.AbortProvoker;
+import compiler.testlibrary.rtm.XAbortProvoker;
 import compiler.testlibrary.rtm.CompilableTest;
 import compiler.testlibrary.rtm.RTMLockingStatistics;
 import compiler.testlibrary.rtm.RTMTestBase;
-import jdk.internal.misc.Unsafe;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.cli.CommandLineOptionTest;
@@ -117,7 +117,7 @@
     public static class Test implements CompilableTest {
         private static final int TOTAL_ITERATIONS = 10000;
         private static final int WARMUP_ITERATIONS = 1000;
-        private static final Unsafe UNSAFE = Unsafe.getUnsafe();
+        private final XAbortProvoker xabort = new XAbortProvoker();
         private final Object monitor = new Object();
         // Following field have to be static in order to avoid escape analysis.
         @SuppressWarnings("UnsuedDeclaration")
@@ -130,13 +130,13 @@
 
         @Override
         public String[] getMethodsToCompileNames() {
-            return new String[] { getMethodWithLockName(), "*.pageSize" };
+            return new String[] { getMethodWithLockName(), "*.doAbort" };
         }
 
         public void lock(boolean abort) {
             synchronized(monitor) {
                 if (abort) {
-                    Test.UNSAFE.pageSize();
+                    xabort.doAbort();
                 }
             }
         }
--- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMAbortThreshold.java	Wed May 29 07:48:27 2019 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMAbortThreshold.java	Wed May 22 12:17:26 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, 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
@@ -33,9 +33,9 @@
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI
- *                   compiler.rtm.locking.TestRTMAbortThreshold
+ * @run main/othervm/native -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                          -XX:+WhiteBoxAPI
+ *                          compiler.rtm.locking.TestRTMAbortThreshold
  */
 
 package compiler.rtm.locking;
--- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java	Wed May 29 07:48:27 2019 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java	Wed May 22 12:17:26 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, 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
@@ -35,18 +35,18 @@
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI
- *                   compiler.rtm.locking.TestRTMAfterNonRTMDeopt
+ * @run main/othervm/native -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                          -XX:+WhiteBoxAPI
+ *                          compiler.rtm.locking.TestRTMAfterNonRTMDeopt
  */
 
 package compiler.rtm.locking;
 
 import compiler.testlibrary.rtm.AbortProvoker;
+import compiler.testlibrary.rtm.XAbortProvoker;
 import compiler.testlibrary.rtm.CompilableTest;
 import compiler.testlibrary.rtm.RTMLockingStatistics;
 import compiler.testlibrary.rtm.RTMTestBase;
-import jdk.internal.misc.Unsafe;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.cli.CommandLineOptionTest;
@@ -149,7 +149,7 @@
         private static int field = 0;
         private static final int ITERATIONS = 10000;
         private static final int RANGE_CHECK_AT = ITERATIONS / 2;
-        private static final Unsafe UNSAFE = Unsafe.getUnsafe();
+        private final XAbortProvoker xabort = new XAbortProvoker();
         private final Object monitor = new Object();
 
         @Override
@@ -159,7 +159,8 @@
 
         @Override
         public String[] getMethodsToCompileNames() {
-            return new String[] { getMethodWithLockName() };
+            return new String[] { getMethodWithLockName(),
+                                  XAbortProvoker.class.getName() + "::doAbort()" };
         }
 
         public void forceAbort(int a[], boolean abort) {
@@ -167,7 +168,7 @@
                 synchronized(monitor) {
                     a[0]++;
                     if (abort) {
-                        Test.field = Test.UNSAFE.pageSize();
+                        Test.field = xabort.doAbort();
                     }
                 }
             } catch (Throwable t) {
--- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java	Wed May 29 07:48:27 2019 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java	Wed May 22 12:17:26 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, 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
@@ -33,9 +33,9 @@
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI
- *                   compiler.rtm.locking.TestRTMDeoptOnHighAbortRatio
+ * @run main/othervm/native -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                          -XX:+WhiteBoxAPI
+ *                          compiler.rtm.locking.TestRTMDeoptOnHighAbortRatio
  */
 
 package compiler.rtm.locking;
--- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java	Wed May 29 07:48:27 2019 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java	Wed May 22 12:17:26 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, 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
@@ -32,18 +32,18 @@
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI
- *                   compiler.rtm.locking.TestRTMDeoptOnLowAbortRatio
+ * @run main/othervm/native -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                          -XX:+WhiteBoxAPI
+ *                          compiler.rtm.locking.TestRTMDeoptOnLowAbortRatio
  */
 
 package compiler.rtm.locking;
 
 import compiler.testlibrary.rtm.AbortProvoker;
+import compiler.testlibrary.rtm.XAbortProvoker;
 import compiler.testlibrary.rtm.CompilableTest;
 import compiler.testlibrary.rtm.RTMLockingStatistics;
 import compiler.testlibrary.rtm.RTMTestBase;
-import jdk.internal.misc.Unsafe;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.cli.CommandLineOptionTest;
@@ -124,7 +124,7 @@
     }
 
     public static class Test implements CompilableTest {
-        private static final Unsafe UNSAFE = Unsafe.getUnsafe();
+        private final XAbortProvoker xabort = new XAbortProvoker();
         private final Object monitor = new Object();
 
         @Override
@@ -134,13 +134,14 @@
 
         @Override
         public String[] getMethodsToCompileNames() {
-            return new String[] { getMethodWithLockName() };
+            return new String[] { getMethodWithLockName(),
+                                  XAbortProvoker.class.getName() + "::doAbort" };
         }
 
         public void forceAbort(boolean abort) {
             synchronized(monitor) {
                 if (abort) {
-                    Test.UNSAFE.pageSize();
+                    xabort.doAbort();
                 }
             }
         }
--- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMLockingCalculationDelay.java	Wed May 29 07:48:27 2019 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMLockingCalculationDelay.java	Wed May 22 12:17:26 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, 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
@@ -33,9 +33,9 @@
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI
- *                   compiler.rtm.locking.TestRTMLockingCalculationDelay
+ * @run main/othervm/native -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                          -XX:+WhiteBoxAPI
+ *                          compiler.rtm.locking.TestRTMLockingCalculationDelay
  */
 
 package compiler.rtm.locking;
--- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMLockingThreshold.java	Wed May 29 07:48:27 2019 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMLockingThreshold.java	Wed May 22 12:17:26 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, 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
@@ -33,18 +33,18 @@
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI
- *                   compiler.rtm.locking.TestRTMLockingThreshold
+ * @run main/othervm/native -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                          -XX:+WhiteBoxAPI
+ *                          compiler.rtm.locking.TestRTMLockingThreshold
  */
 
 package compiler.rtm.locking;
 
 import compiler.testlibrary.rtm.AbortProvoker;
+import compiler.testlibrary.rtm.XAbortProvoker;
 import compiler.testlibrary.rtm.CompilableTest;
 import compiler.testlibrary.rtm.RTMLockingStatistics;
 import compiler.testlibrary.rtm.RTMTestBase;
-import jdk.internal.misc.Unsafe;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.cli.CommandLineOptionTest;
@@ -134,10 +134,9 @@
         @SuppressWarnings("UnsuedDeclaration")
         private static int field = 0;
         private static final int TOTAL_ITERATIONS = 10000;
-        private static final Unsafe UNSAFE = Unsafe.getUnsafe();
+        private final XAbortProvoker xabort = new XAbortProvoker();
         private final Object monitor = new Object();
 
-
         @Override
         public String getMethodWithLockName() {
             return this.getClass().getName() + "::lock";
@@ -145,13 +144,14 @@
 
         @Override
         public String[] getMethodsToCompileNames() {
-            return new String[] { getMethodWithLockName() };
+            return new String[] { getMethodWithLockName(),
+                                  XAbortProvoker.class.getName() + "::doAbort" };
         }
 
         public void lock(boolean abort) {
             synchronized(monitor) {
                 if (abort) {
-                    Test.field += Test.UNSAFE.pageSize();
+                    Test.field += xabort.doAbort();
                 }
             }
         }
--- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMTotalCountIncrRate.java	Wed May 29 07:48:27 2019 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMTotalCountIncrRate.java	Wed May 22 12:17:26 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, 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
@@ -33,18 +33,18 @@
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI
- *                   compiler.rtm.locking.TestRTMTotalCountIncrRate
+ * @run main/othervm/native -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                          -XX:+WhiteBoxAPI
+ *                          compiler.rtm.locking.TestRTMTotalCountIncrRate
  */
 
 package compiler.rtm.locking;
 
 import compiler.testlibrary.rtm.AbortProvoker;
+import compiler.testlibrary.rtm.XAbortProvoker;
 import compiler.testlibrary.rtm.CompilableTest;
 import compiler.testlibrary.rtm.RTMLockingStatistics;
 import compiler.testlibrary.rtm.RTMTestBase;
-import jdk.internal.misc.Unsafe;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.cli.CommandLineOptionTest;
@@ -104,7 +104,7 @@
 
     public static class Test implements CompilableTest {
         private static final long TOTAL_ITERATIONS = 10000L;
-        private static final Unsafe UNSAFE = Unsafe.getUnsafe();
+        private final XAbortProvoker xabort = new XAbortProvoker();
         private final Object monitor = new Object();
         // Following field have to be static in order to avoid escape analysis.
         @SuppressWarnings("UnsuedDeclaration")
@@ -117,7 +117,7 @@
 
         @Override
         public String[] getMethodsToCompileNames() {
-            return new String[] { getMethodWithLockName() };
+            return new String[] { getMethodWithLockName(), "*.doAbort" };
         }
 
         public void lock(boolean forceAbort) {
@@ -129,7 +129,7 @@
                     // If an actual JNI call will be replaced by
                     // intrinsic - we'll be in trouble, since xabort
                     // will be no longer called and test may fail.
-                    UNSAFE.pageSize();
+                    xabort.doAbort();
                 }
                 Test.field++;
             }
--- a/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMAfterLockInflation.java	Wed May 29 07:48:27 2019 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMAfterLockInflation.java	Wed May 22 12:17:26 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, 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
@@ -33,9 +33,9 @@
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI
- *                   compiler.rtm.locking.TestUseRTMAfterLockInflation
+ * @run main/othervm/native -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                          -XX:+WhiteBoxAPI
+ *                          compiler.rtm.locking.TestUseRTMAfterLockInflation
  */
 
 package compiler.rtm.locking;
--- a/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMDeopt.java	Wed May 29 07:48:27 2019 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMDeopt.java	Wed May 22 12:17:26 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, 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
@@ -33,9 +33,9 @@
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI
- *                   compiler.rtm.locking.TestUseRTMDeopt
+ * @run main/othervm/native -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                          -XX:+WhiteBoxAPI
+ *                          compiler.rtm.locking.TestUseRTMDeopt
  */
 
 package compiler.rtm.locking;
--- a/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMForInflatedLocks.java	Wed May 29 07:48:27 2019 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMForInflatedLocks.java	Wed May 22 12:17:26 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, 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
@@ -32,8 +32,9 @@
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI compiler.rtm.locking.TestUseRTMForInflatedLocks
+ * @run main/othervm/native -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                          -XX:+WhiteBoxAPI
+ *                          compiler.rtm.locking.TestUseRTMForInflatedLocks
  */
 
 package compiler.rtm.locking;
--- a/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMForStackLocks.java	Wed May 29 07:48:27 2019 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMForStackLocks.java	Wed May 22 12:17:26 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, 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
@@ -32,9 +32,9 @@
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI
- *                   compiler.rtm.locking.TestUseRTMForStackLocks
+ * @run main/othervm/native -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                          -XX:+WhiteBoxAPI
+ *                          compiler.rtm.locking.TestUseRTMForStackLocks
  */
 
 package compiler.rtm.locking;
--- a/test/hotspot/jtreg/compiler/rtm/method_options/TestNoRTMLockElidingOption.java	Wed May 29 07:48:27 2019 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/method_options/TestNoRTMLockElidingOption.java	Wed May 22 12:17:26 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, 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
@@ -33,9 +33,9 @@
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI
- *                   compiler.rtm.method_options.TestNoRTMLockElidingOption
+ * @run main/othervm/native -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                          -XX:+WhiteBoxAPI
+ *                          compiler.rtm.method_options.TestNoRTMLockElidingOption
  */
 
 package compiler.rtm.method_options;
--- a/test/hotspot/jtreg/compiler/rtm/method_options/TestUseRTMLockElidingOption.java	Wed May 29 07:48:27 2019 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/method_options/TestUseRTMLockElidingOption.java	Wed May 22 12:17:26 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, 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
@@ -34,9 +34,9 @@
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI
- *                   compiler.rtm.method_options.TestUseRTMLockElidingOption
+ * @run main/othervm/native -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                          -XX:+WhiteBoxAPI
+ *                          compiler.rtm.method_options.TestUseRTMLockElidingOption
  */
 
 package compiler.rtm.method_options;
--- a/test/hotspot/jtreg/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java	Wed May 29 07:48:27 2019 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java	Wed May 22 12:17:26 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, 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
@@ -35,9 +35,9 @@
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI
- *                   compiler.rtm.print.TestPrintPreciseRTMLockingStatistics
+ * @run main/othervm/native -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                          -XX:+WhiteBoxAPI
+ *                          compiler.rtm.print.TestPrintPreciseRTMLockingStatistics
  */
 
 
--- a/test/hotspot/jtreg/compiler/testlibrary/rtm/XAbortProvoker.java	Wed May 29 07:48:27 2019 -0700
+++ b/test/hotspot/jtreg/compiler/testlibrary/rtm/XAbortProvoker.java	Wed May 22 12:17:26 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, 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
@@ -23,17 +23,25 @@
 
 package compiler.testlibrary.rtm;
 
-import jdk.internal.misc.Unsafe;
-
 /**
  * Current RTM locking implementation force transaction abort
  * before native method call by explicit xabort(0) call.
  */
-class XAbortProvoker extends AbortProvoker {
+public class XAbortProvoker extends AbortProvoker {
+
+    static {
+        try {
+            System.loadLibrary("XAbortProvoker");
+        } catch (UnsatisfiedLinkError e) {
+            System.out.println("Could not load native library: " + e);
+        }
+    }
+
+    public native int doAbort();
+
     // Following field have to be static in order to avoid escape analysis.
     @SuppressWarnings("UnsuedDeclaration")
     private static int field = 0;
-    private static final Unsafe UNSAFE = Unsafe.getUnsafe();
 
     public XAbortProvoker() {
         this(new Object());
@@ -46,7 +54,7 @@
     @Override
     public void forceAbort() {
         synchronized(monitor) {
-            XAbortProvoker.field = UNSAFE.pageSize();
+            XAbortProvoker.field = doAbort();
         }
     }
 
@@ -54,7 +62,7 @@
     public String[] getMethodsToCompileNames() {
         return new String[] {
                 getMethodWithLockName(),
-                Unsafe.class.getName() + "::pageSize"
+                XAbortProvoker.class.getName() + "::doAbort"
         };
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/testlibrary/rtm/libXAbortProvoker.c	Wed May 22 12:17:26 2019 -0400
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2019, 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.
+ */
+
+#include "jni.h"
+
+/**
+ * Simply calling a JNI method from the JVM will abort any active transaction,
+ * so doAbort() does nothing special and only returns after being called.
+ * The transaction abortion happens right before the JNI method is called.
+ */
+int JNICALL
+Java_compiler_testlibrary_rtm_XAbortProvoker_doAbort(JNIEnv *env, jobject o) {
+  return 0;
+}