statistics = RTMLockingStatistics.fromString(
- provoker.getMethodWithLockName(), outputAnalyzer.getOutput());
-
- Asserts.assertEQ(statistics.size(), 1, "VM output should contain "
- + "exactly one RTM locking statistics entry for method "
- + provoker.getMethodWithLockName());
-
- Asserts.assertEQ(statistics.get(0).getTotalLocks(), abortThreshold,
- String.format("Expected that method with rtm lock elision was"
- + " deoptimized after %d lock attempts",
- abortThreshold));
- }
-
- public static void main(String args[]) throws Throwable {
- new TestRTMAbortThreshold().runTestCases();
- }
-}
-
diff --git a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java
deleted file mode 100644
index 03f56769bffeb..0000000000000
--- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * Copyright (c) 2014, 2022, 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.
- */
-
-/**
- * @test
- * @bug 8031320
- * @summary Verify that if we use RTMDeopt, then deoptimization
- * caused by reason other then rtm_state_change will reset
- * method's RTM state. And if we don't use RTMDeopt, then
- * RTM state remain the same after such deoptimization.
- * @library /test/lib /
- * @modules java.base/jdk.internal.misc
- * java.management
- * @requires vm.rtm.cpu & vm.rtm.compiler
- * @build jdk.test.whitebox.WhiteBox
- * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
- * @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.test.lib.Asserts;
-import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.cli.CommandLineOptionTest;
-
-import java.util.List;
-
-/**
- * To verify that with +UseRTMDeopt method's RTM state will be
- * changed to ProfileRTM on deoptimization unrelated to
- * rtm_state_change following sequence of events is used:
- *
- *
- * rtm state ^
- * |
- * UseRTM | ******| ******
- * | |
- * ProfileRTM |******| |*****|
- * | | | |
- * 0-------|-----|-----|---------------------> time
- * | | \ force abort
- * | |
- * | \ force deoptimization
- * |
- * \ force xabort
- *
- * When xabort is forced by native method call method should
- * change it's state to UseRTM, because we use RTMAbortRatio=100
- * and low RTMLockingThreshold, so at this point actual abort
- * ratio will be below 100% and there should be enough lock
- * attempts to recompile method without RTM profiling.
- */
-public class TestRTMAfterNonRTMDeopt {
- private static final int ABORT_THRESHOLD = 1000;
- private static final String RANGE_CHECK = "range_check";
-
- protected void runTestCases() throws Throwable {
- verifyRTMAfterDeopt(false, false);
- verifyRTMAfterDeopt(true, false);
-
- verifyRTMAfterDeopt(false, true);
- verifyRTMAfterDeopt(true, true);
- }
-
- private void verifyRTMAfterDeopt(boolean useStackLock,
- boolean useRTMDeopt) throws Throwable {
- CompilableTest test = new Test();
- String logFile = String.format("rtm_%s_stack_lock_%s_deopt.xml",
- (useStackLock ? "use" : "no"), (useRTMDeopt ? "use" : "no"));
-
- OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest(
- logFile,
- test,
- "-XX:CompileThreshold=1",
- CommandLineOptionTest.prepareBooleanFlag("UseRTMForStackLocks",
- useStackLock),
- CommandLineOptionTest.prepareBooleanFlag("UseRTMDeopt",
- useRTMDeopt),
- "-XX:RTMAbortRatio=100",
- CommandLineOptionTest.prepareNumericFlag("RTMAbortThreshold",
- TestRTMAfterNonRTMDeopt.ABORT_THRESHOLD),
- CommandLineOptionTest.prepareNumericFlag("RTMLockingThreshold",
- TestRTMAfterNonRTMDeopt.ABORT_THRESHOLD / 2L),
- "-XX:RTMTotalCountIncrRate=1",
- "-XX:+PrintPreciseRTMLockingStatistics",
- Test.class.getName(),
- Boolean.toString(!useStackLock)
- );
-
- outputAnalyzer.shouldHaveExitValue(0);
-
- int traps = RTMTestBase.firedRTMStateChangeTraps(logFile);
-
- if (useRTMDeopt) {
- Asserts.assertEQ(traps, 2, "Two uncommon traps with "
- + "reason rtm_state_change should be fired.");
- } else {
- Asserts.assertEQ(traps, 0, "No uncommon traps with "
- + "reason rtm_state_change should be fired.");
- }
-
- int rangeCheckTraps = RTMTestBase.firedUncommonTraps(logFile,
- TestRTMAfterNonRTMDeopt.RANGE_CHECK);
-
- Asserts.assertEQ(rangeCheckTraps, 1,
- "One range_check uncommon trap should be fired.");
-
- List statistics = RTMLockingStatistics.fromString(
- test.getMethodWithLockName(), outputAnalyzer.getOutput());
-
- int expectedStatEntries = (useRTMDeopt ? 4 : 2);
-
- Asserts.assertEQ(statistics.size(), expectedStatEntries,
- String.format("VM output should contain %d RTM locking "
- + "statistics entries.", expectedStatEntries));
- }
-
- public static class Test implements CompilableTest {
- // Following field have to be static in order to avoid escape analysis.
- @SuppressWarnings("UnsuedDeclaration")
- private static int field = 0;
- private static final int ITERATIONS = 10000;
- private static final int RANGE_CHECK_AT = ITERATIONS / 2;
- private final XAbortProvoker xabort = new XAbortProvoker();
- private final Object monitor = new Object();
-
- @Override
- public String getMethodWithLockName() {
- return this.getClass().getName() + "::forceAbort";
- }
-
- @Override
- public String[] getMethodsToCompileNames() {
- return new String[] { getMethodWithLockName(),
- XAbortProvoker.class.getName() + "::doAbort()" };
- }
-
- public void forceAbort(int a[], boolean abort) {
- try {
- synchronized(monitor) {
- a[0]++;
- if (abort) {
- Test.field = xabort.doAbort();
- }
- }
- } catch (Throwable t) {
- // suppress any throwables
- }
- }
-
- /**
- * Usage:
- * Test <inflate monitor>
- */
- public static void main(String args[]) throws Throwable {
- Test t = new Test();
-
- boolean shouldBeInflated = Boolean.valueOf(args[0]);
- if (shouldBeInflated) {
- AbortProvoker.inflateMonitor(t.monitor);
- }
-
- int tmp[] = new int[1];
-
- for (int i = 0; i < Test.ITERATIONS; i++ ) {
- AbortProvoker.verifyMonitorState(t.monitor, shouldBeInflated);
- if (i == Test.RANGE_CHECK_AT) {
- t.forceAbort(new int[0], false);
- } else {
- boolean isThreshold
- = (i == TestRTMAfterNonRTMDeopt.ABORT_THRESHOLD);
- boolean isThresholdPlusRange
- = (i == TestRTMAfterNonRTMDeopt.ABORT_THRESHOLD
- + Test.RANGE_CHECK_AT);
- t.forceAbort(tmp, isThreshold || isThresholdPlusRange);
- }
- }
- }
- }
-
- public static void main(String args[]) throws Throwable {
- new TestRTMAfterNonRTMDeopt().runTestCases();
- }
-}
-
diff --git a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java
deleted file mode 100644
index 5faec082fc29c..0000000000000
--- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright (c) 2014, 2022, 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.
- */
-
-/**
- * @test
- * @bug 8031320
- * @summary Verify that on high abort ratio method will be recompiled
- * without rtm locking.
- * @library /test/lib /
- * @modules java.base/jdk.internal.misc
- * java.management
- * @requires vm.rtm.cpu & vm.rtm.compiler
- * @build jdk.test.whitebox.WhiteBox
- * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
- * @run main/othervm/native -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- * -XX:+WhiteBoxAPI
- * compiler.rtm.locking.TestRTMDeoptOnHighAbortRatio
- */
-
-package compiler.rtm.locking;
-
-import compiler.testlibrary.rtm.AbortProvoker;
-import compiler.testlibrary.rtm.AbortType;
-import compiler.testlibrary.rtm.RTMLockingStatistics;
-import compiler.testlibrary.rtm.RTMTestBase;
-import jdk.test.lib.Asserts;
-import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.cli.CommandLineOptionTest;
-
-import java.util.List;
-
-/**
- * Test verifies that on high abort ratio method wil be deoptimized with
- * rtm_state_change reason and after that RTM-based lock elision will not
- * be used for that method.
- * This test make asserts on total locks count done by compiled method,
- * so in order to avoid issue with retriable locks -XX:RTMRetryCount=0 is used.
- * For more details on that issue see {@link TestUseRTMAfterLockInflation}.
- */
-public class TestRTMDeoptOnHighAbortRatio {
- private static final long ABORT_THRESHOLD
- = AbortProvoker.DEFAULT_ITERATIONS / 2L;
-
- protected void runTestCases() throws Throwable {
- verifyDeopt(false);
- verifyDeopt(true);
- }
-
- private void verifyDeopt(boolean useStackLock) throws Throwable {
- AbortProvoker provoker = AbortType.XABORT.provoker();
- String logFileName = String.format("rtm_deopt_%s_stack_lock.xml",
- (useStackLock ? "use" : "no"));
-
- OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest(
- logFileName,
- provoker,
- "-XX:+UseRTMDeopt",
- CommandLineOptionTest.prepareBooleanFlag("UseRTMForStackLocks",
- useStackLock),
- "-XX:RTMRetryCount=0",
- CommandLineOptionTest.prepareNumericFlag("RTMAbortThreshold",
- TestRTMDeoptOnHighAbortRatio.ABORT_THRESHOLD),
- "-XX:RTMAbortRatio=100",
- "-XX:CompileThreshold=1",
- "-XX:RTMTotalCountIncrRate=1",
- "-XX:+PrintPreciseRTMLockingStatistics",
- AbortProvoker.class.getName(),
- AbortType.XABORT.toString(),
- Boolean.toString(!useStackLock)
- );
-
- outputAnalyzer.shouldHaveExitValue(0);
-
- int firedTraps = RTMTestBase.firedRTMStateChangeTraps(logFileName);
-
- Asserts.assertEQ(firedTraps, 1, "Expected to get only one "
- + "deoptimization due to rtm state change");
-
- List statistics = RTMLockingStatistics.fromString(
- provoker.getMethodWithLockName(), outputAnalyzer.getOutput());
-
- Asserts.assertEQ(statistics.size(), 1, "VM output should contain "
- + "exactly one RTM locking statistics entry for method "
- + provoker.getMethodWithLockName());
-
- Asserts.assertEQ(statistics.get(0).getTotalLocks(),
- TestRTMDeoptOnHighAbortRatio.ABORT_THRESHOLD,
- "After AbortThreshold was reached, method should be"
- + " recompiled without rtm lock eliding.");
- }
-
- public static void main(String args[]) throws Throwable {
- new TestRTMDeoptOnHighAbortRatio().runTestCases();
- }
-}
-
diff --git a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java
deleted file mode 100644
index 404d076e5caa6..0000000000000
--- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Copyright (c) 2014, 2022, 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.
- */
-
-/**
- * @test
- * @bug 8031320
- * @summary Verify that on low abort ratio method will be recompiled.
- * @library /test/lib /
- * @modules java.base/jdk.internal.misc
- * java.management
- * @requires vm.rtm.cpu & vm.rtm.compiler
- * @build jdk.test.whitebox.WhiteBox
- * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
- * @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.test.lib.Asserts;
-import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.cli.CommandLineOptionTest;
-
-import java.util.List;
-
-/**
- * Test verifies that low abort ratio method will be deoptimized with
- * rtm_state_change reason and will continue to use RTM-based lock
- * elision after that.
- * This test make asserts on total locks count done by compiled method,
- * so in order to avoid issue with retriable locks -XX:RTMRetryCount=0 is used.
- * For more details on that issue see {@link TestUseRTMAfterLockInflation}.
- */
-public class TestRTMDeoptOnLowAbortRatio {
- private static final long LOCKING_THRESHOLD = 100L;
- private static final long ABORT_THRESHOLD = LOCKING_THRESHOLD / 2L;
-
- protected void runTestCases() throws Throwable {
- verifyRTMDeopt(false);
- verifyRTMDeopt(true);
- }
-
- private void verifyRTMDeopt(boolean useStackLock) throws Throwable {
- CompilableTest test = new Test();
- String logFileName = String.format("rtm_deopt_%s_stack_lock.xml",
- useStackLock ? "use" : "no");
-
- OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest(
- logFileName,
- test,
- "-XX:+UseRTMDeopt",
- CommandLineOptionTest.prepareBooleanFlag("UseRTMForStackLocks",
- useStackLock),
- CommandLineOptionTest.prepareNumericFlag("RTMLockingThreshold",
- TestRTMDeoptOnLowAbortRatio.LOCKING_THRESHOLD),
- CommandLineOptionTest.prepareNumericFlag("RTMAbortThreshold",
- TestRTMDeoptOnLowAbortRatio.ABORT_THRESHOLD),
- "-XX:RTMAbortRatio=100",
- "-XX:CompileThreshold=1",
- "-XX:RTMRetryCount=0",
- "-XX:RTMTotalCountIncrRate=1",
- "-XX:+PrintPreciseRTMLockingStatistics",
- Test.class.getName(),
- Boolean.toString(!useStackLock)
- );
-
- outputAnalyzer.shouldHaveExitValue(0);
-
- int firedTraps = RTMTestBase.firedRTMStateChangeTraps(logFileName);
-
- Asserts.assertEQ(firedTraps, 1,
- "Expected to get only one deoptimization due to rtm"
- + " state change");
-
- List statistics = RTMLockingStatistics.fromString(
- test.getMethodWithLockName(), outputAnalyzer.getOutput());
-
- Asserts.assertEQ(statistics.size(), 2,
- "VM output should contain two RTM locking "
- + "statistics entries for method "
- + test.getMethodWithLockName());
-
- RTMLockingStatistics statisticsBeforeDeopt = null;
-
- for (RTMLockingStatistics s : statistics) {
- if (s.getTotalLocks()
- == TestRTMDeoptOnLowAbortRatio.LOCKING_THRESHOLD) {
- Asserts.assertNull(statisticsBeforeDeopt,
- "Only one abort was expected during test run");
- statisticsBeforeDeopt = s;
- }
- }
-
- Asserts.assertNotNull(statisticsBeforeDeopt,
- "After LockThreshold was reached, method should be recompiled "
- + "with rtm lock eliding.");
- }
-
- public static class Test implements CompilableTest {
- private final XAbortProvoker xabort = new XAbortProvoker();
- private final Object monitor = new Object();
-
- @Override
- public String getMethodWithLockName() {
- return this.getClass().getName() + "::forceAbort";
- }
-
- @Override
- public String[] getMethodsToCompileNames() {
- return new String[] { getMethodWithLockName(),
- XAbortProvoker.class.getName() + "::doAbort" };
- }
-
- public void forceAbort(boolean abort) {
- synchronized(monitor) {
- if (abort) {
- xabort.doAbort();
- }
- }
- }
-
- /**
- * Usage:
- * Test <inflate monitor>
- */
- public static void main(String args[]) throws Throwable {
- Asserts.assertGTE(args.length, 1, "One argument required.");
- Test t = new Test();
- boolean shouldBeInflated = Boolean.valueOf(args[0]);
- if (shouldBeInflated) {
- AbortProvoker.inflateMonitor(t.monitor);
- }
- for (int i = 0; i < AbortProvoker.DEFAULT_ITERATIONS; i++) {
- AbortProvoker.verifyMonitorState(t.monitor, shouldBeInflated);
- t.forceAbort(i >= TestRTMDeoptOnLowAbortRatio.ABORT_THRESHOLD);
- }
- }
- }
-
- public static void main(String args[]) throws Throwable {
- new TestRTMDeoptOnLowAbortRatio().runTestCases();
- }
-}
diff --git a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMLockingCalculationDelay.java b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMLockingCalculationDelay.java
deleted file mode 100644
index 053e14d583fb8..0000000000000
--- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMLockingCalculationDelay.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (c) 2014, 2022, 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.
- */
-
-/**
- * @test
- * @bug 8031320
- * @summary Verify that RTMLockingCalculationDelay affect when
- * abort ratio calculation is started.
- * @library /test/lib /
- * @modules java.base/jdk.internal.misc
- * java.management
- * @requires vm.rtm.cpu & vm.rtm.compiler
- * @build jdk.test.whitebox.WhiteBox
- * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
- * @run main/othervm/native -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- * -XX:+WhiteBoxAPI
- * compiler.rtm.locking.TestRTMLockingCalculationDelay
- */
-
-package compiler.rtm.locking;
-
-import compiler.testlibrary.rtm.AbortProvoker;
-import compiler.testlibrary.rtm.AbortType;
-import compiler.testlibrary.rtm.RTMTestBase;
-import jdk.test.lib.Asserts;
-import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.cli.CommandLineOptionTest;
-
-/**
- * Test verifies that abort ratio calculation could be delayed using
- * RTMLockingCalculationDelay option.
- */
-public class TestRTMLockingCalculationDelay {
- private static final boolean INFLATE_MONITOR = true;
-
- protected void runTestCases() throws Throwable {
- // verify that calculation will be started immediately
- verifyLockingCalculationDelay(0, 0, true);
-
- // verify that calculation will not be started during
- // first 10 minutes, while test will be started immediately
- verifyLockingCalculationDelay(600000, 0, false);
-
- // verify that calculation will be started after a second
- verifyLockingCalculationDelay(1000, 1000, true);
- }
-
- private void verifyLockingCalculationDelay(long delay, long testDelay,
- boolean deoptExpected) throws Throwable {
- AbortProvoker provoker = AbortType.XABORT.provoker();
- String logFileName = String.format("rtm_delay_%d_%d.xml", delay,
- testDelay);
-
- OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest(
- logFileName,
- provoker,
- "-XX:+UseRTMDeopt",
- CommandLineOptionTest.prepareNumericFlag(
- "RTMLockingCalculationDelay", delay),
- "-XX:RTMAbortRatio=0",
- "-XX:RTMAbortThreshold=0",
- AbortProvoker.class.getName(),
- AbortType.XABORT.toString(),
- Boolean.toString(
- TestRTMLockingCalculationDelay.INFLATE_MONITOR),
- Long.toString(AbortProvoker.DEFAULT_ITERATIONS),
- Long.toString(testDelay)
- );
-
- outputAnalyzer.shouldHaveExitValue(0);
-
- int deopts = RTMTestBase.firedRTMStateChangeTraps(logFileName);
-
- if (deoptExpected) {
- Asserts.assertGT(deopts, 0, "At least one deoptimization due to "
- + "rtm_state_chage is expected");
- } else {
- Asserts.assertEQ(deopts, 0, "No deoptimizations due to "
- + "rtm_state_chage are expected");
- }
- }
-
- public static void main(String args[]) throws Throwable {
- new TestRTMLockingCalculationDelay().runTestCases();
- }
-}
diff --git a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMLockingThreshold.java b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMLockingThreshold.java
deleted file mode 100644
index 913fac3068b21..0000000000000
--- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMLockingThreshold.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Copyright (c) 2014, 2022, 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.
- */
-
-/**
- * @test
- * @bug 8031320
- * @summary Verify that RTMLockingThreshold affects rtm state transition
- * ProfileRTM => UseRTM.
- * @library /test/lib /
- * @modules java.base/jdk.internal.misc
- * java.management
- * @requires vm.rtm.cpu & vm.rtm.compiler
- * @build jdk.test.whitebox.WhiteBox
- * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
- * @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.test.lib.Asserts;
-import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.cli.CommandLineOptionTest;
-
-import java.util.List;
-
-/**
- * Test verifies that RTMLockingThreshold option actually affects how soon
- * method will be deoptimized on low abort ratio.
- */
-public class TestRTMLockingThreshold {
-
- /**
- * We use non-zero abort threshold to avoid abort related to
- * interrupts, VMM calls, etc. during first lock attempt.
- *
- */
- private static final int MIN_ABORT_THRESHOLD = 10;
-
- protected void runTestCases() throws Throwable {
- verifyLockingThreshold(0, false);
- verifyLockingThreshold(100, false);
- verifyLockingThreshold(1000, false);
-
- verifyLockingThreshold(0, true);
- verifyLockingThreshold(100, true);
- verifyLockingThreshold(1000, true);
- }
-
- private void verifyLockingThreshold(int lockingThreshold,
- boolean useStackLock) throws Throwable {
- CompilableTest test = new Test();
-
- int abortThreshold = Math.max(lockingThreshold / 2,
- TestRTMLockingThreshold.MIN_ABORT_THRESHOLD);
-
- OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest(
- test,
- "-XX:CompileThreshold=1",
- CommandLineOptionTest.prepareBooleanFlag("UseRTMForStackLocks",
- useStackLock),
- "-XX:+UseRTMDeopt",
- "-XX:RTMTotalCountIncrRate=1",
- "-XX:RTMRetryCount=0",
- CommandLineOptionTest.prepareNumericFlag("RTMAbortThreshold",
- abortThreshold),
- CommandLineOptionTest.prepareNumericFlag("RTMLockingThreshold",
- lockingThreshold),
- "-XX:RTMAbortRatio=100",
- "-XX:+PrintPreciseRTMLockingStatistics",
- Test.class.getName(),
- Boolean.toString(!useStackLock),
- Integer.toString(lockingThreshold)
- );
-
- outputAnalyzer.shouldHaveExitValue(0);
-
- List statistics = RTMLockingStatistics.fromString(
- test.getMethodWithLockName(), outputAnalyzer.getOutput());
-
- Asserts.assertEQ(statistics.size(), 2, "VM output should contain two "
- + "RTM locking statistics entries.");
-
- /**
- * If RTMLockingThreshold==0, then we have to make at least 1 call.
- */
- long expectedValue = lockingThreshold;
- if (expectedValue == 0) {
- expectedValue++;
- }
-
- RTMLockingStatistics statBeforeDeopt = null;
- for (RTMLockingStatistics s : statistics) {
- if (s.getTotalLocks() == expectedValue) {
- Asserts.assertNull(statBeforeDeopt,
- "Only one statistics entry should contain aborts");
- statBeforeDeopt = s;
- }
- }
-
- Asserts.assertNotNull(statBeforeDeopt, "There should be exactly one "
- + "statistics entry corresponding to ProfileRTM state.");
- }
-
- public static class Test implements CompilableTest {
- // Following field have to be static in order to avoid escape analysis.
- @SuppressWarnings("UnsuedDeclaration")
- private static int field = 0;
- private static final int TOTAL_ITERATIONS = 10000;
- private final XAbortProvoker xabort = new XAbortProvoker();
- private final Object monitor = new Object();
-
- @Override
- public String getMethodWithLockName() {
- return this.getClass().getName() + "::lock";
- }
-
- @Override
- public String[] getMethodsToCompileNames() {
- return new String[] { getMethodWithLockName(),
- XAbortProvoker.class.getName() + "::doAbort" };
- }
-
- public void lock(boolean abort) {
- synchronized(monitor) {
- if (abort) {
- Test.field += xabort.doAbort();
- }
- }
- }
-
- /**
- * Usage:
- * Test <inflate monitor>
- */
- public static void main(String args[]) throws Throwable {
- Asserts.assertGTE(args.length, 2, "Two arguments required.");
- Test t = new Test();
- boolean shouldBeInflated = Boolean.valueOf(args[0]);
- int lockingThreshold = Integer.valueOf(args[1]);
- if (shouldBeInflated) {
- AbortProvoker.inflateMonitor(t.monitor);
- }
- for (int i = 0; i < Test.TOTAL_ITERATIONS; i++) {
- AbortProvoker.verifyMonitorState(t.monitor, shouldBeInflated);
- t.lock(i >= lockingThreshold / 2);
- }
- }
- }
-
- public static void main(String args[]) throws Throwable {
- new TestRTMLockingThreshold().runTestCases();
- }
-}
diff --git a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMRetryCount.java b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMRetryCount.java
deleted file mode 100644
index ed09be05d212d..0000000000000
--- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMRetryCount.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 2014, 2022, 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.
- */
-
-/**
- * @test
- * @bug 8031320
- * @summary Verify that RTMRetryCount affects actual amount of retries.
- * @library /test/lib /
- * @modules java.base/jdk.internal.misc
- * java.management
- * @requires vm.rtm.cpu & vm.rtm.compiler
- * @build jdk.test.whitebox.WhiteBox
- * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- * -XX:+WhiteBoxAPI
- * compiler.rtm.locking.TestRTMRetryCount
- */
-
-package compiler.rtm.locking;
-
-import compiler.testlibrary.rtm.BusyLock;
-import compiler.testlibrary.rtm.CompilableTest;
-import compiler.testlibrary.rtm.RTMLockingStatistics;
-import compiler.testlibrary.rtm.RTMTestBase;
-import jdk.test.lib.Asserts;
-import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.cli.CommandLineOptionTest;
-
-import java.util.List;
-
-/**
- * Test verifies that RTMRetryCount option actually affects amount of
- * retries on lock busy.
- */
-public class TestRTMRetryCount {
- /**
- * Time in ms, during which busy lock will be locked.
- */
- private static final int LOCKING_TIME = 5000;
- private static final boolean INFLATE_MONITOR = true;
-
- protected void runTestCases() throws Throwable {
- verifyRTMRetryCount(0);
- verifyRTMRetryCount(1);
- verifyRTMRetryCount(5);
- verifyRTMRetryCount(10);
- }
-
- private void verifyRTMRetryCount(int retryCount) throws Throwable {
- CompilableTest busyLock = new BusyLock();
- long expectedAborts = retryCount + 1L;
-
- OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest(
- busyLock,
- "-XX:-UseRTMXendForLockBusy",
- "-XX:RTMTotalCountIncrRate=1",
- CommandLineOptionTest.prepareNumericFlag("RTMRetryCount",
- retryCount),
- "-XX:RTMTotalCountIncrRate=1",
- "-XX:+PrintPreciseRTMLockingStatistics",
- BusyLock.class.getName(),
- Boolean.toString(TestRTMRetryCount.INFLATE_MONITOR),
- Integer.toString(TestRTMRetryCount.LOCKING_TIME)
- );
-
- outputAnalyzer.shouldHaveExitValue(0);
-
- List statistics = RTMLockingStatistics.fromString(
- busyLock.getMethodWithLockName(), outputAnalyzer.getStdout());
-
- Asserts.assertEQ(statistics.size(), 1, "VM output should contain "
- + "exactly one rtm locking statistics entry for method "
- + busyLock.getMethodWithLockName());
-
- Asserts.assertEQ(statistics.get(0).getTotalAborts(), expectedAborts,
- String.format("It is expected to get %d aborts",
- expectedAborts));
- }
-
- public static void main(String args[]) throws Throwable {
- new TestRTMRetryCount().runTestCases();
- }
-}
diff --git a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMSpinLoopCount.java b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMSpinLoopCount.java
deleted file mode 100644
index 8702ae0b73439..0000000000000
--- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMSpinLoopCount.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 2014, 2022, 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.
- */
-
-/**
- * @test
- * @bug 8031320
- * @summary Verify that RTMSpinLoopCount affects time spent
- * between locking attempts.
- * @library /test/lib /
- * @modules java.base/jdk.internal.misc
- * java.management
- * @requires vm.rtm.cpu & vm.rtm.compiler
- * @build jdk.test.whitebox.WhiteBox
- * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- * -XX:+WhiteBoxAPI
- * compiler.rtm.locking.TestRTMSpinLoopCount
- */
-
-package compiler.rtm.locking;
-
-import compiler.testlibrary.rtm.BusyLock;
-import compiler.testlibrary.rtm.CompilableTest;
-import compiler.testlibrary.rtm.RTMLockingStatistics;
-import compiler.testlibrary.rtm.RTMTestBase;
-import jdk.test.lib.Asserts;
-import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.cli.CommandLineOptionTest;
-import jdk.test.lib.Platform;
-
-import java.util.List;
-
-/**
- * Test verifies that RTMSpinLoopCount increase time spent between retries
- * by comparing amount of retries done with different RTMSpinLoopCount's values.
- */
-public class TestRTMSpinLoopCount {
- private static final int LOCKING_TIME = 1000;
- private static final int RTM_RETRY_COUNT = 1000;
- private static final boolean INFLATE_MONITOR = true;
- private static final long MAX_ABORTS = RTM_RETRY_COUNT + 1L;
- private static int[] SPIN_LOOP_COUNTS;
-
- protected void runTestCases() throws Throwable {
-
- SPIN_LOOP_COUNTS = new int[] { 0, 100, 1_000, 10_000, 100_000 };
-
- long[] aborts = new long[TestRTMSpinLoopCount.SPIN_LOOP_COUNTS.length];
-
- for (int i = 0; i < TestRTMSpinLoopCount.SPIN_LOOP_COUNTS.length; i++) {
- aborts[i] = getAbortsCountOnLockBusy(
- TestRTMSpinLoopCount.SPIN_LOOP_COUNTS[i]);
- }
-
- for (int i = 1; i < aborts.length; i++) {
- Asserts.assertLTE(aborts[i], aborts[i - 1], "Increased spin loop "
- + "count should not increase retries count.");
- }
- }
-
- private long getAbortsCountOnLockBusy(int spinLoopCount) throws Throwable {
- CompilableTest test = new BusyLock();
-
- OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest(
- test,
- CommandLineOptionTest.prepareNumericFlag("RTMRetryCount",
- TestRTMSpinLoopCount.RTM_RETRY_COUNT),
- CommandLineOptionTest.prepareNumericFlag("RTMSpinLoopCount",
- spinLoopCount),
- "-XX:-UseRTMXendForLockBusy",
- "-XX:RTMTotalCountIncrRate=1",
- "-XX:+PrintPreciseRTMLockingStatistics",
- BusyLock.class.getName(),
- Boolean.toString(TestRTMSpinLoopCount.INFLATE_MONITOR),
- Integer.toString(TestRTMSpinLoopCount.LOCKING_TIME)
- );
-
- outputAnalyzer.shouldHaveExitValue(0);
-
- List statistics = RTMLockingStatistics.fromString(
- test.getMethodWithLockName(), outputAnalyzer.getOutput());
-
- Asserts.assertEQ(statistics.size(), 1,
- "VM output should contain exactly one entry for method "
- + test.getMethodWithLockName());
-
- RTMLockingStatistics lock = statistics.get(0);
-
- Asserts.assertLTE(lock.getTotalAborts(),
- TestRTMSpinLoopCount.MAX_ABORTS, String.format("Total aborts "
- + "count (%d) should be less or equal to %d",
- lock.getTotalAborts(),
- TestRTMSpinLoopCount.MAX_ABORTS));
-
- return lock.getTotalAborts();
- }
-
- public static void main(String args[]) throws Throwable {
- new TestRTMSpinLoopCount().runTestCases();
- }
-}
diff --git a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMTotalCountIncrRate.java b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMTotalCountIncrRate.java
deleted file mode 100644
index e0a8394570e03..0000000000000
--- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMTotalCountIncrRate.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright (c) 2014, 2022, 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.
- */
-
-/**
- * @test
- * @bug 8031320
- * @summary Verify that RTMTotalCountIncrRate option affects
- * RTM locking statistics.
- * @library /test/lib /
- * @modules java.base/jdk.internal.misc
- * java.management
- * @requires vm.rtm.cpu & vm.rtm.compiler
- * @build jdk.test.whitebox.WhiteBox
- * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
- * @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.test.lib.Asserts;
-import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.cli.CommandLineOptionTest;
-
-import java.util.List;
-
-/**
- * Test verifies that with RTMTotalCountIncrRate=1 RTM locking statistics
- * contains precise information abort attempted locks and that with other values
- * statistics contains information abort non-zero locking attempts.
- * Since assert done for RTMTotalCountIncrRate=1 is pretty strict, test uses
- * -XX:RTMRetryCount=0 to avoid issue with retriable aborts. For more details on
- * that issue see {@link TestUseRTMAfterLockInflation}.
- */
-public class TestRTMTotalCountIncrRate {
- protected void runTestCases() throws Throwable {
- verifyLocksCount(1, false);
- verifyLocksCount(64, false);
- verifyLocksCount(128, false);
- verifyLocksCount(1, true);
- verifyLocksCount(64, true);
- verifyLocksCount(128, true);
- }
-
- private void verifyLocksCount(int incrRate, boolean useStackLock)
- throws Throwable{
- CompilableTest test = new Test();
-
- OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest(
- test,
- CommandLineOptionTest.prepareBooleanFlag("UseRTMForStackLocks",
- useStackLock),
- CommandLineOptionTest.prepareNumericFlag(
- "RTMTotalCountIncrRate", incrRate),
- "-XX:RTMRetryCount=0",
- "-XX:+PrintPreciseRTMLockingStatistics",
- Test.class.getName(),
- Boolean.toString(!useStackLock)
- );
-
- outputAnalyzer.shouldHaveExitValue(0);
-
- List statistics = RTMLockingStatistics.fromString(
- test.getMethodWithLockName(), outputAnalyzer.getOutput());
-
- Asserts.assertEQ(statistics.size(), 1, "VM output should contain "
- + "exactly one RTM locking statistics entry for method "
- + test.getMethodWithLockName());
-
- RTMLockingStatistics lock = statistics.get(0);
- if (incrRate == 1) {
- Asserts.assertEQ(lock.getTotalLocks(), Test.TOTAL_ITERATIONS,
- "Total locks should be exactly the same as amount of "
- + "iterations.");
- }
- }
-
- public static class Test implements CompilableTest {
- private static final long TOTAL_ITERATIONS = 10000L;
- 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")
- private static int field = 0;
-
- @Override
- public String getMethodWithLockName() {
- return this.getClass().getName() + "::lock";
- }
-
- @Override
- public String[] getMethodsToCompileNames() {
- return new String[] { getMethodWithLockName(), "*.doAbort" };
- }
-
- public void lock(boolean forceAbort) {
- synchronized(monitor) {
- if (forceAbort) {
- // We're calling native method in order to force
- // abort. It's done by explicit xabort call emitted
- // in SharedRuntime::generate_native_wrapper.
- // 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.
- xabort.doAbort();
- }
- Test.field++;
- }
- }
-
- /**
- * Usage:
- * Test <inflate monitor>
- */
- public static void main(String args[]) throws Throwable {
- Asserts.assertGTE(args.length, 1, "One argument required.");
- Test test = new Test();
- boolean shouldBeInflated = Boolean.valueOf(args[0]);
- if (shouldBeInflated) {
- AbortProvoker.inflateMonitor(test.monitor);
- }
- for (long i = 0L; i < Test.TOTAL_ITERATIONS; i++) {
- AbortProvoker.verifyMonitorState(test.monitor,
- shouldBeInflated);
- // Force abort on first iteration to avoid rare case when
- // there were no aborts and locks count was not incremented
- // with RTMTotalCountIncrRate > 1 (in such case JVM won't
- // print JVM locking statistics).
- test.lock(i == 0);
- }
- }
- }
-
- public static void main(String args[]) throws Throwable {
- new TestRTMTotalCountIncrRate().runTestCases();
- }
-}
diff --git a/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMAfterLockInflation.java b/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMAfterLockInflation.java
deleted file mode 100644
index d99a59ab84fd7..0000000000000
--- a/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMAfterLockInflation.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (c) 2014, 2022, 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.
- */
-
-/**
- * @test
- * @bug 8031320
- * @summary Verify that rtm locking is used for stack locks before
- * inflation and after it used for inflated locks.
- * @library /test/lib /
- * @modules java.base/jdk.internal.misc
- * java.management
- * @requires vm.rtm.cpu & vm.rtm.compiler
- * @build jdk.test.whitebox.WhiteBox
- * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
- * @run main/othervm/native -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- * -XX:+WhiteBoxAPI
- * compiler.rtm.locking.TestUseRTMAfterLockInflation
- */
-
-package compiler.rtm.locking;
-
-import compiler.testlibrary.rtm.AbortProvoker;
-import compiler.testlibrary.rtm.AbortType;
-import compiler.testlibrary.rtm.RTMLockingStatistics;
-import compiler.testlibrary.rtm.RTMTestBase;
-import jdk.test.lib.Asserts;
-import jdk.test.lib.process.OutputAnalyzer;
-
-import java.util.List;
-
-/**
- * Test verifies that RTM is used after lock inflation by executing compiled
- * method with RTM-based lock elision using stack lock first, then that lock
- * is inflated and the same compiled method invoked again.
- *
- * Compiled method invoked {@code AbortProvoker.DEFAULT_ITERATIONS} times before
- * lock inflation and the same amount of times after inflation.
- * As a result total locks count should be equal to
- * {@code 2 * AbortProvoker.DEFAULT_ITERATIONS}.
- * It is a pretty strict assertion which could fail if some retriable abort
- * happened: it could be {@code AbortType.RETRIABLE} or
- * {@code AbortType.MEM_CONFLICT}, but unfortunately abort can has both these
- * reasons simultaneously. In order to avoid false negative failures related
- * to incorrect aborts counting, -XX:RTMRetryCount=0 is used.
- */
-public class TestUseRTMAfterLockInflation {
- private static final long EXPECTED_LOCKS
- = 2L * AbortProvoker.DEFAULT_ITERATIONS;
-
- protected void runTestCases() throws Throwable {
- AbortProvoker provoker = AbortType.XABORT.provoker();
- long totalLocksCount = 0;
-
- OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest(
- provoker,
- "-XX:+UseRTMForStackLocks",
- "-XX:RTMTotalCountIncrRate=1",
- "-XX:RTMRetryCount=0",
- "-XX:+PrintPreciseRTMLockingStatistics",
- Test.class.getName(),
- AbortType.XABORT.toString());
-
- outputAnalyzer.shouldHaveExitValue(0);
-
- List statistics = RTMLockingStatistics.fromString(
- provoker.getMethodWithLockName(), outputAnalyzer.getOutput());
-
- Asserts.assertEQ(statistics.size(), 2,
- "VM output should contain two rtm locking statistics entries "
- + "for method " + provoker.getMethodWithLockName());
-
- for (RTMLockingStatistics s : statistics) {
- totalLocksCount += s.getTotalLocks();
- }
-
- Asserts.assertEQ(totalLocksCount,
- TestUseRTMAfterLockInflation.EXPECTED_LOCKS,
- "Total lock count should be greater or equal to "
- + TestUseRTMAfterLockInflation.EXPECTED_LOCKS);
- }
-
- public static class Test {
- /**
- * Usage:
- * Test <provoker type>
- */
- public static void main(String args[]) throws Throwable {
- Asserts.assertGT(args.length, 0,
- "AbortType name is expected as first argument.");
-
- AbortProvoker provoker
- = AbortType.lookup(Integer.valueOf(args[0])).provoker();
- for (int i = 0; i < AbortProvoker.DEFAULT_ITERATIONS; i++) {
- AbortProvoker.verifyMonitorState(provoker, false /*deflated*/);
- provoker.forceAbort();
- }
- provoker.inflateMonitor();
- for (int i = 0; i < AbortProvoker.DEFAULT_ITERATIONS; i++) {
- AbortProvoker.verifyMonitorState(provoker, true /*inflated*/);
- provoker.forceAbort();
- }
- }
- }
-
- public static void main(String args[]) throws Throwable {
- new TestUseRTMAfterLockInflation().runTestCases();
- }
-}
diff --git a/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMDeopt.java b/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMDeopt.java
deleted file mode 100644
index facf686739c92..0000000000000
--- a/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMDeopt.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 2014, 2022, 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.
- */
-
-/**
- * @test
- * @bug 8031320
- * @summary Verify that UseRTMDeopt affects uncommon trap installation in
- * compiled methods with synchronized block.
- * @library /test/lib /
- * @modules java.base/jdk.internal.misc
- * java.management
- * @requires vm.rtm.cpu & vm.rtm.compiler
- * @build jdk.test.whitebox.WhiteBox
- * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
- * @run main/othervm/native -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- * -XX:+WhiteBoxAPI
- * compiler.rtm.locking.TestUseRTMDeopt
- */
-
-package compiler.rtm.locking;
-
-import compiler.testlibrary.rtm.AbortProvoker;
-import compiler.testlibrary.rtm.AbortType;
-import compiler.testlibrary.rtm.RTMTestBase;
-import jdk.test.lib.Asserts;
-import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.cli.CommandLineOptionTest;
-
-/**
- * Test verifies that usage of UseRTMDeopt option affects uncommon traps usage
- * for methods that use locking.
- */
-public class TestUseRTMDeopt {
-
- protected void runTestCases() throws Throwable {
- verifyUseRTMDeopt(false);
- verifyUseRTMDeopt(true);
- }
-
- private void verifyUseRTMDeopt(boolean useRTMDeopt) throws Throwable {
- AbortProvoker provoker = AbortType.XABORT.provoker();
- String logFileName = String.format("rtm_%s_deopt.xml",
- useRTMDeopt ? "use" : "no");
-
- OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest(
- logFileName,
- provoker,
- CommandLineOptionTest.prepareBooleanFlag("UseRTMDeopt",
- useRTMDeopt),
- AbortProvoker.class.getName(),
- AbortType.XABORT.toString()
- );
-
- outputAnalyzer.shouldHaveExitValue(0);
-
- int expectedUncommonTraps = useRTMDeopt ? 1 : 0;
- int installedUncommonTraps
- = RTMTestBase.installedRTMStateChangeTraps(logFileName);
-
- Asserts.assertEQ(expectedUncommonTraps, installedUncommonTraps,
- String.format("Expected to find %d uncommon traps "
- + "installed with reason rtm_state_change.",
- expectedUncommonTraps));
- }
-
- public static void main(String args[]) throws Throwable {
- new TestUseRTMDeopt().runTestCases();
- }
-}
diff --git a/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMForInflatedLocks.java b/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMForInflatedLocks.java
deleted file mode 100644
index 0b5267a3ef6ae..0000000000000
--- a/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMForInflatedLocks.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2014, 2022, 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.
- */
-
-/**
- * @test
- * @bug 8031320
- * @summary Verify that rtm locking is used for inflated locks.
- * @library /test/lib /
- * @modules java.base/jdk.internal.misc
- * java.management
- * @requires vm.rtm.cpu & vm.rtm.compiler
- * @build jdk.test.whitebox.WhiteBox
- * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
- * @run main/othervm/native -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- * -XX:+WhiteBoxAPI
- * compiler.rtm.locking.TestUseRTMForInflatedLocks
- */
-
-package compiler.rtm.locking;
-
-import compiler.testlibrary.rtm.AbortProvoker;
-import compiler.testlibrary.rtm.AbortType;
-import compiler.testlibrary.rtm.RTMLockingStatistics;
-import compiler.testlibrary.rtm.RTMTestBase;
-import jdk.test.lib.Asserts;
-import jdk.test.lib.process.OutputAnalyzer;
-
-import java.util.List;
-
-/**
- * Test verifies that RTM-based lock elision could be used for inflated locks
- * by calling compiled method that use RTM-based lock elision and using
- * manually inflated lock.
- * Compiled method invoked {@code AbortProvoker.DEFAULT_ITERATIONS} times,
- * so total locks count should be the same.
- * This test could also be affected by retriable aborts, so -XX:RTMRetryCount=0
- * is used. For more information abort that issue see
- * {@link TestUseRTMAfterLockInflation}.
- */
-public class TestUseRTMForInflatedLocks {
-
- protected void runTestCases() throws Throwable {
- AbortProvoker provoker = AbortType.XABORT.provoker();
- RTMLockingStatistics lock;
-
- OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest(
- provoker,
- "-XX:-UseRTMForStackLocks",
- "-XX:RTMTotalCountIncrRate=1",
- "-XX:RTMRetryCount=0",
- "-XX:+PrintPreciseRTMLockingStatistics",
- AbortProvoker.class.getName(),
- AbortType.XABORT.toString());
-
- outputAnalyzer.shouldHaveExitValue(0);
-
- List statistics = RTMLockingStatistics.fromString(
- provoker.getMethodWithLockName(), outputAnalyzer.getOutput());
-
- Asserts.assertEQ(statistics.size(), 1,
- "VM output should contain exactly one rtm locking statistics "
- + "entry for method " + provoker.getMethodWithLockName());
-
- lock = statistics.get(0);
- Asserts.assertEQ(lock.getTotalLocks(), AbortProvoker.DEFAULT_ITERATIONS,
- "Total lock count should be greater or equal to "
- + AbortProvoker.DEFAULT_ITERATIONS);
- }
-
- public static void main(String args[]) throws Throwable {
- new TestUseRTMForInflatedLocks().runTestCases();
- }
-}
diff --git a/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMForStackLocks.java b/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMForStackLocks.java
deleted file mode 100644
index 720fedb613b56..0000000000000
--- a/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMForStackLocks.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 2014, 2022, 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.
- */
-
-/**
- * @test
- * @bug 8031320
- * @summary Verify that rtm locking is used for stack locks.
- * @library /test/lib /
- * @modules java.base/jdk.internal.misc
- * java.management
- * @requires vm.rtm.cpu & vm.rtm.compiler
- * @build jdk.test.whitebox.WhiteBox
- * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
- * @run main/othervm/native -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- * -XX:+WhiteBoxAPI
- * compiler.rtm.locking.TestUseRTMForStackLocks
- */
-
-package compiler.rtm.locking;
-
-import compiler.testlibrary.rtm.AbortProvoker;
-import compiler.testlibrary.rtm.AbortType;
-import compiler.testlibrary.rtm.RTMLockingStatistics;
-import compiler.testlibrary.rtm.RTMTestBase;
-import jdk.test.lib.Asserts;
-import jdk.test.lib.process.OutputAnalyzer;
-
-import java.util.List;
-
-/**
- * Test verifies that RTM-based lock elision could be used for stack locks
- * by calling compiled method that use RTM-based lock elision and using
- * stack lock.
- * Compiled method invoked {@code AbortProvoker.DEFAULT_ITERATIONS} times,
- * so total locks count should be the same.
- * This test could also be affected by retriable aborts, so -XX:RTMRetryCount=0
- * is used. For more information abort that issue see
- * {@link TestUseRTMAfterLockInflation}.
- */
-public class TestUseRTMForStackLocks {
- private static final boolean INFLATE_MONITOR = false;
-
- protected void runTestCases() throws Throwable {
- AbortProvoker provoker = AbortType.XABORT.provoker();
- RTMLockingStatistics lock;
-
- OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest(
- provoker,
- "-XX:+UseRTMForStackLocks",
- "-XX:RTMTotalCountIncrRate=1",
- "-XX:RTMRetryCount=0",
- "-XX:+PrintPreciseRTMLockingStatistics",
- AbortProvoker.class.getName(),
- AbortType.XABORT.toString(),
- Boolean.toString(TestUseRTMForStackLocks.INFLATE_MONITOR));
-
- outputAnalyzer.shouldHaveExitValue(0);
-
- List statistics = RTMLockingStatistics.fromString(
- provoker.getMethodWithLockName(), outputAnalyzer.getOutput());
-
- Asserts.assertEQ(statistics.size(), 1,
- "VM output should contain exactly one rtm locking statistics "
- + "entry for method " + provoker.getMethodWithLockName());
-
- lock = statistics.get(0);
- Asserts.assertEQ(lock.getTotalLocks(), AbortProvoker.DEFAULT_ITERATIONS,
- "Total locks count should be greater or equal to "
- + AbortProvoker.DEFAULT_ITERATIONS);
- }
-
- public static void main(String args[]) throws Throwable {
- new TestUseRTMForStackLocks().runTestCases();
- }
-}
diff --git a/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMXendForLockBusy.java b/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMXendForLockBusy.java
deleted file mode 100644
index 2eb3735855ed2..0000000000000
--- a/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMXendForLockBusy.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (c) 2014, 2022, 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.
- */
-
-/**
- * @test
- * @bug 8031320
- * @summary Verify that UseRTMXendForLockBusy option affects
- * method behaviour if lock is busy.
- * @library /test/lib /
- * @modules java.base/jdk.internal.misc
- * java.management
- * @requires vm.rtm.cpu & vm.rtm.compiler
- * @build jdk.test.whitebox.WhiteBox
- * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- * -XX:+WhiteBoxAPI
- * compiler.rtm.locking.TestUseRTMXendForLockBusy
- */
-
-package compiler.rtm.locking;
-
-import compiler.testlibrary.rtm.AbortType;
-import compiler.testlibrary.rtm.BusyLock;
-import compiler.testlibrary.rtm.CompilableTest;
-import compiler.testlibrary.rtm.RTMLockingStatistics;
-import compiler.testlibrary.rtm.RTMTestBase;
-import jdk.test.lib.Asserts;
-import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.cli.CommandLineOptionTest;
-
-import java.util.List;
-
-/**
- * Test verifies that with +UseRTMXendForLockBusy there will be no aborts
- * forced by the test.
- */
-public class TestUseRTMXendForLockBusy {
- private final static int LOCKING_TIME = 5000;
-
- protected void runTestCases() throws Throwable {
- // inflated lock, xabort on lock busy
- verifyXendForLockBusy(true, false);
- // inflated lock, xend on lock busy
- verifyXendForLockBusy(true, true);
- // stack lock, xabort on lock busy
- verifyXendForLockBusy(false, false);
- // stack lock, xend on lock busy
- verifyXendForLockBusy(false, true);
- }
-
- private void verifyXendForLockBusy(boolean inflateMonitor,
- boolean useXend) throws Throwable {
- CompilableTest test = new BusyLock();
-
- OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest(
- test,
- CommandLineOptionTest.prepareBooleanFlag("UseRTMForStackLocks",
- !inflateMonitor),
- CommandLineOptionTest.prepareBooleanFlag(
- "UseRTMXendForLockBusy",
- useXend),
- "-XX:RTMRetryCount=0",
- "-XX:RTMTotalCountIncrRate=1",
- "-XX:+PrintPreciseRTMLockingStatistics",
- BusyLock.class.getName(),
- Boolean.toString(inflateMonitor),
- Integer.toString(TestUseRTMXendForLockBusy.LOCKING_TIME)
- );
-
- outputAnalyzer.shouldHaveExitValue(0);
-
- List statistics = RTMLockingStatistics.fromString(
- test.getMethodWithLockName(), outputAnalyzer.getOutput());
-
- Asserts.assertEQ(statistics.size(), 1, "VM output should contain "
- + "exactly one rtm locking statistics entry for method "
- + test.getMethodWithLockName());
-
- long aborts = statistics.get(0).getAborts(AbortType.XABORT);
-
- if (useXend) {
- Asserts.assertEQ(aborts, 0L,
- "Expected to get no aborts on busy lock");
- } else {
- Asserts.assertGT(aborts, 0L,
- "Expected to get at least one abort on busy lock");
- }
- }
-
- public static void main(String args[]) throws Throwable {
- new TestUseRTMXendForLockBusy().runTestCases();
- }
-}
diff --git a/test/hotspot/jtreg/compiler/rtm/method_options/TestNoRTMLockElidingOption.java b/test/hotspot/jtreg/compiler/rtm/method_options/TestNoRTMLockElidingOption.java
deleted file mode 100644
index 07514e4fc37a3..0000000000000
--- a/test/hotspot/jtreg/compiler/rtm/method_options/TestNoRTMLockElidingOption.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 2014, 2022, 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.
- */
-
-/**
- * @test
- * @bug 8031320
- * @summary Verify that NoRTMLockEliding option could be applied to
- * specified method and that such method will not use rtm.
- * @library /test/lib /
- * @modules java.base/jdk.internal.misc
- * java.management
- * @requires vm.rtm.cpu & vm.rtm.compiler
- * @build jdk.test.whitebox.WhiteBox
- * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
- * @run main/othervm/native -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- * -XX:+WhiteBoxAPI
- * compiler.rtm.method_options.TestNoRTMLockElidingOption
- */
-
-package compiler.rtm.method_options;
-
-import compiler.testlibrary.rtm.AbortProvoker;
-import compiler.testlibrary.rtm.AbortType;
-import compiler.testlibrary.rtm.RTMLockingStatistics;
-import compiler.testlibrary.rtm.RTMTestBase;
-import jdk.test.lib.Asserts;
-import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.cli.CommandLineOptionTest;
-
-import java.util.List;
-
-/**
- * Test verifies that method tagged with option NoRTMLockElidingOption
- * will not use RTM-based lock elision.
- * Test invokes compiled method and checks that no deoptimization with
- * rtm_state_change reason had happened and that that VM output
- * does not contain RTM locking statistics for compiled method.
- */
-public class TestNoRTMLockElidingOption {
-
- public void runTestCases() throws Throwable {
- verifyOption(false);
- verifyOption(true);
- }
-
- public void verifyOption(boolean useStackLock) throws Throwable {
- AbortProvoker provoker = AbortType.XABORT.provoker();
- String logFileName = String.format("rtm_deopt_%s_stack_lock.xml",
- (useStackLock ? "use" : "no"));
- String methodOption = String.format("-XX:CompileCommand=option," +
- "%s,NoRTMLockEliding", provoker.getMethodWithLockName());
-
- OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest(
- logFileName,
- provoker,
- CommandLineOptionTest.prepareBooleanFlag("UseRTMForStackLocks",
- useStackLock),
- methodOption,
- "-XX:RTMTotalCountIncrRate=1",
- "-XX:+UseRTMDeopt",
- "-XX:+PrintPreciseRTMLockingStatistics",
- AbortProvoker.class.getName(),
- AbortType.XABORT.toString(),
- Boolean.toString(!useStackLock)
- );
-
- outputAnalyzer.shouldHaveExitValue(0);
-
- int firedTraps = RTMTestBase.firedRTMStateChangeTraps(logFileName);
-
- Asserts.assertEQ(firedTraps, 0,
- "No deoptimizations with rtm_state_change reason are expected");
-
- List statistics = RTMLockingStatistics.fromString(
- provoker.getMethodWithLockName(), outputAnalyzer.getOutput());
-
- Asserts.assertEQ(statistics.size(), 0,
- "VM output should not contain RTM locking statistics entries "
- + "for method " + provoker.getMethodWithLockName());
- }
-
- public static void main(String args[]) throws Throwable {
- new TestNoRTMLockElidingOption().runTestCases();
- }
-}
diff --git a/test/hotspot/jtreg/compiler/rtm/method_options/TestUseRTMLockElidingOption.java b/test/hotspot/jtreg/compiler/rtm/method_options/TestUseRTMLockElidingOption.java
deleted file mode 100644
index 4007121b4aaca..0000000000000
--- a/test/hotspot/jtreg/compiler/rtm/method_options/TestUseRTMLockElidingOption.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright (c) 2014, 2022, 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.
- */
-
-/**
- * @test
- * @bug 8031320
- * @summary Verify that UseRTMLockEliding option could be applied to
- * specified method and that such method will not be deoptimized
- * on high abort ratio.
- * @library /test/lib /
- * @modules java.base/jdk.internal.misc
- * java.management
- * @requires vm.rtm.cpu & vm.rtm.compiler
- * @build jdk.test.whitebox.WhiteBox
- * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
- * @run main/othervm/native -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- * -XX:+WhiteBoxAPI
- * compiler.rtm.method_options.TestUseRTMLockElidingOption
- */
-
-package compiler.rtm.method_options;
-
-import compiler.testlibrary.rtm.AbortProvoker;
-import compiler.testlibrary.rtm.AbortType;
-import compiler.testlibrary.rtm.RTMLockingStatistics;
-import compiler.testlibrary.rtm.RTMTestBase;
-import jdk.test.lib.Asserts;
-import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.cli.CommandLineOptionTest;
-
-import java.util.List;
-
-/**
- * Test verifies that method tagged with option UseRTMLockElidingOption
- * will use RTM-based lock elision, but will be never deoptimized with
- * rtm_state_change reason.
- * Test invokes compiled method and checks that no deoptimization with
- * rtm_state_change reason had happened and that that VM output
- * contains RTM locking statistics for compiled method and that total locks
- * count equals to method's invocations.
- * Since last assert is pretty strict, test uses -XX:RTMRetryCount=0 in order
- * to avoid issue with retriable aborts described in
- * {@link TestUseRTMAfterLockInflation}.
- */
-public class TestUseRTMLockElidingOption {
-
- public void runTestCases() throws Throwable {
- verifyOption(false);
- verifyOption(true);
- }
-
- public void verifyOption(boolean useStackLock) throws Throwable {
- AbortProvoker provoker = AbortType.XABORT.provoker();
- String logFileName = String.format("rtm_deopt_%s_stack_lock.xml",
- (useStackLock ? "use" : "no"));
- String methodOption = String.format("-XX:CompileCommand=option," +
- "%s,UseRTMLockEliding", provoker.getMethodWithLockName());
-
- OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest(
- logFileName,
- provoker,
- CommandLineOptionTest.prepareBooleanFlag("UseRTMForStackLocks",
- useStackLock),
- methodOption,
- "-XX:RTMTotalCountIncrRate=1",
- "-XX:RTMRetryCount=0",
- "-XX:+UseRTMDeopt",
- "-XX:+PrintPreciseRTMLockingStatistics",
- provoker.getClass().getName(),
- AbortType.XABORT.toString(),
- Boolean.toString(!useStackLock)
- );
-
- outputAnalyzer.shouldHaveExitValue(0);
-
- int firedTraps = RTMTestBase.firedRTMStateChangeTraps(logFileName);
-
- Asserts.assertEQ(firedTraps, 0,
- "Method deoptimization with rtm_state_change is unexpected");
-
- List statistics = RTMLockingStatistics.fromString(
- provoker.getMethodWithLockName(), outputAnalyzer.getOutput());
-
- Asserts.assertEQ(statistics.size(), 1,
- "VM output should contain exactly one RTM locking "
- + "statistics entry for method "
- + provoker.getMethodWithLockName());
-
- RTMLockingStatistics lock = statistics.get(0);
-
- Asserts.assertEQ(lock.getTotalLocks(), AbortProvoker.DEFAULT_ITERATIONS,
- "Expected to get total locks count equal to total amount of "
- + "lock attempts.");
- }
-
- public static void main(String args[]) throws Throwable {
- new TestUseRTMLockElidingOption().runTestCases();
- }
-}
diff --git a/test/hotspot/jtreg/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java b/test/hotspot/jtreg/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java
deleted file mode 100644
index 4223924b9bde3..0000000000000
--- a/test/hotspot/jtreg/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (c) 2014, 2022, 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.
- */
-
-/**
- * @test
- * @bug 8031320
- * @summary Verify that rtm locking statistics contain proper information
- * on overall aborts and locks count and count of aborts of
- * different types. Test also verify that VM output does not
- * contain rtm locking statistics when it should not.
- * @library /test/lib /
- * @modules java.base/jdk.internal.misc
- * java.management
- * @requires vm.rtm.cpu & vm.rtm.compiler
- * @build jdk.test.whitebox.WhiteBox
- * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
- * @run main/othervm/native -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- * -XX:+WhiteBoxAPI
- * compiler.rtm.print.TestPrintPreciseRTMLockingStatistics
- */
-
-
-package compiler.rtm.print;
-
-import compiler.testlibrary.rtm.AbortProvoker;
-import compiler.testlibrary.rtm.AbortType;
-import compiler.testlibrary.rtm.RTMLockingStatistics;
-import compiler.testlibrary.rtm.RTMTestBase;
-import jdk.test.lib.Asserts;
-import jdk.test.lib.process.OutputAnalyzer;
-
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * Test verifies that VM output does not contain RTM locking statistics when it
- * should not (when PrintPreciseRTMLockingStatistics is off) and that with
- * -XX:+PrintPreciseRTMLockingStatistics locking statistics contains sane
- * total locks and aborts count as well as for specific abort types.
- */
-public class TestPrintPreciseRTMLockingStatistics {
-
- public void runTestCases() throws Throwable {
- verifyNoStatistics();
- verifyStatistics();
- }
-
- // verify that VM output does not contain
- // rtm locking statistics
- private void verifyNoStatistics() throws Throwable {
- verifyNoStatistics(AbortType.XABORT);
-
- verifyNoStatistics(AbortType.XABORT,
- "-XX:-PrintPreciseRTMLockingStatistics");
-
- verifyNoStatistics(AbortType.XABORT, "-XX:-UseRTMLocking",
- "-XX:+PrintPreciseRTMLockingStatistics");
- }
-
- // verify that rtm locking statistics contain information
- // about each type of aborts
- private void verifyStatistics() throws Throwable {
- verifyAbortsCount(AbortType.XABORT);
- verifyAbortsCount(AbortType.MEM_CONFLICT);
- verifyAbortsCount(AbortType.BUF_OVERFLOW);
- verifyAbortsCount(AbortType.NESTED_ABORT);
- }
-
- private void verifyNoStatistics(AbortType abortProvokerType,
- String... vmOpts) throws Throwable {
- AbortProvoker provoker = abortProvokerType.provoker();
- List finalVMOpts = new LinkedList<>();
- Collections.addAll(finalVMOpts, vmOpts);
- Collections.addAll(finalVMOpts, AbortProvoker.class.getName(),
- abortProvokerType.toString());
-
- OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest(provoker,
- finalVMOpts.toArray(new String[finalVMOpts.size()]));
-
- outputAnalyzer.shouldHaveExitValue(0);
-
- List statistics = RTMLockingStatistics.fromString(
- outputAnalyzer.getOutput());
-
- Asserts.assertEQ(statistics.size(), 0, "VM output should not contain "
- + "any RTM locking statistics");
- }
-
- private void verifyAbortsCount(AbortType abortType) throws Throwable {
- AbortProvoker provoker = abortType.provoker();
-
- OutputAnalyzer outputAnalyzer = RTMTestBase.executeRTMTest(
- provoker,
- "-XX:+PrintPreciseRTMLockingStatistics",
- AbortProvoker.class.getName(),
- abortType.toString());
-
- outputAnalyzer.shouldHaveExitValue(0);
-
- List statistics = RTMLockingStatistics.fromString(
- provoker.getMethodWithLockName(),outputAnalyzer.getOutput());
-
- Asserts.assertGT(statistics.size(), 0, "VM output should contain one "
- + "rtm locking statistics entry for method "
- + provoker.getMethodWithLockName());
-
- RTMLockingStatistics lock = statistics.get(0);
-
- Asserts.assertGT(lock.getTotalAborts(), 0L,
- "RTM locking statistics should contain non zero total aborts "
- + "count");
-
- Asserts.assertGT(lock.getAborts(abortType), 0L, String.format(
- "RTM locking statistics should contain non zero aborts count "
- + "for abort reason %s", abortType));
- }
-
- public static void main(String args[]) throws Throwable {
- new TestPrintPreciseRTMLockingStatistics().runTestCases();
- }
-}
diff --git a/test/hotspot/jtreg/compiler/testlibrary/rtm/AbortProvoker.java b/test/hotspot/jtreg/compiler/testlibrary/rtm/AbortProvoker.java
deleted file mode 100644
index cf74942aadfd2..0000000000000
--- a/test/hotspot/jtreg/compiler/testlibrary/rtm/AbortProvoker.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * Copyright (c) 2014, 2022, 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.
- */
-
-package compiler.testlibrary.rtm;
-
-import jdk.test.lib.Asserts;
-import jdk.test.whitebox.WhiteBox;
-
-import java.util.Objects;
-import java.util.concurrent.BrokenBarrierException;
-import java.util.concurrent.CyclicBarrier;
-
-/**
- * Base class for different transactional execution abortion
- * provokers aimed to force abort due to specified reason.
- */
-public abstract class AbortProvoker implements CompilableTest {
- public static final long DEFAULT_ITERATIONS = 10000L;
- private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
- @SuppressWarnings("unused")
- private static int sharedState = 0;
- /**
- * Inflates monitor associated with object {@code monitor}.
- * Inflation is forced by entering the same monitor from
- * two different threads.
- *
- * @param monitor monitor to be inflated.
- * @return inflated monitor.
- * @throws Exception if something went wrong.
- */
- public static Object inflateMonitor(Object monitor) throws Exception {
- CyclicBarrier barrier = new CyclicBarrier(2);
-
- Runnable inflatingRunnable = () -> {
- synchronized (monitor) {
- try {
- barrier.await();
- } catch (BrokenBarrierException | InterruptedException e) {
- throw new RuntimeException(
- "Synchronization issue occurred.", e);
- }
- try {
- monitor.wait();
- } catch (InterruptedException e) {
- throw new AssertionError("The thread waiting on an"
- + " inflated monitor was interrupted, thus test"
- + " results may be incorrect.", e);
- }
- }
- };
-
- Thread t = new Thread(inflatingRunnable);
- t.setDaemon(true);
- t.start();
- // Wait until thread t enters the monitor.
- barrier.await();
- synchronized (monitor) {
- // At this point thread t is already waiting on the monitor.
- // Modifying static field just to avoid lock's elimination.
- sharedState++;
- }
- verifyMonitorState(monitor, true /* inflated */);
- return monitor;
- }
-
- /**
- * Verifies that {@code monitor} is a stack-lock or inflated lock depending
- * on {@code shouldBeInflated} value. If {@code monitor} is inflated while
- * it is expected that it should be a stack-lock, then this method attempts
- * to deflate it by forcing a safepoint and then verifies the state once
- * again.
- *
- * @param monitor monitor to be verified.
- * @param shouldBeInflated flag indicating whether or not monitor is
- * expected to be inflated.
- * @throws RuntimeException if the {@code monitor} in a wrong state.
- */
- public static void verifyMonitorState(Object monitor,
- boolean shouldBeInflated) {
- if (!shouldBeInflated && WHITE_BOX.isMonitorInflated(monitor)) {
- boolean did_deflation = WHITE_BOX.deflateIdleMonitors();
- Asserts.assertEQ(did_deflation, true,
- "deflateIdleMonitors() should have worked.");
- }
- Asserts.assertEQ(WHITE_BOX.isMonitorInflated(monitor), shouldBeInflated,
- "Monitor in a wrong state.");
- }
- /**
- * Verifies that monitor used by the {@code provoker} is a stack-lock or
- * inflated lock depending on {@code shouldBeInflated} value. If such
- * monitor is inflated while it is expected that it should be a stack-lock,
- * then this method attempts to deflate it by forcing a safepoint and then
- * verifies the state once again.
- *
- * @param provoker AbortProvoker whose monitor's state should be verified.
- * @param shouldBeInflated flag indicating whether or not monitor is
- * expected to be inflated.
- * @throws RuntimeException if the {@code monitor} in a wrong state.
- */
- public static void verifyMonitorState(AbortProvoker provoker,
- boolean shouldBeInflated) {
- verifyMonitorState(provoker.monitor, shouldBeInflated);
- }
-
- /**
- * Get instance of specified AbortProvoker, inflate associated monitor
- * if needed and then invoke forceAbort method in a loop.
- *
- * Usage:
- * AbortProvoker <AbortType name> [<inflate monitor>
- * [<iterations> [ <delay>]]]
- *
- * Default parameters are:
- *
- * - inflate monitor = true
- * - iterations = {@code AbortProvoker.DEFAULT_ITERATIONS}
- * - delay = 0
- *
- */
- public static void main(String args[]) throws Throwable {
- Asserts.assertGT(args.length, 0, "At least one argument is required.");
-
- AbortType abortType = AbortType.lookup(Integer.valueOf(args[0]));
- boolean monitorShouldBeInflated = true;
- long iterations = AbortProvoker.DEFAULT_ITERATIONS;
-
- if (args.length > 1) {
- monitorShouldBeInflated = Boolean.valueOf(args[1]);
-
- if (args.length > 2) {
- iterations = Long.valueOf(args[2]);
-
- if (args.length > 3) {
- Thread.sleep(Integer.valueOf(args[3]));
- }
- }
- }
-
- AbortProvoker provoker = abortType.provoker();
-
- if (monitorShouldBeInflated) {
- provoker.inflateMonitor();
- }
-
- for (long i = 0; i < iterations; i++) {
- AbortProvoker.verifyMonitorState(provoker, monitorShouldBeInflated);
- provoker.forceAbort();
- }
- }
-
- protected final Object monitor;
-
- protected AbortProvoker() {
- this(new Object());
- }
-
- protected AbortProvoker(Object monitor) {
- this.monitor = Objects.requireNonNull(monitor);
- }
-
- /**
- * Inflates monitor used by this AbortProvoker instance.
- * @throws Exception
- */
- public void inflateMonitor() throws Exception {
- AbortProvoker.inflateMonitor(monitor);
- }
-
- /**
- * Forces transactional execution abortion.
- */
- public abstract void forceAbort();
-
- /**
- * Returns names of all methods that have to be compiled
- * in order to successfully force transactional execution
- * abortion.
- *
- * @return array with methods' names that have to be compiled.
- */
- @Override
- public String[] getMethodsToCompileNames() {
- return new String[] { getMethodWithLockName() };
- }
-
- /**
- * Returns name of the method that will contain monitor whose locking
- * will be elided using transactional execution.
- *
- * @return name of the method that will contain elided lock.
- */
- @Override
- public String getMethodWithLockName() {
- return this.getClass().getName() + "::forceAbort";
- }
-}
diff --git a/test/hotspot/jtreg/compiler/testlibrary/rtm/AbortType.java b/test/hotspot/jtreg/compiler/testlibrary/rtm/AbortType.java
deleted file mode 100644
index dd439111afa4c..0000000000000
--- a/test/hotspot/jtreg/compiler/testlibrary/rtm/AbortType.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2014, 2015, 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.
- */
-
-package compiler.testlibrary.rtm;
-
-import jdk.test.lib.Asserts;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Type of transactional execution abort.
- * For more details on different abort types please see
- * shared/vm/runtime/rtmLocking.hpp
- */
-public enum AbortType {
- XABORT(0),
- RETRIABLE(1),
- MEM_CONFLICT(2),
- BUF_OVERFLOW(3),
- DEBUG_BREAKPOINT(4),
- NESTED_ABORT(5);
-
- private final int type;
- private static final Map LOOKUP_MAP = new HashMap<>();
-
- static {
- for (AbortType abortType : AbortType.values()) {
- Asserts.assertFalse(LOOKUP_MAP.containsKey(abortType.type),
- "Abort type values should be unique.");
- LOOKUP_MAP.put(abortType.type, abortType);
- }
- }
-
- private AbortType(int type) {
- this.type = type;
- }
-
- /**
- * Returns AbortProvoker for aborts represented by this abort type.
- *
- * @return an AbortProvoker instance
- */
- public AbortProvoker provoker() {
- return AbortType.createNewProvoker(this);
- }
-
- public static AbortType lookup(int type) {
- Asserts.assertLT(type, AbortType.values().length,
- "Unknown abort type.");
- return LOOKUP_MAP.get(type);
- }
-
- /**
- * Returns transaction execution abort provoker for specified abortion type.
- *
- * @param type a type of abort which will be forced by returned
- * AbortProvoker instance.
- * @return AbortProvoker instance that will force abort of specified type
- * @throws RuntimeException if there is no provoker for specified type
- */
- private static AbortProvoker createNewProvoker(AbortType type) {
- switch (type) {
- case XABORT:
- return new XAbortProvoker();
- case MEM_CONFLICT:
- return new MemoryConflictProvoker();
- case BUF_OVERFLOW:
- return new BufferOverflowProvoker();
- case NESTED_ABORT:
- return new NestedAbortProvoker();
- default:
- throw new RuntimeException("No provoker exists for type "
- + type.name());
- }
- }
-
- @Override
- public String toString() {
- return Integer.toString(type);
- }
-}
diff --git a/test/hotspot/jtreg/compiler/testlibrary/rtm/BufferOverflowProvoker.java b/test/hotspot/jtreg/compiler/testlibrary/rtm/BufferOverflowProvoker.java
deleted file mode 100644
index 6a3ab4e35aa1b..0000000000000
--- a/test/hotspot/jtreg/compiler/testlibrary/rtm/BufferOverflowProvoker.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2014, 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.
- */
-
-package compiler.testlibrary.rtm;
-
-/**
- * In order to provoke transactional execution abort due to
- * internal's buffer overflow BufferOverflowProvoker modifies
- * 1MB of BYTES during single transaction.
- */
-class BufferOverflowProvoker extends AbortProvoker {
- /**
- * To force buffer overflow abort we modify memory region with
- * size more then L1d cache size.
- */
- private static final int MORE_THAN_L1D_SIZE = 1024 * 1024;
- private static final byte[] DATA = new byte[MORE_THAN_L1D_SIZE];
-
- @Override
- public void forceAbort() {
- synchronized(monitor) {
- for (int i = 0; i < BufferOverflowProvoker.DATA.length; i++) {
- BufferOverflowProvoker.DATA[i]++;
- }
- }
- }
-}
diff --git a/test/hotspot/jtreg/compiler/testlibrary/rtm/BusyLock.java b/test/hotspot/jtreg/compiler/testlibrary/rtm/BusyLock.java
deleted file mode 100644
index 79120a64136f7..0000000000000
--- a/test/hotspot/jtreg/compiler/testlibrary/rtm/BusyLock.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (c) 2014, 2015, 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.
- */
-
-package compiler.testlibrary.rtm;
-
-import java.util.concurrent.BrokenBarrierException;
-import java.util.concurrent.CyclicBarrier;
-
-/**
- * Test case for busy lock scenario.
- * One thread enters the monitor and sleep for a while.
- * Another thread is blocked on the same monitor.
- */
-public class BusyLock implements CompilableTest, Runnable {
- private static final int DEFAULT_TIMEOUT = 1000;
- private final CyclicBarrier barrier;
-
- // Following field have to be static in order to avoid escape analysis.
- @SuppressWarnings("UnsuedDeclaration")
- private static int field = 0;
- protected final Object monitor;
- protected final int timeout;
-
- public BusyLock() {
- this(BusyLock.DEFAULT_TIMEOUT);
- }
-
- public BusyLock(int timeout) {
- this.timeout = timeout;
- this.monitor = new Object();
- this.barrier = new CyclicBarrier(2);
- }
-
- @Override
- public void run() {
- try {
- synchronized (monitor) {
- barrier.await();
- Thread.sleep(timeout);
- }
- } catch (InterruptedException | BrokenBarrierException e) {
- throw new RuntimeException("Synchronization error happened.", e);
- }
- }
-
- public void syncAndTest() {
- try {
- // wait until monitor is locked by a ::run method
- barrier.await();
- } catch (InterruptedException | BrokenBarrierException e) {
- throw new RuntimeException("Synchronization error happened.", e);
- }
- test();
- }
-
- public void test() {
- synchronized(monitor) {
- BusyLock.field++;
- }
- }
-
- @Override
- public String getMethodWithLockName() {
- return this.getClass().getName() + "::test";
- }
-
- @Override
- public String[] getMethodsToCompileNames() {
- return new String[] { getMethodWithLockName() };
- }
-
- /**
- * Usage:
- * BusyLock [ <inflate monitor> [ <timeout> ] ]
- *
- * Default values are:
- *
- * - inflate monitor = {@code true}
- * - timeout = {@code BusyLock.DEFAULT_TIMEOUT}
- *
- */
- public static void main(String args[]) throws Exception {
- int timeoutValue = BusyLock.DEFAULT_TIMEOUT;
- boolean inflateMonitor = true;
-
- if (args.length > 0 ) {
- inflateMonitor = Boolean.valueOf(args[0]);
-
- if (args.length > 1) {
- timeoutValue = Integer.valueOf(args[1]);
- }
- }
-
- BusyLock busyLock = new BusyLock(timeoutValue);
-
- if (inflateMonitor) {
- AbortProvoker.inflateMonitor(busyLock.monitor);
- }
-
- Thread t = new Thread(busyLock);
- t.start();
- busyLock.syncAndTest();
- t.join();
- }
-}
diff --git a/test/hotspot/jtreg/compiler/testlibrary/rtm/CompilableTest.java b/test/hotspot/jtreg/compiler/testlibrary/rtm/CompilableTest.java
deleted file mode 100644
index da701fa30a65d..0000000000000
--- a/test/hotspot/jtreg/compiler/testlibrary/rtm/CompilableTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2014, 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.
- */
-
-package compiler.testlibrary.rtm;
-
-/**
- * Interface for test scenarios that contain methods
- * that should be compiled.
- */
-public interface CompilableTest {
- /**
- * @return array with methods' names that should be compiled.
- */
- String[] getMethodsToCompileNames();
-
- /**
- * @return name of method with RTM-elided lock.
- */
- String getMethodWithLockName();
-}
diff --git a/test/hotspot/jtreg/compiler/testlibrary/rtm/MemoryConflictProvoker.java b/test/hotspot/jtreg/compiler/testlibrary/rtm/MemoryConflictProvoker.java
deleted file mode 100644
index 7926c9e23b45b..0000000000000
--- a/test/hotspot/jtreg/compiler/testlibrary/rtm/MemoryConflictProvoker.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (c) 2014, 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.
- */
-
-package compiler.testlibrary.rtm;
-
-import java.util.concurrent.BrokenBarrierException;
-import java.util.concurrent.CyclicBarrier;
-
-/**
- * To force transactional execution abort due to memory conflict
- * one thread should access memory region from transactional region
- * while another thread should modify the same memory region.
- * Since this scenario is based on the race condition between threads
- * you should not expect some particular amount of aborts.
- */
-class MemoryConflictProvoker extends AbortProvoker {
- // Following field have to be static in order to avoid escape analysis.
- @SuppressWarnings("UnsuedDeclaration")
- private static int field = 0;
- private static final int INNER_ITERATIONS = 10000;
- private final CyclicBarrier barrier;
- /**
- * This thread will access and modify memory region
- * from outside of the transaction.
- */
- private final Runnable conflictingThread;
-
- public MemoryConflictProvoker() {
- this(new Object());
- }
-
- public MemoryConflictProvoker(Object monitor) {
- super(monitor);
- barrier = new CyclicBarrier(2);
- conflictingThread = () -> {
- try {
- barrier.await();
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- for (int i = 0; i < MemoryConflictProvoker.INNER_ITERATIONS; i++) {
- MemoryConflictProvoker.field++;
- }
- };
- }
-
- /**
- * Accesses and modifies memory region from within the transaction.
- */
- public void transactionalRegion() {
- for (int i = 0; i < MemoryConflictProvoker.INNER_ITERATIONS; i++) {
- synchronized(monitor) {
- MemoryConflictProvoker.field--;
- }
- }
- }
-
- @Override
- public void forceAbort() {
- try {
- Thread t = new Thread(conflictingThread);
- t.start();
- try {
- barrier.await();
- } catch (InterruptedException | BrokenBarrierException e) {
- throw new RuntimeException(e);
- }
- transactionalRegion();
- t.join();
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- @Override
- public String getMethodWithLockName() {
- return this.getClass().getName() + "::transactionalRegion";
- }
-}
diff --git a/test/hotspot/jtreg/compiler/testlibrary/rtm/NestedAbortProvoker.java b/test/hotspot/jtreg/compiler/testlibrary/rtm/NestedAbortProvoker.java
deleted file mode 100644
index 7123f2d562f66..0000000000000
--- a/test/hotspot/jtreg/compiler/testlibrary/rtm/NestedAbortProvoker.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2014, 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.
- */
-
-package compiler.testlibrary.rtm;
-
-import java.util.Arrays;
-
-/**
- * In order to force nested transaction abort NestedAbortProvoker
- * invoke BufferOverflowProvoker from transactional region.
- */
-class NestedAbortProvoker extends AbortProvoker {
- // Following field have to be static in order to avoid escape analysis.
- @SuppressWarnings("UnsuedDeclaration")
- private static int field = 0;
- private final AbortProvoker nestedAbortProvoker;
-
- public NestedAbortProvoker() {
- this.nestedAbortProvoker = new XAbortProvoker(monitor);
- }
-
- @Override
- public void forceAbort() {
- synchronized(monitor) {
- NestedAbortProvoker.field++;
- nestedAbortProvoker.forceAbort();
- NestedAbortProvoker.field--;
- }
- }
-
- @Override
- public String[] getMethodsToCompileNames() {
- String nestedProvokerMethods[]
- = nestedAbortProvoker.getMethodsToCompileNames();
- String methods[] = Arrays.copyOf(nestedProvokerMethods,
- nestedProvokerMethods.length + 1);
- methods[methods.length - 1] = getMethodWithLockName();
- return methods;
- }
-}
diff --git a/test/hotspot/jtreg/compiler/testlibrary/rtm/RTMLockingStatistics.java b/test/hotspot/jtreg/compiler/testlibrary/rtm/RTMLockingStatistics.java
deleted file mode 100644
index 351b1a96bd83a..0000000000000
--- a/test/hotspot/jtreg/compiler/testlibrary/rtm/RTMLockingStatistics.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * 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
- * 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.
- */
-
-package compiler.testlibrary.rtm;
-
-import java.util.EnumMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * Wrapper for +UsePreciseRTMLockingStatistics output.
- *
- * Example of locking statistics:
- *
- * java/lang/ClassLoader.loadClass@7
- * # rtm locks total (estimated): 6656
- * # rtm lock aborts (total): 10000
- * # rtm lock aborts 0 (abort instruction ): 9999
- * # rtm lock aborts 1 (may succeed on retry): 9999
- * # rtm lock aborts 2 (thread conflict ): 0
- * # rtm lock aborts 3 (buffer overflow ): 1
- * # rtm lock aborts 4 (debug or trap hit ): 0
- * # rtm lock aborts 5 (maximum nested depth): 0
- */
-public class RTMLockingStatistics {
- /**
- * Pattern for aborts per abort type entries.
- */
- private static final Pattern ABORT_PATTERN;
-
- /**
- * Pattern for whole statistics.
- */
- private static final Pattern RTM_LOCKING_STATISTICS_PATTERN;
-
- static {
- String abortRe
- = "# rtm lock aborts\\s+(?[0-9]+)\\s+\\([a-z\\s]+\\):\\s(?[0-9]+)";
-
- ABORT_PATTERN = Pattern.compile(abortRe);
- RTM_LOCKING_STATISTICS_PATTERN = Pattern.compile(
- "(?[^.\n]+)\\." +
- "(?[^@\n]+)@(?[0-9]+)\n" +
- "# rtm locks total \\(estimated\\):\\s*" +
- "(?[0-9]+)\n" +
- "# rtm lock aborts\\s+\\(total\\):\\s*(?[0-9]+)\n" +
- "(?(" + abortRe + "\n)+)");
- }
-
- private final long totalLocks;
- private final long totalAborts;
- private final String className;
- private final String methodName;
- private final int bci;
- private final Map aborts = new EnumMap<>(AbortType.class);
-
- /**
- * Constructs RTMLockingStatistics from matcher captured statistics entry.
- * @param matcher Matcher captured statistics entry.
- */
- private RTMLockingStatistics(Matcher matcher) {
- className = matcher.group("className");
- methodName = matcher.group("methodName");
- bci = Integer.valueOf(matcher.group("bci"));
- totalLocks = Long.valueOf(matcher.group("totalLocks"));
- totalAborts = Long.valueOf(matcher.group("totalAborts"));
-
- Matcher abortMatcher = ABORT_PATTERN.matcher(matcher.
- group("abortStats"));
-
- while (abortMatcher.find()) {
- int type = Integer.valueOf(abortMatcher.group("type"));
- long count = Long.valueOf(abortMatcher.group("count"));
- setAborts(AbortType.lookup(type), count);
- }
- }
-
-
- /**
- * Parses string and return all founded RTM locking statistics entries.
- *
- * @param str the string to be parsed.
- * @return list with all founded RTM locking statistics entries or
- * empty list if nothing was found.
- */
- public static List fromString(String str) {
- List statistics = new LinkedList<>();
- Matcher matcher = RTM_LOCKING_STATISTICS_PATTERN.matcher(str);
-
- while (matcher.find()) {
- RTMLockingStatistics lock = new RTMLockingStatistics(matcher);
- statistics.add(lock);
- }
-
- return statistics;
- }
-
- /**
- * Parses string and return all founded RTM locking statistics entries
- * for locks in method {@code methodName}.
- *
- * @param methodName a name of the method for locks from which statistics
- * should be gathered.
- * @param str the string to be parsed.
- * @return list with all founded RTM locking statistics entries or
- * empty list if nothing was found.
- */
- public static List fromString(String methodName,
- String str) {
- String formattedMethodName = formatMethodName(methodName);
-
- List statisticsForMethod = new LinkedList<>();
- for (RTMLockingStatistics statistics : fromString(str)) {
- if (statistics.getLockName().startsWith(formattedMethodName)) {
- statisticsForMethod.add(statistics);
- }
- }
- return statisticsForMethod;
- }
-
- /**
- * Formats method's name so it will have the same format as
- * in rtm locking statistics.
- *
- *
- * Example:
- * com/example/Klass::method => com/example/Klass.method
- * com/example/Klass.method => com/example/Klass.method
- * com.example.Klass::method => com/example/Klass.method
- * com.example.Klass.method => com/example/Klass.method
- *
- *
- * @param methodName method's name that should be formatted.
- * @return formatted method's name.
- */
- private static String formatMethodName(String methodName) {
- String m[];
- if (methodName.contains("::")) {
- m = methodName.split("::");
- } else {
- int splitAt = methodName.lastIndexOf('.');
- m = new String[2];
- m[0] = methodName.substring(0, splitAt);
- m[1] = methodName.substring(splitAt + 1);
- }
- return String.format("%s.%s", m[0].replaceAll("\\.", "/"), m[1]);
- }
-
- /**
- * Returns name of lock for which this statistics was collected.
- * Lock name has following format:
- * <class name>.<method name>@<bci>
- *
- * @return name of lock.
- */
- public String getLockName() {
- return String.format("%s.%s@%d", className, methodName, bci);
- }
-
- /**
- * Returns aborts count for specified abort type.
- *
- * @param type an abort type.
- * @return count of aborts.
- */
- public long getAborts(AbortType type) {
- return aborts.getOrDefault(type, 0L);
- }
-
- /**
- * Sets aborts count for specified abort type.
- *
- * @param type an abort type.
- * @param count count of aborts.
- */
- public void setAborts(AbortType type, long count) {
- aborts.put(type, count);
- }
-
- public long getTotalLocks() {
- return totalLocks;
- }
-
- public long getTotalAborts() {
- return totalAborts;
- }
-
- @Override
- public String toString() {
- StringBuilder builder = new StringBuilder();
- builder.append(getLockName()).append('\n');
- builder.append(String.format("# rtm locks total (estimated): %d\n",
- getTotalLocks()));
- builder.append(String.format("# rtm lock aborts: %d\n",
- getTotalLocks()));
-
- for (AbortType type : AbortType.values()) {
- builder.append(String.format("# rtm lock aborts %s %d\n",
- type.toString(), getAborts(type)));
- }
- return builder.toString();
- }
-}
diff --git a/test/hotspot/jtreg/compiler/testlibrary/rtm/RTMTestBase.java b/test/hotspot/jtreg/compiler/testlibrary/rtm/RTMTestBase.java
deleted file mode 100644
index b6535e65428c3..0000000000000
--- a/test/hotspot/jtreg/compiler/testlibrary/rtm/RTMTestBase.java
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
- * Copyright (c) 2014, 2023, 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.
- */
-
-package compiler.testlibrary.rtm;
-
-import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.process.ProcessTools;
-import jdk.test.lib.Utils;
-import jdk.test.lib.cli.CommandLineOptionTest;
-
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * Auxiliary methods used for RTM testing.
- */
-public class RTMTestBase {
- private static final String RTM_STATE_CHANGE_REASON = "rtm_state_change";
- /**
- * We don't parse compilation log as XML-document and use regular
- * expressions instead, because in some cases it could be
- * malformed.
- */
- private static final String FIRED_UNCOMMON_TRAP_PATTERN_TEMPLATE
- = "rtm_state_change