8164737: Remove Unsafe dependency from ProcessTools

Reviewed-by: gtriantafill, dholmes
This commit is contained in:
Christian Tornqvist 2016-08-25 08:40:53 -04:00
parent 3ba0af5c09
commit 820b9e7a16
41 changed files with 81 additions and 77 deletions

View File

@ -36,11 +36,11 @@
package compiler.intrinsics.unsafe;
import jdk.internal.misc.Unsafe;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
public class TestUnsafeMismatchedArrayFieldAccess {
private static final Unsafe UNSAFE = Utils.getUnsafe();
private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
static {
try {

View File

@ -45,7 +45,7 @@ package compiler.jvmci.compilerToVM;
import jdk.internal.misc.Unsafe;
import jdk.test.lib.Asserts;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
import jdk.vm.ci.hotspot.PublicMetaspaceWrapperObject;
@ -114,7 +114,7 @@ public class GetResolvedJavaMethodTest {
abstract HotSpotResolvedJavaMethod getResolvedJavaMethod();
}
private static final Unsafe UNSAFE = Utils.getUnsafe();
private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
private static final WhiteBox WB = WhiteBox.getWhiteBox();
private static final Field METASPACE_METHOD_FIELD;
private static final Class<?> TEST_CLASS = GetResolvedJavaMethodTest.class;

View File

@ -53,7 +53,7 @@ package compiler.jvmci.compilerToVM;
import jdk.internal.misc.Unsafe;
import jdk.test.lib.Asserts;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
@ -154,7 +154,7 @@ public class GetResolvedJavaTypeTest {
abstract HotSpotResolvedObjectType getResolvedJavaType();
}
private static final Unsafe UNSAFE = Utils.getUnsafe();
private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
private static final WhiteBox WB = WhiteBox.getWhiteBox();
private static final Class TEST_CLASS = GetResolvedJavaTypeTest.class;
/* a compressed parameter for tested method is set to false because

View File

@ -53,7 +53,7 @@ import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses;
import jdk.internal.misc.Unsafe;
import jdk.internal.org.objectweb.asm.Opcodes;
import jdk.test.lib.Asserts;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
import jdk.vm.ci.meta.ConstantPool;
@ -69,7 +69,7 @@ import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CON
*/
public class ResolveFieldInPoolTest {
private static final Unsafe UNSAFE = Utils.getUnsafe();
private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
public static void main(String[] args) throws Exception {
Map<ConstantTypes, Validator> typeTests = new HashMap<>();

View File

@ -52,6 +52,7 @@ import compiler.jvmci.common.testcases.SingleSubclassedClass;
import jdk.internal.misc.Unsafe;
import jdk.test.lib.Asserts;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.vm.ci.hotspot.CompilerToVMHelper;
import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
@ -60,7 +61,7 @@ import java.util.HashSet;
import java.util.Set;
public class ResolveMethodTest {
private static final Unsafe UNSAFE = Utils.getUnsafe();
private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
public static void main(String args[]) {
ResolveMethodTest test = new ResolveMethodTest();

View File

@ -34,7 +34,7 @@
package compiler.loopopts.superword;
import jdk.internal.misc.Unsafe;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
public class TestVectorizationWithInvariant {
@ -43,7 +43,7 @@ public class TestVectorizationWithInvariant {
private static final long CHAR_ARRAY_OFFSET;
static {
unsafe = Utils.getUnsafe();
unsafe = UnsafeHelper.getUnsafe();
BYTE_ARRAY_OFFSET = unsafe.arrayBaseOffset(byte[].class);
CHAR_ARRAY_OFFSET = unsafe.arrayBaseOffset(char[].class);
}

View File

@ -49,7 +49,7 @@ import compiler.testlibrary.rtm.predicate.SupportedVM;
import jdk.internal.misc.Unsafe;
import jdk.test.lib.Asserts;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.test.lib.cli.CommandLineOptionTest;
import jdk.test.lib.cli.predicate.AndPredicate;
@ -125,7 +125,7 @@ public class TestRTMAbortRatio extends CommandLineOptionTest {
public static class Test implements CompilableTest {
private static final int TOTAL_ITERATIONS = 10000;
private static final int WARMUP_ITERATIONS = 1000;
private static final Unsafe UNSAFE = Utils.getUnsafe();
private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
private final Object monitor = new Object();
// Following field have to be static in order to avoid escape analysis.
@SuppressWarnings("UnsuedDeclaration")

View File

@ -51,7 +51,7 @@ import compiler.testlibrary.rtm.predicate.SupportedVM;
import jdk.internal.misc.Unsafe;
import jdk.test.lib.Asserts;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.test.lib.cli.CommandLineOptionTest;
import jdk.test.lib.cli.predicate.AndPredicate;
@ -158,7 +158,7 @@ public class TestRTMAfterNonRTMDeopt extends CommandLineOptionTest {
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 = Utils.getUnsafe();
private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
private final Object monitor = new Object();
@Override

View File

@ -48,7 +48,7 @@ import compiler.testlibrary.rtm.predicate.SupportedVM;
import jdk.internal.misc.Unsafe;
import jdk.test.lib.Asserts;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.test.lib.cli.CommandLineOptionTest;
import jdk.test.lib.cli.predicate.AndPredicate;
@ -133,7 +133,7 @@ public class TestRTMDeoptOnLowAbortRatio extends CommandLineOptionTest {
}
public static class Test implements CompilableTest {
private static final Unsafe UNSAFE = Utils.getUnsafe();
private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
private final Object monitor = new Object();
@Override

View File

@ -49,7 +49,7 @@ import compiler.testlibrary.rtm.predicate.SupportedVM;
import jdk.internal.misc.Unsafe;
import jdk.test.lib.Asserts;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.test.lib.cli.CommandLineOptionTest;
import jdk.test.lib.cli.predicate.AndPredicate;
@ -142,7 +142,7 @@ public class TestRTMLockingThreshold extends CommandLineOptionTest {
@SuppressWarnings("UnsuedDeclaration")
private static int field = 0;
private static final int TOTAL_ITERATIONS = 10000;
private static final Unsafe UNSAFE = Utils.getUnsafe();
private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
private final Object monitor = new Object();

View File

@ -49,7 +49,7 @@ import compiler.testlibrary.rtm.predicate.SupportedVM;
import jdk.internal.misc.Unsafe;
import jdk.test.lib.Asserts;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.test.lib.cli.CommandLineOptionTest;
import jdk.test.lib.cli.predicate.AndPredicate;
@ -113,7 +113,7 @@ public class TestRTMTotalCountIncrRate extends CommandLineOptionTest {
public static class Test implements CompilableTest {
private static final long TOTAL_ITERATIONS = 10000L;
private static final Unsafe UNSAFE = Utils.getUnsafe();
private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
private final Object monitor = new Object();
// Following field have to be static in order to avoid escape analysis.
@SuppressWarnings("UnsuedDeclaration")

View File

@ -25,7 +25,7 @@
package compiler.testlibrary.rtm;
import jdk.internal.misc.Unsafe;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
/**
* Current RTM locking implementation force transaction abort
@ -35,7 +35,7 @@ class XAbortProvoker extends AbortProvoker {
// Following field have to be static in order to avoid escape analysis.
@SuppressWarnings("UnsuedDeclaration")
private static int field = 0;
private static final Unsafe UNSAFE = Utils.getUnsafe();
private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
public XAbortProvoker() {
this(new Object());

View File

@ -35,6 +35,7 @@ package compiler.unsafe;
import jdk.internal.misc.Unsafe;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import java.util.Random;
@ -81,7 +82,7 @@ public class UnsafeRaw {
}
public static void main(String[] args) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
final int array_size = 128;
final int element_size = 4;
final int magic = 0x12345678;

View File

@ -37,6 +37,7 @@ import java.util.Collections;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
public class TestMaxMinHeapFreeRatioFlags {
@ -133,7 +134,7 @@ public class TestMaxMinHeapFreeRatioFlags {
*/
public static class RatioVerifier {
private static final Unsafe unsafe = Utils.getUnsafe();
private static final Unsafe unsafe = UnsafeHelper.getUnsafe();
// Size of byte array that will be allocated
public static final int CHUNK_SIZE = 1024;

View File

@ -46,6 +46,7 @@ import jdk.internal.misc.Unsafe;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import sun.hotspot.WhiteBox;
/* In order to test that TargetSurvivorRatio affects survivor space occupancy
@ -248,7 +249,7 @@ public class TestTargetSurvivorRatioFlag {
public static class TargetSurvivorRatioVerifier {
static final WhiteBox wb = WhiteBox.getWhiteBox();
static final Unsafe unsafe = Utils.getUnsafe();
static final Unsafe unsafe = UnsafeHelper.getUnsafe();
// Desired size of memory allocated at once
public static final int CHUNK_SIZE = 1024;

View File

@ -34,13 +34,13 @@
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.Platform;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
public class CreateCoredumpOnCrash {
private static class Crasher {
public static void main(String[] args) {
Utils.getUnsafe().putInt(0L, 0);
UnsafeHelper.getUnsafe().putInt(0L, 0);
}
}

View File

@ -35,14 +35,14 @@
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
public class ProblematicFrameTest {
private static class Crasher {
public static void main(String[] args) {
Utils.getUnsafe().getInt(0);
UnsafeHelper.getUnsafe().getInt(0);
}
}

View File

@ -30,12 +30,12 @@
* @run main AllocateInstance
*/
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
import static jdk.test.lib.Asserts.*;
public class AllocateInstance {
static final Unsafe UNSAFE = Utils.getUnsafe();
static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
class TestClass {
public boolean calledConstructor = false;

View File

@ -31,13 +31,13 @@
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:MallocMaxTestWords=100m AllocateMemory
*/
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
import static jdk.test.lib.Asserts.*;
public class AllocateMemory {
public static void main(String args[]) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
// Allocate a byte, write to the location and read back the value
long address = unsafe.allocateMemory(1);

View File

@ -30,14 +30,14 @@
* @run main CopyMemory
*/
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
import static jdk.test.lib.Asserts.*;
public class CopyMemory {
final static int LENGTH = 8;
public static void main(String args[]) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
long src = unsafe.allocateMemory(LENGTH);
long dst = unsafe.allocateMemory(LENGTH);
assertNotEquals(src, 0L);

View File

@ -34,13 +34,13 @@
import java.security.ProtectionDomain;
import java.io.InputStream;
import jdk.test.lib.InMemoryJavaCompiler;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
import static jdk.test.lib.Asserts.*;
public class DefineClass {
public static void main(String args[]) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
TestClassLoader classloader = new TestClassLoader();
ProtectionDomain pd = new ProtectionDomain(null, null);

View File

@ -31,14 +31,14 @@
*/
import java.lang.reflect.Field;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
import java.lang.reflect.*;
import static jdk.test.lib.Asserts.*;
public class FieldOffset {
public static void main(String args[]) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
Field[] fields = Test.class.getDeclaredFields();
for (int i = 0; i < fields.length; i++) {

View File

@ -30,14 +30,14 @@
* @run main GetField
*/
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
import java.lang.reflect.*;
import static jdk.test.lib.Asserts.*;
public class GetField {
public static void main(String args[]) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
// Unsafe.INVALID_FIELD_OFFSET is a static final int field,
// make sure getField returns the correct field
Field field = Unsafe.class.getField("INVALID_FIELD_OFFSET");

View File

@ -31,13 +31,13 @@
*/
import jdk.test.lib.Platform;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
import static jdk.test.lib.Asserts.*;
public class GetPutAddress {
public static void main(String args[]) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
int addressSize = unsafe.addressSize();
// Ensure the size returned from Unsafe.addressSize is correct
assertEquals(unsafe.addressSize(), Platform.is32bit() ? 4 : 8);

View File

@ -31,13 +31,13 @@
*/
import java.lang.reflect.Field;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
import static jdk.test.lib.Asserts.*;
public class GetPutBoolean {
public static void main(String args[]) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
Test t = new Test();
Field field = Test.class.getField("b1");

View File

@ -31,13 +31,13 @@
*/
import java.lang.reflect.Field;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
import static jdk.test.lib.Asserts.*;
public class GetPutByte {
public static void main(String args[]) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
Test t = new Test();
Field field = Test.class.getField("b");

View File

@ -31,13 +31,13 @@
*/
import java.lang.reflect.Field;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
import static jdk.test.lib.Asserts.*;
public class GetPutChar {
public static void main(String args[]) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
Test t = new Test();
Field field = Test.class.getField("c");

View File

@ -31,13 +31,13 @@
*/
import java.lang.reflect.Field;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
import static jdk.test.lib.Asserts.*;
public class GetPutDouble {
public static void main(String args[]) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
Test t = new Test();
Field field = Test.class.getField("d");

View File

@ -31,13 +31,13 @@
*/
import java.lang.reflect.Field;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
import static jdk.test.lib.Asserts.*;
public class GetPutFloat {
public static void main(String args[]) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
Test t = new Test();
Field field = Test.class.getField("f");

View File

@ -30,13 +30,13 @@
*/
import java.lang.reflect.Field;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
import static jdk.test.lib.Asserts.*;
public class GetPutInt {
public static void main(String args[]) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
Test t = new Test();
Field field = Test.class.getField("i");

View File

@ -31,13 +31,13 @@
*/
import java.lang.reflect.Field;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
import static jdk.test.lib.Asserts.*;
public class GetPutLong {
public static void main(String args[]) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
Test t = new Test();
Field field = Test.class.getField("l");

View File

@ -31,13 +31,13 @@
*/
import java.lang.reflect.Field;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
import static jdk.test.lib.Asserts.*;
public class GetPutObject {
public static void main(String args[]) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
Test t = new Test();
Object o = new Object();
Field field = Test.class.getField("o");

View File

@ -31,13 +31,13 @@
*/
import java.lang.reflect.Field;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
import static jdk.test.lib.Asserts.*;
public class GetPutShort {
public static void main(String args[]) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
Test t = new Test();
Field field = Test.class.getField("s");

View File

@ -30,13 +30,13 @@
import static jdk.test.lib.Asserts.*;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
public class GetUncompressedObject {
public static void main(String args[]) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
// Allocate some memory and fill it with non-zero values.
final int size = 32;

View File

@ -35,7 +35,7 @@ import java.security.ProtectionDomain;
import java.io.InputStream;
import java.lang.*;
import jdk.test.lib.InMemoryJavaCompiler;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
import static jdk.test.lib.Asserts.*;
@ -50,7 +50,7 @@ public class NestedUnsafe {
" } } ");
public static void main(String args[]) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
Class klass = unsafe.defineAnonymousClass(NestedUnsafe.class, klassbuf, new Object[0]);
unsafe.ensureClassInitialized(klass);

View File

@ -31,13 +31,13 @@
*/
import java.lang.reflect.Field;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
import static jdk.test.lib.Asserts.*;
public class PageSize {
public static void main(String args[]) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
int pageSize = unsafe.pageSize();
for (int n = 1; n != 0; n <<= 1) {

View File

@ -33,7 +33,7 @@
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.Platform;
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
@ -60,7 +60,7 @@ public class RangeCheck {
public static class DummyClassWithMainRangeCheck {
public static void main(String args[]) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
unsafe.getObject(new DummyClassWithMainRangeCheck(), Short.MAX_VALUE);
}
}

View File

@ -31,13 +31,13 @@
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:MallocMaxTestWords=100m Reallocate
*/
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
import static jdk.test.lib.Asserts.*;
public class Reallocate {
public static void main(String args[]) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
long address = unsafe.allocateMemory(1);
assertNotEquals(address, 0L);

View File

@ -30,13 +30,13 @@
* @run main SetMemory
*/
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
import static jdk.test.lib.Asserts.*;
public class SetMemory {
public static void main(String args[]) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
long address = unsafe.allocateMemory(1);
assertNotEquals(address, 0L);
unsafe.setMemory(address, 1, (byte)17);

View File

@ -30,13 +30,13 @@
* @run main ThrowException
*/
import jdk.test.lib.Utils;
import jdk.test.lib.unsafe.UnsafeHelper;
import jdk.internal.misc.Unsafe;
import static jdk.test.lib.Asserts.*;
public class ThrowException {
public static void main(String args[]) throws Exception {
Unsafe unsafe = Utils.getUnsafe();
Unsafe unsafe = UnsafeHelper.getUnsafe();
try {
unsafe.throwException(new TestException());
} catch (Throwable t) {

View File

@ -39,7 +39,7 @@ import java.util.regex.Pattern;
* Concrete subclasses should implement method {@link #process()}.
*/
public abstract class PathHandler {
private static final Unsafe UNSAFE = jdk.test.lib.Utils.getUnsafe();
private static final Unsafe UNSAFE = jdk.test.lib.unsafe.UnsafeHelper.getUnsafe();
private static final AtomicLong CLASS_COUNT = new AtomicLong(0L);
private static volatile boolean CLASSES_LIMIT_REACHED = false;
private static final Pattern JAR_IN_DIR_PATTERN