8165889: Remove jdk.test.lib.unsafe.UnsafeHelper
authorgtriantafill
Wed, 14 Sep 2016 08:17:50 -0400
changeset 41092 c388d897472d
parent 41091 de3789bb384e
child 41093 b7bbdd06976e
8165889: Remove jdk.test.lib.unsafe.UnsafeHelper Summary: Remove use of setAccessible() to get Unsafe. Reviewed-by: shade, lfoltan
hotspot/test/compiler/c2/Test6968348.java
hotspot/test/compiler/c2/cr8004867/TestIntUnsafeCAS.java
hotspot/test/compiler/c2/cr8004867/TestIntUnsafeOrdered.java
hotspot/test/compiler/c2/cr8004867/TestIntUnsafeVolatile.java
hotspot/test/compiler/intrinsics/unsafe/TestUnsafeMismatchedArrayFieldAccess.java
hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodTest.java
hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java
hotspot/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java
hotspot/test/compiler/jvmci/compilerToVM/ResolveMethodTest.java
hotspot/test/compiler/loopopts/superword/TestVectorizationWithInvariant.java
hotspot/test/compiler/rtm/locking/TestRTMAbortRatio.java
hotspot/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java
hotspot/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java
hotspot/test/compiler/rtm/locking/TestRTMLockingThreshold.java
hotspot/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java
hotspot/test/compiler/testlibrary/rtm/XAbortProvoker.java
hotspot/test/compiler/unsafe/UnsafeRaw.java
hotspot/test/gc/arguments/TestMaxMinHeapFreeRatioFlags.java
hotspot/test/gc/arguments/TestTargetSurvivorRatioFlag.java
hotspot/test/runtime/ErrorHandling/CreateCoredumpOnCrash.java
hotspot/test/runtime/ErrorHandling/ProblematicFrameTest.java
hotspot/test/runtime/Unsafe/AllocateInstance.java
hotspot/test/runtime/Unsafe/AllocateMemory.java
hotspot/test/runtime/Unsafe/CopyMemory.java
hotspot/test/runtime/Unsafe/DefineClass.java
hotspot/test/runtime/Unsafe/FieldOffset.java
hotspot/test/runtime/Unsafe/GetField.java
hotspot/test/runtime/Unsafe/GetPutAddress.java
hotspot/test/runtime/Unsafe/GetPutBoolean.java
hotspot/test/runtime/Unsafe/GetPutByte.java
hotspot/test/runtime/Unsafe/GetPutChar.java
hotspot/test/runtime/Unsafe/GetPutDouble.java
hotspot/test/runtime/Unsafe/GetPutFloat.java
hotspot/test/runtime/Unsafe/GetPutInt.java
hotspot/test/runtime/Unsafe/GetPutLong.java
hotspot/test/runtime/Unsafe/GetPutObject.java
hotspot/test/runtime/Unsafe/GetPutShort.java
hotspot/test/runtime/Unsafe/GetUncompressedObject.java
hotspot/test/runtime/Unsafe/NestedUnsafe.java
hotspot/test/runtime/Unsafe/PageSize.java
hotspot/test/runtime/Unsafe/PrimitiveHostClass.java
hotspot/test/runtime/Unsafe/RangeCheck.java
hotspot/test/runtime/Unsafe/Reallocate.java
hotspot/test/runtime/Unsafe/SetMemory.java
hotspot/test/runtime/Unsafe/ThrowException.java
hotspot/test/runtime/contended/Basic.java
hotspot/test/runtime/contended/DefaultValue.java
hotspot/test/runtime/contended/Inheritance1.java
hotspot/test/runtime/defineAnonClass/NestedUnsafe.java
hotspot/test/runtime/defineAnonClass/NestedUnsafe2.java
hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/PathHandler.java
--- a/hotspot/test/compiler/c2/Test6968348.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/compiler/c2/Test6968348.java	Wed Sep 14 08:17:50 2016 -0400
@@ -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 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++) {
--- a/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeCAS.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeCAS.java	Wed Sep 14 08:17:50 2016 -0400
@@ -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 @@
   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();
--- a/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeOrdered.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeOrdered.java	Wed Sep 14 08:17:50 2016 -0400
@@ -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 @@
   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();
--- a/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeVolatile.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/compiler/c2/cr8004867/TestIntUnsafeVolatile.java	Wed Sep 14 08:17:50 2016 -0400
@@ -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 @@
   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();
--- a/hotspot/test/compiler/intrinsics/unsafe/TestUnsafeMismatchedArrayFieldAccess.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/compiler/intrinsics/unsafe/TestUnsafeMismatchedArrayFieldAccess.java	Wed Sep 14 08:17:50 2016 -0400
@@ -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 {
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodTest.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodTest.java	Wed Sep 14 08:17:50 2016 -0400
@@ -45,7 +45,6 @@
 
 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 @@
         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;
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java	Wed Sep 14 08:17:50 2016 -0400
@@ -53,7 +53,6 @@
 
 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 @@
         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
--- a/hotspot/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java	Wed Sep 14 08:17:50 2016 -0400
@@ -53,7 +53,6 @@
 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 @@
  */
 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<ConstantTypes, Validator> typeTests = new HashMap<>();
--- a/hotspot/test/compiler/jvmci/compilerToVM/ResolveMethodTest.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolveMethodTest.java	Wed Sep 14 08:17:50 2016 -0400
@@ -52,7 +52,6 @@
 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.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();
--- a/hotspot/test/compiler/loopopts/superword/TestVectorizationWithInvariant.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/compiler/loopopts/superword/TestVectorizationWithInvariant.java	Wed Sep 14 08:17:50 2016 -0400
@@ -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 @@
     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);
     }
--- a/hotspot/test/compiler/rtm/locking/TestRTMAbortRatio.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/compiler/rtm/locking/TestRTMAbortRatio.java	Wed Sep 14 08:17:50 2016 -0400
@@ -49,7 +49,6 @@
 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 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")
--- a/hotspot/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java	Wed Sep 14 08:17:50 2016 -0400
@@ -51,7 +51,6 @@
 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 @@
         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
--- a/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java	Wed Sep 14 08:17:50 2016 -0400
@@ -48,7 +48,6 @@
 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 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
--- a/hotspot/test/compiler/rtm/locking/TestRTMLockingThreshold.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/compiler/rtm/locking/TestRTMLockingThreshold.java	Wed Sep 14 08:17:50 2016 -0400
@@ -49,7 +49,6 @@
 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 @@
         @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();
 
 
--- a/hotspot/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java	Wed Sep 14 08:17:50 2016 -0400
@@ -49,7 +49,6 @@
 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 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")
--- a/hotspot/test/compiler/testlibrary/rtm/XAbortProvoker.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/compiler/testlibrary/rtm/XAbortProvoker.java	Wed Sep 14 08:17:50 2016 -0400
@@ -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 @@
     // 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());
--- a/hotspot/test/compiler/unsafe/UnsafeRaw.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/compiler/unsafe/UnsafeRaw.java	Wed Sep 14 08:17:50 2016 -0400
@@ -35,7 +35,6 @@
 
 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 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;
--- a/hotspot/test/gc/arguments/TestMaxMinHeapFreeRatioFlags.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/gc/arguments/TestMaxMinHeapFreeRatioFlags.java	Wed Sep 14 08:17:50 2016 -0400
@@ -37,7 +37,6 @@
 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 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;
--- a/hotspot/test/gc/arguments/TestTargetSurvivorRatioFlag.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/gc/arguments/TestTargetSurvivorRatioFlag.java	Wed Sep 14 08:17:50 2016 -0400
@@ -46,7 +46,6 @@
 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 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;
--- a/hotspot/test/runtime/ErrorHandling/CreateCoredumpOnCrash.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/runtime/ErrorHandling/CreateCoredumpOnCrash.java	Wed Sep 14 08:17:50 2016 -0400
@@ -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);
         }
     }
 
--- a/hotspot/test/runtime/ErrorHandling/ProblematicFrameTest.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/runtime/ErrorHandling/ProblematicFrameTest.java	Wed Sep 14 08:17:50 2016 -0400
@@ -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);
         }
     }
 
--- a/hotspot/test/runtime/Unsafe/AllocateInstance.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/runtime/Unsafe/AllocateInstance.java	Wed Sep 14 08:17:50 2016 -0400
@@ -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;
--- a/hotspot/test/runtime/Unsafe/AllocateMemory.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/runtime/Unsafe/AllocateMemory.java	Wed Sep 14 08:17:50 2016 -0400
@@ -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);
--- a/hotspot/test/runtime/Unsafe/CopyMemory.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/runtime/Unsafe/CopyMemory.java	Wed Sep 14 08:17:50 2016 -0400
@@ -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);
--- a/hotspot/test/runtime/Unsafe/DefineClass.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/runtime/Unsafe/DefineClass.java	Wed Sep 14 08:17:50 2016 -0400
@@ -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);
 
--- a/hotspot/test/runtime/Unsafe/FieldOffset.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/runtime/Unsafe/FieldOffset.java	Wed Sep 14 08:17:50 2016 -0400
@@ -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++) {
--- a/hotspot/test/runtime/Unsafe/GetField.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/runtime/Unsafe/GetField.java	Wed Sep 14 08:17:50 2016 -0400
@@ -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");
--- a/hotspot/test/runtime/Unsafe/GetPutAddress.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/runtime/Unsafe/GetPutAddress.java	Wed Sep 14 08:17:50 2016 -0400
@@ -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);
--- a/hotspot/test/runtime/Unsafe/GetPutBoolean.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/runtime/Unsafe/GetPutBoolean.java	Wed Sep 14 08:17:50 2016 -0400
@@ -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");
 
--- a/hotspot/test/runtime/Unsafe/GetPutByte.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/runtime/Unsafe/GetPutByte.java	Wed Sep 14 08:17:50 2016 -0400
@@ -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");
 
--- a/hotspot/test/runtime/Unsafe/GetPutChar.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/runtime/Unsafe/GetPutChar.java	Wed Sep 14 08:17:50 2016 -0400
@@ -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");
 
--- a/hotspot/test/runtime/Unsafe/GetPutDouble.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/runtime/Unsafe/GetPutDouble.java	Wed Sep 14 08:17:50 2016 -0400
@@ -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");
 
--- a/hotspot/test/runtime/Unsafe/GetPutFloat.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/runtime/Unsafe/GetPutFloat.java	Wed Sep 14 08:17:50 2016 -0400
@@ -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");
 
--- a/hotspot/test/runtime/Unsafe/GetPutInt.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/runtime/Unsafe/GetPutInt.java	Wed Sep 14 08:17:50 2016 -0400
@@ -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");
 
--- a/hotspot/test/runtime/Unsafe/GetPutLong.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/runtime/Unsafe/GetPutLong.java	Wed Sep 14 08:17:50 2016 -0400
@@ -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");
 
--- a/hotspot/test/runtime/Unsafe/GetPutObject.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/runtime/Unsafe/GetPutObject.java	Wed Sep 14 08:17:50 2016 -0400
@@ -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");
--- a/hotspot/test/runtime/Unsafe/GetPutShort.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/runtime/Unsafe/GetPutShort.java	Wed Sep 14 08:17:50 2016 -0400
@@ -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");
 
--- a/hotspot/test/runtime/Unsafe/GetUncompressedObject.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/runtime/Unsafe/GetUncompressedObject.java	Wed Sep 14 08:17:50 2016 -0400
@@ -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;
--- a/hotspot/test/runtime/Unsafe/NestedUnsafe.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/runtime/Unsafe/NestedUnsafe.java	Wed Sep 14 08:17:50 2016 -0400
@@ -35,7 +35,6 @@
 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 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);
--- a/hotspot/test/runtime/Unsafe/PageSize.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/runtime/Unsafe/PageSize.java	Wed Sep 14 08:17:50 2016 -0400
@@ -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) {
--- a/hotspot/test/runtime/Unsafe/PrimitiveHostClass.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/runtime/Unsafe/PrimitiveHostClass.java	Wed Sep 14 08:17:50 2016 -0400
@@ -39,16 +39,7 @@
 
 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) {
 
--- a/hotspot/test/runtime/Unsafe/RangeCheck.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/runtime/Unsafe/RangeCheck.java	Wed Sep 14 08:17:50 2016 -0400
@@ -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 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);
         }
     }
--- a/hotspot/test/runtime/Unsafe/Reallocate.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/runtime/Unsafe/Reallocate.java	Wed Sep 14 08:17:50 2016 -0400
@@ -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);
--- a/hotspot/test/runtime/Unsafe/SetMemory.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/runtime/Unsafe/SetMemory.java	Wed Sep 14 08:17:50 2016 -0400
@@ -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);
--- a/hotspot/test/runtime/Unsafe/ThrowException.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/runtime/Unsafe/ThrowException.java	Wed Sep 14 08:17:50 2016 -0400
@@ -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) {
--- a/hotspot/test/runtime/contended/Basic.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/runtime/contended/Basic.java	Wed Sep 14 08:17:50 2016 -0400
@@ -48,20 +48,11 @@
  */
 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.
--- a/hotspot/test/runtime/contended/DefaultValue.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/runtime/contended/DefaultValue.java	Wed Sep 14 08:17:50 2016 -0400
@@ -49,20 +49,11 @@
  */
 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.
--- a/hotspot/test/runtime/contended/Inheritance1.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/runtime/contended/Inheritance1.java	Wed Sep 14 08:17:50 2016 -0400
@@ -49,20 +49,11 @@
  */
 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.
--- a/hotspot/test/runtime/defineAnonClass/NestedUnsafe.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/runtime/defineAnonClass/NestedUnsafe.java	Wed Sep 14 08:17:50 2016 -0400
@@ -39,7 +39,6 @@
 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 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",
--- a/hotspot/test/runtime/defineAnonClass/NestedUnsafe2.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/runtime/defineAnonClass/NestedUnsafe2.java	Wed Sep 14 08:17:50 2016 -0400
@@ -39,7 +39,6 @@
 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 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",
--- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/PathHandler.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/PathHandler.java	Wed Sep 14 08:17:50 2016 -0400
@@ -39,7 +39,7 @@
  * 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