< prev index next >
test/hotspot/jtreg/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java
Print this page
rev 54746 : 8223660: jtreg: Decouple Unsafe from RTM tests
Reviewed-by:
*** 1,7 ****
/*
! * Copyright (c) 2014, 2016, 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.
--- 1,7 ----
/*
! * 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.
*** 33,54 ****
* java.management
* @requires vm.rtm.cpu & vm.rtm.compiler
* @build sun.hotspot.WhiteBox
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
! * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* compiler.rtm.locking.TestRTMAfterNonRTMDeopt
*/
package compiler.rtm.locking;
import compiler.testlibrary.rtm.AbortProvoker;
import compiler.testlibrary.rtm.CompilableTest;
import compiler.testlibrary.rtm.RTMLockingStatistics;
import compiler.testlibrary.rtm.RTMTestBase;
- import jdk.internal.misc.Unsafe;
import jdk.test.lib.Asserts;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.cli.CommandLineOptionTest;
import java.util.List;
--- 33,54 ----
* java.management
* @requires vm.rtm.cpu & vm.rtm.compiler
* @build sun.hotspot.WhiteBox
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
! * @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;
*** 147,175 ****
// 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 static final Unsafe UNSAFE = Unsafe.getUnsafe();
private final Object monitor = new Object();
@Override
public String getMethodWithLockName() {
return this.getClass().getName() + "::forceAbort";
}
@Override
public String[] getMethodsToCompileNames() {
! return new String[] { getMethodWithLockName() };
}
public void forceAbort(int a[], boolean abort) {
try {
synchronized(monitor) {
a[0]++;
if (abort) {
! Test.field = Test.UNSAFE.pageSize();
}
}
} catch (Throwable t) {
// suppress any throwables
}
--- 147,176 ----
// 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
}
< prev index next >