diff --git a/hotspot/test/compiler/c2/Test6968348.java b/hotspot/test/compiler/c2/Test6968348.java index be609bfbb8f4727daeb0255249ff4f8f1b1df392..29da68e4af2d44e19557c8a8a5957afaf94274f0 100644 --- a/hotspot/test/compiler/c2/Test6968348.java +++ b/hotspot/test/compiler/c2/Test6968348.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 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 @@ -38,15 +38,11 @@ import jdk.internal.misc.Unsafe; import java.lang.reflect.Field; public class Test6968348 { - static Unsafe unsafe; + static Unsafe unsafe = Unsafe.getUnsafe(); static final long[] buffer = new long[4096]; static int array_long_base_offset; public static void main(String[] args) throws Exception { - Class c = Test6968348.class.getClassLoader().loadClass("jdk.internal.misc.Unsafe"); - Field f = c.getDeclaredField("theUnsafe"); - f.setAccessible(true); - unsafe = (Unsafe)f.get(c); array_long_base_offset = unsafe.arrayBaseOffset(long[].class); for (int n = 0; n < 100000; n++) { diff --git a/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeCAS.java b/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeCAS.java index 4499ed5b981f068703edb6db1829449f6fe7fe88..ec953664cc2d1dcd4f16f6e97cffcd6fde90c25d 100644 --- a/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeCAS.java +++ b/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeCAS.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 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 @@ -50,14 +50,10 @@ public class TestIntUnsafeCAS { private static final int ALIGN_OFF = 8; private static final int UNALIGN_OFF = 5; - private static final Unsafe unsafe; + private static final Unsafe unsafe = Unsafe.getUnsafe(); private static final int BASE; static { try { - Class c = TestIntUnsafeCAS.class.getClassLoader().loadClass("jdk.internal.misc.Unsafe"); - Field f = c.getDeclaredField("theUnsafe"); - f.setAccessible(true); - unsafe = (Unsafe)f.get(c); BASE = unsafe.arrayBaseOffset(int[].class); } catch (Exception e) { InternalError err = new InternalError(); diff --git a/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeOrdered.java b/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeOrdered.java index 3298e1ba94d49231cbfdf4ebb34b409456557c12..4625fcce04dfa21df755695aae6ab0187fc58a9d 100644 --- a/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeOrdered.java +++ b/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeOrdered.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 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 @@ -50,14 +50,10 @@ public class TestIntUnsafeOrdered { private static final int ALIGN_OFF = 8; private static final int UNALIGN_OFF = 5; - private static final Unsafe unsafe; + private static final Unsafe unsafe = Unsafe.getUnsafe(); private static final int BASE; static { try { - Class c = Unsafe.class; - Field f = c.getDeclaredField("theUnsafe"); - f.setAccessible(true); - unsafe = (Unsafe) f.get(c); BASE = unsafe.arrayBaseOffset(int[].class); } catch (Exception e) { InternalError err = new InternalError(); diff --git a/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeVolatile.java b/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeVolatile.java index 6bcd3983a7f7e581b4527b599c202f666e564d3a..f0272b4faaf87acb5d850ccbf3a21d115b02ac67 100644 --- a/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeVolatile.java +++ b/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeVolatile.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 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 @@ -50,14 +50,10 @@ public class TestIntUnsafeVolatile { private static final int ALIGN_OFF = 8; private static final int UNALIGN_OFF = 5; - private static final Unsafe unsafe; + private static final Unsafe unsafe = Unsafe.getUnsafe(); private static final int BASE; static { try { - Class c = TestIntUnsafeVolatile.class.getClassLoader().loadClass("jdk.internal.misc.Unsafe"); - Field f = c.getDeclaredField("theUnsafe"); - f.setAccessible(true); - unsafe = (Unsafe)f.get(c); BASE = unsafe.arrayBaseOffset(int[].class); } catch (Exception e) { InternalError err = new InternalError(); diff --git a/hotspot/test/compiler/intrinsics/unsafe/TestUnsafeMismatchedArrayFieldAccess.java b/hotspot/test/compiler/intrinsics/unsafe/TestUnsafeMismatchedArrayFieldAccess.java index b56d1b4e5bfc0a90887b41626b4d70eb58ff3492..30e7ab0526dbb024cfa5173e0037524815ce156f 100644 --- a/hotspot/test/compiler/intrinsics/unsafe/TestUnsafeMismatchedArrayFieldAccess.java +++ b/hotspot/test/compiler/intrinsics/unsafe/TestUnsafeMismatchedArrayFieldAccess.java @@ -27,7 +27,6 @@ * @bug 8142386 * @summary Unsafe access to an array is wrongly marked as mismatched * @modules java.base/jdk.internal.misc - * @library /test/lib * * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:-TieredCompilation * compiler.intrinsics.unsafe.TestUnsafeMismatchedArrayFieldAccess @@ -36,11 +35,10 @@ package compiler.intrinsics.unsafe; import jdk.internal.misc.Unsafe; -import jdk.test.lib.unsafe.UnsafeHelper; public class TestUnsafeMismatchedArrayFieldAccess { - private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe(); + private static final Unsafe UNSAFE = Unsafe.getUnsafe(); static { try { diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodTest.java index c1c382d768d8459cebf4b041beecf5b66c7851bf..48fa29157b8f1e9cd67ac13fc95fa3992b31b327 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodTest.java @@ -45,7 +45,6 @@ package compiler.jvmci.compilerToVM; import jdk.internal.misc.Unsafe; import jdk.test.lib.Asserts; -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 +113,7 @@ public class GetResolvedJavaMethodTest { abstract HotSpotResolvedJavaMethod getResolvedJavaMethod(); } - private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe(); + private static final Unsafe UNSAFE = Unsafe.getUnsafe(); private static final WhiteBox WB = WhiteBox.getWhiteBox(); private static final Field METASPACE_METHOD_FIELD; private static final Class TEST_CLASS = GetResolvedJavaMethodTest.class; diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java index 80021f8e79bbf35353a9cb25f6a641f2deae1c40..38adf2fc7209262083944135303673944312c2c6 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java @@ -53,7 +53,6 @@ package compiler.jvmci.compilerToVM; import jdk.internal.misc.Unsafe; import jdk.test.lib.Asserts; -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 +153,7 @@ public class GetResolvedJavaTypeTest { abstract HotSpotResolvedObjectType getResolvedJavaType(); } - private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe(); + private static final Unsafe UNSAFE = Unsafe.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 diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java index 4985773a831bb1f475f0bd96ef222a009e049c33..202eaa003c0e664050cb3b0d68a83e81191e8854 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java @@ -53,7 +53,6 @@ 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.unsafe.UnsafeHelper; import jdk.vm.ci.hotspot.CompilerToVMHelper; import jdk.vm.ci.hotspot.HotSpotResolvedObjectType; import jdk.vm.ci.meta.ConstantPool; @@ -69,7 +68,7 @@ import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CON */ public class ResolveFieldInPoolTest { - private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe(); + private static final Unsafe UNSAFE = Unsafe.getUnsafe(); public static void main(String[] args) throws Exception { Map typeTests = new HashMap<>(); diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ResolveMethodTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ResolveMethodTest.java index e6416fdbab6ae6ede86594d0b5b288405cd87765..f3fd052a5aef65eaa60a0c0dabe224e7fc511895 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/ResolveMethodTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolveMethodTest.java @@ -52,7 +52,6 @@ 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; @@ -61,7 +60,7 @@ import java.util.HashSet; import java.util.Set; public class ResolveMethodTest { - private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe(); + private static final Unsafe UNSAFE = Unsafe.getUnsafe(); public static void main(String args[]) { ResolveMethodTest test = new ResolveMethodTest(); diff --git a/hotspot/test/compiler/loopopts/superword/TestVectorizationWithInvariant.java b/hotspot/test/compiler/loopopts/superword/TestVectorizationWithInvariant.java index 686e2f465e2945f1b1519ccfe1048de7ecb45f48..cdc7254df225475092bca9b2f99293b398c5d40e 100644 --- a/hotspot/test/compiler/loopopts/superword/TestVectorizationWithInvariant.java +++ b/hotspot/test/compiler/loopopts/superword/TestVectorizationWithInvariant.java @@ -34,7 +34,6 @@ package compiler.loopopts.superword; import jdk.internal.misc.Unsafe; -import jdk.test.lib.unsafe.UnsafeHelper; public class TestVectorizationWithInvariant { @@ -43,7 +42,7 @@ public class TestVectorizationWithInvariant { private static final long CHAR_ARRAY_OFFSET; static { - unsafe = UnsafeHelper.getUnsafe(); + unsafe = Unsafe.getUnsafe(); BYTE_ARRAY_OFFSET = unsafe.arrayBaseOffset(byte[].class); CHAR_ARRAY_OFFSET = unsafe.arrayBaseOffset(char[].class); } diff --git a/hotspot/test/compiler/rtm/locking/TestRTMAbortRatio.java b/hotspot/test/compiler/rtm/locking/TestRTMAbortRatio.java index e45212e268db9903d116d964a6a71d208d79bc38..b7ce4c62f07fd1639d60ebaa0562edce16dde227 100644 --- a/hotspot/test/compiler/rtm/locking/TestRTMAbortRatio.java +++ b/hotspot/test/compiler/rtm/locking/TestRTMAbortRatio.java @@ -49,7 +49,6 @@ 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.unsafe.UnsafeHelper; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.AndPredicate; @@ -125,7 +124,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 = UnsafeHelper.getUnsafe(); + private static final Unsafe UNSAFE = Unsafe.getUnsafe(); private final Object monitor = new Object(); // Following field have to be static in order to avoid escape analysis. @SuppressWarnings("UnsuedDeclaration") diff --git a/hotspot/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java b/hotspot/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java index 21c1a612b6f8de8158759adce7963b61f793bedb..48aea40ee8a8cec45283ab006e0c365edc7529da 100644 --- a/hotspot/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java +++ b/hotspot/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java @@ -51,7 +51,6 @@ 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.unsafe.UnsafeHelper; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.AndPredicate; @@ -158,7 +157,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 = UnsafeHelper.getUnsafe(); + private static final Unsafe UNSAFE = Unsafe.getUnsafe(); private final Object monitor = new Object(); @Override diff --git a/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java b/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java index 6807d82463a397c0bf4673dedf08448f6c99057b..d936790c07d552a8be7377ac86a8f8073bf3d533 100644 --- a/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java +++ b/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java @@ -48,7 +48,6 @@ 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.unsafe.UnsafeHelper; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.AndPredicate; @@ -133,7 +132,7 @@ public class TestRTMDeoptOnLowAbortRatio extends CommandLineOptionTest { } public static class Test implements CompilableTest { - private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe(); + private static final Unsafe UNSAFE = Unsafe.getUnsafe(); private final Object monitor = new Object(); @Override diff --git a/hotspot/test/compiler/rtm/locking/TestRTMLockingThreshold.java b/hotspot/test/compiler/rtm/locking/TestRTMLockingThreshold.java index 0dfea49a526609f4392ac37c5152fd8617717352..d42cde137f4b958a0e5390782fdd779167b01964 100644 --- a/hotspot/test/compiler/rtm/locking/TestRTMLockingThreshold.java +++ b/hotspot/test/compiler/rtm/locking/TestRTMLockingThreshold.java @@ -49,7 +49,6 @@ 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.unsafe.UnsafeHelper; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.AndPredicate; @@ -142,7 +141,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 = UnsafeHelper.getUnsafe(); + private static final Unsafe UNSAFE = Unsafe.getUnsafe(); private final Object monitor = new Object(); diff --git a/hotspot/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java b/hotspot/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java index e7158d4f6708173a03a7ee35cc831726d9d3f273..4e1e0d82fac61cd3342c626c25d2eb1fd32c3901 100644 --- a/hotspot/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java +++ b/hotspot/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java @@ -49,7 +49,6 @@ 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.unsafe.UnsafeHelper; import jdk.test.lib.cli.CommandLineOptionTest; import jdk.test.lib.cli.predicate.AndPredicate; @@ -113,7 +112,7 @@ public class TestRTMTotalCountIncrRate extends CommandLineOptionTest { public static class Test implements CompilableTest { private static final long TOTAL_ITERATIONS = 10000L; - private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe(); + private static final Unsafe UNSAFE = Unsafe.getUnsafe(); private final Object monitor = new Object(); // Following field have to be static in order to avoid escape analysis. @SuppressWarnings("UnsuedDeclaration") diff --git a/hotspot/test/compiler/testlibrary/rtm/XAbortProvoker.java b/hotspot/test/compiler/testlibrary/rtm/XAbortProvoker.java index ab476b311c243d04e05d27a0075473a5e36e5220..c62f7043f8389bc3157fc95950c5e64ed5d2d1bf 100644 --- a/hotspot/test/compiler/testlibrary/rtm/XAbortProvoker.java +++ b/hotspot/test/compiler/testlibrary/rtm/XAbortProvoker.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -25,7 +25,6 @@ package compiler.testlibrary.rtm; import jdk.internal.misc.Unsafe; -import jdk.test.lib.unsafe.UnsafeHelper; /** * Current RTM locking implementation force transaction abort @@ -35,7 +34,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 = UnsafeHelper.getUnsafe(); + private static final Unsafe UNSAFE = Unsafe.getUnsafe(); public XAbortProvoker() { this(new Object()); diff --git a/hotspot/test/compiler/unsafe/UnsafeRaw.java b/hotspot/test/compiler/unsafe/UnsafeRaw.java index 3bf38ca941de97e5cab6a8f41d7f466a4b024c2c..82795e98b0a75bd9124ca249fa0f773925825232 100644 --- a/hotspot/test/compiler/unsafe/UnsafeRaw.java +++ b/hotspot/test/compiler/unsafe/UnsafeRaw.java @@ -35,7 +35,6 @@ package compiler.unsafe; import jdk.internal.misc.Unsafe; import jdk.test.lib.Utils; -import jdk.test.lib.unsafe.UnsafeHelper; import java.util.Random; @@ -82,7 +81,7 @@ public class UnsafeRaw { } public static void main(String[] args) throws Exception { - Unsafe unsafe = UnsafeHelper.getUnsafe(); + Unsafe unsafe = Unsafe.getUnsafe(); final int array_size = 128; final int element_size = 4; final int magic = 0x12345678; diff --git a/hotspot/test/gc/arguments/TestMaxMinHeapFreeRatioFlags.java b/hotspot/test/gc/arguments/TestMaxMinHeapFreeRatioFlags.java index 51cc5550559d36d40ad4ceaece51386d67b7c0af..714674b853d3261d66994c78dfc4378af489a7fb 100644 --- a/hotspot/test/gc/arguments/TestMaxMinHeapFreeRatioFlags.java +++ b/hotspot/test/gc/arguments/TestMaxMinHeapFreeRatioFlags.java @@ -37,7 +37,6 @@ 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 { @@ -134,7 +133,7 @@ public class TestMaxMinHeapFreeRatioFlags { */ public static class RatioVerifier { - private static final Unsafe unsafe = UnsafeHelper.getUnsafe(); + private static final Unsafe unsafe = Unsafe.getUnsafe(); // Size of byte array that will be allocated public static final int CHUNK_SIZE = 1024; diff --git a/hotspot/test/gc/arguments/TestTargetSurvivorRatioFlag.java b/hotspot/test/gc/arguments/TestTargetSurvivorRatioFlag.java index 2f980e5f325aa2cc04e449a82cf828f3d1c86d8c..60eef56287c980937b7056a326302c999320cc1d 100644 --- a/hotspot/test/gc/arguments/TestTargetSurvivorRatioFlag.java +++ b/hotspot/test/gc/arguments/TestTargetSurvivorRatioFlag.java @@ -46,7 +46,6 @@ 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 @@ -249,7 +248,7 @@ public class TestTargetSurvivorRatioFlag { public static class TargetSurvivorRatioVerifier { static final WhiteBox wb = WhiteBox.getWhiteBox(); - static final Unsafe unsafe = UnsafeHelper.getUnsafe(); + static final Unsafe unsafe = Unsafe.getUnsafe(); // Desired size of memory allocated at once public static final int CHUNK_SIZE = 1024; diff --git a/hotspot/test/runtime/ErrorHandling/CreateCoredumpOnCrash.java b/hotspot/test/runtime/ErrorHandling/CreateCoredumpOnCrash.java index a5a19fed1df84e63a23ea965bd473c01aa2eba1b..60226a33e426143ed1b143f479eb88377e783544 100644 --- a/hotspot/test/runtime/ErrorHandling/CreateCoredumpOnCrash.java +++ b/hotspot/test/runtime/ErrorHandling/CreateCoredumpOnCrash.java @@ -34,13 +34,12 @@ import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.Platform; -import jdk.test.lib.unsafe.UnsafeHelper; import jdk.internal.misc.Unsafe; public class CreateCoredumpOnCrash { private static class Crasher { public static void main(String[] args) { - UnsafeHelper.getUnsafe().putInt(0L, 0); + Unsafe.getUnsafe().putInt(0L, 0); } } diff --git a/hotspot/test/runtime/ErrorHandling/ProblematicFrameTest.java b/hotspot/test/runtime/ErrorHandling/ProblematicFrameTest.java index e3b88c2967397ca00c30e282b267b0cd47bf54a5..2aa02bf7c49674f25a577633b4115211dce27554 100644 --- a/hotspot/test/runtime/ErrorHandling/ProblematicFrameTest.java +++ b/hotspot/test/runtime/ErrorHandling/ProblematicFrameTest.java @@ -35,14 +35,13 @@ import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.OutputAnalyzer; -import jdk.test.lib.unsafe.UnsafeHelper; import jdk.internal.misc.Unsafe; public class ProblematicFrameTest { private static class Crasher { public static void main(String[] args) { - UnsafeHelper.getUnsafe().getInt(0); + Unsafe.getUnsafe().getInt(0); } } diff --git a/hotspot/test/runtime/Unsafe/AllocateInstance.java b/hotspot/test/runtime/Unsafe/AllocateInstance.java index ca2d56dd7497c7d8d430d14d1dfb31c1e06934ae..ac684f84144ac01cc36b7e8eb9be647ccebfdc13 100644 --- a/hotspot/test/runtime/Unsafe/AllocateInstance.java +++ b/hotspot/test/runtime/Unsafe/AllocateInstance.java @@ -30,12 +30,11 @@ * @run main AllocateInstance */ -import jdk.test.lib.unsafe.UnsafeHelper; import jdk.internal.misc.Unsafe; import static jdk.test.lib.Asserts.*; public class AllocateInstance { - static final Unsafe UNSAFE = UnsafeHelper.getUnsafe(); + static final Unsafe UNSAFE = Unsafe.getUnsafe(); class TestClass { public boolean calledConstructor = false; diff --git a/hotspot/test/runtime/Unsafe/AllocateMemory.java b/hotspot/test/runtime/Unsafe/AllocateMemory.java index afb48c244888072dfcb1b0557662bdc2e553d6be..6c67427fe58f801b3d13760f8ba1f336f80f6ea5 100644 --- a/hotspot/test/runtime/Unsafe/AllocateMemory.java +++ b/hotspot/test/runtime/Unsafe/AllocateMemory.java @@ -31,13 +31,12 @@ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:MallocMaxTestWords=100m AllocateMemory */ -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 = UnsafeHelper.getUnsafe(); + Unsafe unsafe = Unsafe.getUnsafe(); // Allocate a byte, write to the location and read back the value long address = unsafe.allocateMemory(1); diff --git a/hotspot/test/runtime/Unsafe/CopyMemory.java b/hotspot/test/runtime/Unsafe/CopyMemory.java index 0b832c3ee6749f0d41a7441a09cae455fa847d5f..447d1c89702d95eab793f0dea6b2e8221b2d1951 100644 --- a/hotspot/test/runtime/Unsafe/CopyMemory.java +++ b/hotspot/test/runtime/Unsafe/CopyMemory.java @@ -30,14 +30,13 @@ * @run main CopyMemory */ -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 = UnsafeHelper.getUnsafe(); + Unsafe unsafe = Unsafe.getUnsafe(); long src = unsafe.allocateMemory(LENGTH); long dst = unsafe.allocateMemory(LENGTH); assertNotEquals(src, 0L); diff --git a/hotspot/test/runtime/Unsafe/DefineClass.java b/hotspot/test/runtime/Unsafe/DefineClass.java index 613e9afef6fb89eaacaa8b64534a87bbee81b2cb..5973f666122ddf7d84f2f8637d966403633a945b 100644 --- a/hotspot/test/runtime/Unsafe/DefineClass.java +++ b/hotspot/test/runtime/Unsafe/DefineClass.java @@ -34,13 +34,12 @@ import java.security.ProtectionDomain; import java.io.InputStream; import jdk.test.lib.InMemoryJavaCompiler; -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 = UnsafeHelper.getUnsafe(); + Unsafe unsafe = Unsafe.getUnsafe(); TestClassLoader classloader = new TestClassLoader(); ProtectionDomain pd = new ProtectionDomain(null, null); diff --git a/hotspot/test/runtime/Unsafe/FieldOffset.java b/hotspot/test/runtime/Unsafe/FieldOffset.java index b4d425b84213cd9fa17657bf2eff9c30bae15d1d..546e71cec5b02830347f74fa1a8093f176697e6c 100644 --- a/hotspot/test/runtime/Unsafe/FieldOffset.java +++ b/hotspot/test/runtime/Unsafe/FieldOffset.java @@ -31,14 +31,13 @@ */ import java.lang.reflect.Field; -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 = UnsafeHelper.getUnsafe(); + Unsafe unsafe = Unsafe.getUnsafe(); Field[] fields = Test.class.getDeclaredFields(); for (int i = 0; i < fields.length; i++) { diff --git a/hotspot/test/runtime/Unsafe/GetField.java b/hotspot/test/runtime/Unsafe/GetField.java index 48533068f3136f528141dc1223c23a9ec047dad6..3772fa6e8db7fe04c3e0152bbfc6bf81941b5c86 100644 --- a/hotspot/test/runtime/Unsafe/GetField.java +++ b/hotspot/test/runtime/Unsafe/GetField.java @@ -30,14 +30,13 @@ * @run main GetField */ -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 = UnsafeHelper.getUnsafe(); + Unsafe unsafe = Unsafe.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"); diff --git a/hotspot/test/runtime/Unsafe/GetPutAddress.java b/hotspot/test/runtime/Unsafe/GetPutAddress.java index 07fa4afa429ab7d4bf5252b1a4429bf5350ed54b..5fdb964037f4fe0caf081fb13e7aeaa15fd4ff17 100644 --- a/hotspot/test/runtime/Unsafe/GetPutAddress.java +++ b/hotspot/test/runtime/Unsafe/GetPutAddress.java @@ -31,13 +31,12 @@ */ import jdk.test.lib.Platform; -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 = UnsafeHelper.getUnsafe(); + Unsafe unsafe = Unsafe.getUnsafe(); int addressSize = unsafe.addressSize(); // Ensure the size returned from Unsafe.addressSize is correct assertEquals(unsafe.addressSize(), Platform.is32bit() ? 4 : 8); diff --git a/hotspot/test/runtime/Unsafe/GetPutBoolean.java b/hotspot/test/runtime/Unsafe/GetPutBoolean.java index fe53ad4f91132ad9049745d5216fde58542bcf7d..b5d8b7217aefe6b2841b3ea2f3c5fd83e180b6e9 100644 --- a/hotspot/test/runtime/Unsafe/GetPutBoolean.java +++ b/hotspot/test/runtime/Unsafe/GetPutBoolean.java @@ -31,13 +31,12 @@ */ import java.lang.reflect.Field; -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 = UnsafeHelper.getUnsafe(); + Unsafe unsafe = Unsafe.getUnsafe(); Test t = new Test(); Field field = Test.class.getField("b1"); diff --git a/hotspot/test/runtime/Unsafe/GetPutByte.java b/hotspot/test/runtime/Unsafe/GetPutByte.java index 9e2909e4e7dc06563be98492d3cfe0307074794e..89bf84a546c39329f00775fd93885ce6af1f259f 100644 --- a/hotspot/test/runtime/Unsafe/GetPutByte.java +++ b/hotspot/test/runtime/Unsafe/GetPutByte.java @@ -31,13 +31,12 @@ */ import java.lang.reflect.Field; -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 = UnsafeHelper.getUnsafe(); + Unsafe unsafe = Unsafe.getUnsafe(); Test t = new Test(); Field field = Test.class.getField("b"); diff --git a/hotspot/test/runtime/Unsafe/GetPutChar.java b/hotspot/test/runtime/Unsafe/GetPutChar.java index 7fcfeea8c26ea1693fe6701a599e7bc19a11917e..5e3c930d1d271f9b17fa861a955544e1eb8d5e0b 100644 --- a/hotspot/test/runtime/Unsafe/GetPutChar.java +++ b/hotspot/test/runtime/Unsafe/GetPutChar.java @@ -31,13 +31,12 @@ */ import java.lang.reflect.Field; -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 = UnsafeHelper.getUnsafe(); + Unsafe unsafe = Unsafe.getUnsafe(); Test t = new Test(); Field field = Test.class.getField("c"); diff --git a/hotspot/test/runtime/Unsafe/GetPutDouble.java b/hotspot/test/runtime/Unsafe/GetPutDouble.java index fb7210ae2ff912dd838972c4431299b9d671df36..101b4d76c636a140b8a011f383c13af36d5640fa 100644 --- a/hotspot/test/runtime/Unsafe/GetPutDouble.java +++ b/hotspot/test/runtime/Unsafe/GetPutDouble.java @@ -31,13 +31,12 @@ */ import java.lang.reflect.Field; -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 = UnsafeHelper.getUnsafe(); + Unsafe unsafe = Unsafe.getUnsafe(); Test t = new Test(); Field field = Test.class.getField("d"); diff --git a/hotspot/test/runtime/Unsafe/GetPutFloat.java b/hotspot/test/runtime/Unsafe/GetPutFloat.java index 26821864435a290681b670d5792d1cac4470e219..40a35ee52006223b43773694be19d7bbd1872761 100644 --- a/hotspot/test/runtime/Unsafe/GetPutFloat.java +++ b/hotspot/test/runtime/Unsafe/GetPutFloat.java @@ -31,13 +31,12 @@ */ import java.lang.reflect.Field; -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 = UnsafeHelper.getUnsafe(); + Unsafe unsafe = Unsafe.getUnsafe(); Test t = new Test(); Field field = Test.class.getField("f"); diff --git a/hotspot/test/runtime/Unsafe/GetPutInt.java b/hotspot/test/runtime/Unsafe/GetPutInt.java index 56b4d7629748efbbcc19cc8d29f7c3162f9c3898..8dfa401fee2fd1eaae0cb9cc2fdddf9e0e5d200e 100644 --- a/hotspot/test/runtime/Unsafe/GetPutInt.java +++ b/hotspot/test/runtime/Unsafe/GetPutInt.java @@ -30,13 +30,12 @@ */ import java.lang.reflect.Field; -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 = UnsafeHelper.getUnsafe(); + Unsafe unsafe = Unsafe.getUnsafe(); Test t = new Test(); Field field = Test.class.getField("i"); diff --git a/hotspot/test/runtime/Unsafe/GetPutLong.java b/hotspot/test/runtime/Unsafe/GetPutLong.java index d039e2275aa4bf99a7b73730512ccc8ded772e92..e0720e6f317826803a412f16bb67b074ef015818 100644 --- a/hotspot/test/runtime/Unsafe/GetPutLong.java +++ b/hotspot/test/runtime/Unsafe/GetPutLong.java @@ -31,13 +31,12 @@ */ import java.lang.reflect.Field; -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 = UnsafeHelper.getUnsafe(); + Unsafe unsafe = Unsafe.getUnsafe(); Test t = new Test(); Field field = Test.class.getField("l"); diff --git a/hotspot/test/runtime/Unsafe/GetPutObject.java b/hotspot/test/runtime/Unsafe/GetPutObject.java index 1ffc7b4d7563db3e8c9622ef18e55bb65f25817a..2ee272e22ec97b9df9b9e81815612460a019347f 100644 --- a/hotspot/test/runtime/Unsafe/GetPutObject.java +++ b/hotspot/test/runtime/Unsafe/GetPutObject.java @@ -31,13 +31,12 @@ */ import java.lang.reflect.Field; -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 = UnsafeHelper.getUnsafe(); + Unsafe unsafe = Unsafe.getUnsafe(); Test t = new Test(); Object o = new Object(); Field field = Test.class.getField("o"); diff --git a/hotspot/test/runtime/Unsafe/GetPutShort.java b/hotspot/test/runtime/Unsafe/GetPutShort.java index ae1cb97d9ad1037ece7c2e003b51d33e2063625f..7618e931a4894284a13bf9c69d5ddb5c8287ffa0 100644 --- a/hotspot/test/runtime/Unsafe/GetPutShort.java +++ b/hotspot/test/runtime/Unsafe/GetPutShort.java @@ -31,13 +31,12 @@ */ import java.lang.reflect.Field; -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 = UnsafeHelper.getUnsafe(); + Unsafe unsafe = Unsafe.getUnsafe(); Test t = new Test(); Field field = Test.class.getField("s"); diff --git a/hotspot/test/runtime/Unsafe/GetUncompressedObject.java b/hotspot/test/runtime/Unsafe/GetUncompressedObject.java index 380ab8438aa24db5d478ba9668f35efc2df46e9c..001d11a43554de902734a284d6a2bbdb07b14130 100644 --- a/hotspot/test/runtime/Unsafe/GetUncompressedObject.java +++ b/hotspot/test/runtime/Unsafe/GetUncompressedObject.java @@ -30,13 +30,12 @@ import static jdk.test.lib.Asserts.*; -import jdk.test.lib.unsafe.UnsafeHelper; import jdk.internal.misc.Unsafe; public class GetUncompressedObject { public static void main(String args[]) throws Exception { - Unsafe unsafe = UnsafeHelper.getUnsafe(); + Unsafe unsafe = Unsafe.getUnsafe(); // Allocate some memory and fill it with non-zero values. final int size = 32; diff --git a/hotspot/test/runtime/Unsafe/NestedUnsafe.java b/hotspot/test/runtime/Unsafe/NestedUnsafe.java index 98117d0d3849bfc8aa797e34b49408571f9e239c..a1a995ab6363d6ce020d30522b4c0a73976a2000 100644 --- a/hotspot/test/runtime/Unsafe/NestedUnsafe.java +++ b/hotspot/test/runtime/Unsafe/NestedUnsafe.java @@ -35,7 +35,6 @@ import java.security.ProtectionDomain; import java.io.InputStream; import java.lang.*; import jdk.test.lib.InMemoryJavaCompiler; -import jdk.test.lib.unsafe.UnsafeHelper; import jdk.internal.misc.Unsafe; import static jdk.test.lib.Asserts.*; @@ -50,7 +49,7 @@ public class NestedUnsafe { " } } "); public static void main(String args[]) throws Exception { - Unsafe unsafe = UnsafeHelper.getUnsafe(); + Unsafe unsafe = Unsafe.getUnsafe(); Class klass = unsafe.defineAnonymousClass(NestedUnsafe.class, klassbuf, new Object[0]); unsafe.ensureClassInitialized(klass); diff --git a/hotspot/test/runtime/Unsafe/PageSize.java b/hotspot/test/runtime/Unsafe/PageSize.java index a0b487a4dff2311937750073517c3349b9ad771f..009412fd18a0dce338d11e82a61ae03364115b45 100644 --- a/hotspot/test/runtime/Unsafe/PageSize.java +++ b/hotspot/test/runtime/Unsafe/PageSize.java @@ -31,13 +31,12 @@ */ import java.lang.reflect.Field; -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 = UnsafeHelper.getUnsafe(); + Unsafe unsafe = Unsafe.getUnsafe(); int pageSize = unsafe.pageSize(); for (int n = 1; n != 0; n <<= 1) { diff --git a/hotspot/test/runtime/Unsafe/PrimitiveHostClass.java b/hotspot/test/runtime/Unsafe/PrimitiveHostClass.java index ffe95401556db11cec4941c12aff119ece8ad038..689c2c1d6fe8b6d32987468636d07af66b6acfb7 100644 --- a/hotspot/test/runtime/Unsafe/PrimitiveHostClass.java +++ b/hotspot/test/runtime/Unsafe/PrimitiveHostClass.java @@ -39,16 +39,7 @@ import jdk.internal.misc.Unsafe; public class PrimitiveHostClass { - static final Unsafe U; - static { - try { - Field theUnsafe = Unsafe.class.getDeclaredField("theUnsafe"); - theUnsafe.setAccessible(true); - U = (Unsafe) theUnsafe.get(null); - } catch (Exception e) { - throw new AssertionError(e); - } - } + static final Unsafe U = Unsafe.getUnsafe(); public static void testVMAnonymousClass(Class hostClass) { diff --git a/hotspot/test/runtime/Unsafe/RangeCheck.java b/hotspot/test/runtime/Unsafe/RangeCheck.java index e9e9f224a2904289485f8651ea8a345dfaac85d6..8b885bfb3ba7871e28546494cf6326da4db65af9 100644 --- a/hotspot/test/runtime/Unsafe/RangeCheck.java +++ b/hotspot/test/runtime/Unsafe/RangeCheck.java @@ -33,7 +33,6 @@ import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.Platform; -import jdk.test.lib.unsafe.UnsafeHelper; import jdk.internal.misc.Unsafe; @@ -60,7 +59,7 @@ public class RangeCheck { public static class DummyClassWithMainRangeCheck { public static void main(String args[]) throws Exception { - Unsafe unsafe = UnsafeHelper.getUnsafe(); + Unsafe unsafe = Unsafe.getUnsafe(); unsafe.getObject(new DummyClassWithMainRangeCheck(), Short.MAX_VALUE); } } diff --git a/hotspot/test/runtime/Unsafe/Reallocate.java b/hotspot/test/runtime/Unsafe/Reallocate.java index 837e587fc28b5b7ba691405ca2aaae7cc53a6a68..4381fa124bc0b9e5733c3dec59c5a3227d8f40fc 100644 --- a/hotspot/test/runtime/Unsafe/Reallocate.java +++ b/hotspot/test/runtime/Unsafe/Reallocate.java @@ -31,13 +31,12 @@ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:MallocMaxTestWords=100m Reallocate */ -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 = UnsafeHelper.getUnsafe(); + Unsafe unsafe = Unsafe.getUnsafe(); long address = unsafe.allocateMemory(1); assertNotEquals(address, 0L); diff --git a/hotspot/test/runtime/Unsafe/SetMemory.java b/hotspot/test/runtime/Unsafe/SetMemory.java index 77eed63f60aa895976de54d9c9f26d477fb16189..8dd3a84c74ae03e033f9ed5978ac5548b400ad16 100644 --- a/hotspot/test/runtime/Unsafe/SetMemory.java +++ b/hotspot/test/runtime/Unsafe/SetMemory.java @@ -30,13 +30,12 @@ * @run main SetMemory */ -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 = UnsafeHelper.getUnsafe(); + Unsafe unsafe = Unsafe.getUnsafe(); long address = unsafe.allocateMemory(1); assertNotEquals(address, 0L); unsafe.setMemory(address, 1, (byte)17); diff --git a/hotspot/test/runtime/Unsafe/ThrowException.java b/hotspot/test/runtime/Unsafe/ThrowException.java index 465618c3cff9326c2cb612d18cbee18c8b1462d6..03df26c935c75ce280686f0383341e83a87539da 100644 --- a/hotspot/test/runtime/Unsafe/ThrowException.java +++ b/hotspot/test/runtime/Unsafe/ThrowException.java @@ -30,13 +30,12 @@ * @run main ThrowException */ -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 = UnsafeHelper.getUnsafe(); + Unsafe unsafe = Unsafe.getUnsafe(); try { unsafe.throwException(new TestException()); } catch (Throwable t) { diff --git a/hotspot/test/runtime/contended/Basic.java b/hotspot/test/runtime/contended/Basic.java index 5ffba1aa9206d898466b3298234d5d12f9ae520a..6b181aa5aa9d134b081419e4fccb358aa4e73a3d 100644 --- a/hotspot/test/runtime/contended/Basic.java +++ b/hotspot/test/runtime/contended/Basic.java @@ -48,20 +48,11 @@ import jdk.internal.vm.annotation.Contended; */ public class Basic { - private static final Unsafe U; + private static final Unsafe U = Unsafe.getUnsafe(); private static int ADDRESS_SIZE; private static int HEADER_SIZE; static { - // steal Unsafe - try { - Field unsafe = Unsafe.class.getDeclaredField("theUnsafe"); - unsafe.setAccessible(true); - U = (Unsafe) unsafe.get(null); - } catch (NoSuchFieldException | IllegalAccessException e) { - throw new IllegalStateException(e); - } - // When running with CompressedOops on 64-bit platform, the address size // reported by Unsafe is still 8, while the real reference fields are 4 bytes long. // Try to guess the reference field size with this naive trick. diff --git a/hotspot/test/runtime/contended/DefaultValue.java b/hotspot/test/runtime/contended/DefaultValue.java index b61ab3d4502a4592d12fd0992f3db6241f03d092..28aacd5d88c1192595b6459412f65f7ec3366518 100644 --- a/hotspot/test/runtime/contended/DefaultValue.java +++ b/hotspot/test/runtime/contended/DefaultValue.java @@ -49,20 +49,11 @@ import jdk.internal.vm.annotation.Contended; */ public class DefaultValue { - private static final Unsafe U; + private static final Unsafe U = Unsafe.getUnsafe(); private static int ADDRESS_SIZE; private static int HEADER_SIZE; static { - // steal Unsafe - try { - Field unsafe = Unsafe.class.getDeclaredField("theUnsafe"); - unsafe.setAccessible(true); - U = (Unsafe) unsafe.get(null); - } catch (NoSuchFieldException | IllegalAccessException e) { - throw new IllegalStateException(e); - } - // When running with CompressedOops on 64-bit platform, the address size // reported by Unsafe is still 8, while the real reference fields are 4 bytes long. // Try to guess the reference field size with this naive trick. diff --git a/hotspot/test/runtime/contended/Inheritance1.java b/hotspot/test/runtime/contended/Inheritance1.java index 57dec49b3ae2ac3b1f69a81cd52488d65a9c7021..fe253c0db2cbd00fe57c0af0838a7d2b5ffa7d97 100644 --- a/hotspot/test/runtime/contended/Inheritance1.java +++ b/hotspot/test/runtime/contended/Inheritance1.java @@ -49,20 +49,11 @@ import jdk.internal.vm.annotation.Contended; */ public class Inheritance1 { - private static final Unsafe U; + private static final Unsafe U = Unsafe.getUnsafe(); private static int ADDRESS_SIZE; private static int HEADER_SIZE; static { - // steal Unsafe - try { - Field unsafe = Unsafe.class.getDeclaredField("theUnsafe"); - unsafe.setAccessible(true); - U = (Unsafe) unsafe.get(null); - } catch (NoSuchFieldException | IllegalAccessException e) { - throw new IllegalStateException(e); - } - // When running with CompressedOops on 64-bit platform, the address size // reported by Unsafe is still 8, while the real reference fields are 4 bytes long. // Try to guess the reference field size with this naive trick. diff --git a/hotspot/test/runtime/defineAnonClass/NestedUnsafe.java b/hotspot/test/runtime/defineAnonClass/NestedUnsafe.java index c25f29a0965365ae84c4d441b996a7260ec4f40d..f4a80a61a59c129bffdf7574d1bd51b62ad3ea53 100644 --- a/hotspot/test/runtime/defineAnonClass/NestedUnsafe.java +++ b/hotspot/test/runtime/defineAnonClass/NestedUnsafe.java @@ -39,7 +39,6 @@ import java.io.InputStream; import java.lang.*; import jdk.test.lib.*; import jdk.internal.misc.Unsafe; -import jdk.test.lib.unsafe.UnsafeHelper; // Test that an anonymous class in package 'p' cannot define its own anonymous class @@ -54,7 +53,7 @@ public class NestedUnsafe { " } } "); public static void main(String args[]) throws Exception { - Unsafe unsafe = UnsafeHelper.getUnsafe(); + Unsafe unsafe = Unsafe.getUnsafe(); // The anonymous class calls defineAnonymousClass creating a nested anonymous class. byte klassbuf2[] = InMemoryJavaCompiler.compile("p.TestClass2", diff --git a/hotspot/test/runtime/defineAnonClass/NestedUnsafe2.java b/hotspot/test/runtime/defineAnonClass/NestedUnsafe2.java index 33ec95a1005f65d01cfad277ab93ad34ba615abd..0d773a56febb6a50fe766b584c34bee3b8fe16ae 100644 --- a/hotspot/test/runtime/defineAnonClass/NestedUnsafe2.java +++ b/hotspot/test/runtime/defineAnonClass/NestedUnsafe2.java @@ -39,7 +39,6 @@ import java.io.InputStream; import java.lang.*; import jdk.test.lib.*; import jdk.internal.misc.Unsafe; -import jdk.test.lib.unsafe.UnsafeHelper; // Test that an anonymous class that gets put in its host's package cannot define @@ -54,7 +53,7 @@ public class NestedUnsafe2 { " } } "); public static void main(String args[]) throws Exception { - Unsafe unsafe = UnsafeHelper.getUnsafe(); + Unsafe unsafe = Unsafe.getUnsafe(); // The anonymous class calls defineAnonymousClass creating a nested anonymous class. byte klassbuf2[] = InMemoryJavaCompiler.compile("TestClass2", diff --git a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/PathHandler.java b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/PathHandler.java index a86010c84ae2f955f96966c08d2f1f871a7461a5..36e6ddea8bea515cdd55affcf51bcc478b6fe94a 100644 --- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/PathHandler.java +++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/PathHandler.java @@ -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.unsafe.UnsafeHelper.getUnsafe(); + private static final Unsafe UNSAFE = Unsafe.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