changeset 10527:29c7e2e6df92

8152698: Remove obsolete Unsafe.putOrdered{X} methods, usages, runtime and compiler support Reviewed-by: kvn, psandoz
author shade
date Fri, 25 Mar 2016 15:34:30 +0300
parents 055ca7aac8be
children 693064a31888
files src/share/vm/c1/c1_Compiler.cpp src/share/vm/c1/c1_GraphBuilder.cpp src/share/vm/classfile/vmSymbols.cpp src/share/vm/classfile/vmSymbols.hpp src/share/vm/opto/c2compiler.cpp src/share/vm/opto/library_call.cpp src/share/vm/prims/unsafe.cpp test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestBoolean.java test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestByte.java test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestChar.java test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestDouble.java test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestFloat.java test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestInt.java test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestLong.java test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestObject.java test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestShort.java test/compiler/unsafe/SunMiscUnsafeAccessTestBoolean.java test/compiler/unsafe/SunMiscUnsafeAccessTestByte.java test/compiler/unsafe/SunMiscUnsafeAccessTestChar.java test/compiler/unsafe/SunMiscUnsafeAccessTestDouble.java test/compiler/unsafe/SunMiscUnsafeAccessTestFloat.java test/compiler/unsafe/SunMiscUnsafeAccessTestInt.java test/compiler/unsafe/SunMiscUnsafeAccessTestLong.java test/compiler/unsafe/SunMiscUnsafeAccessTestObject.java test/compiler/unsafe/SunMiscUnsafeAccessTestShort.java test/compiler/unsafe/X-UnsafeAccessTest.java.template
diffstat 26 files changed, 32 insertions(+), 85 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/c1/c1_Compiler.cpp	Thu Mar 24 11:48:37 2016 -0700
+++ b/src/share/vm/c1/c1_Compiler.cpp	Fri Mar 25 15:34:30 2016 +0300
@@ -209,9 +209,6 @@
   case vmIntrinsics::_putLong_raw:
   case vmIntrinsics::_putFloat_raw:
   case vmIntrinsics::_putDouble_raw:
-  case vmIntrinsics::_putOrderedObject:
-  case vmIntrinsics::_putOrderedInt:
-  case vmIntrinsics::_putOrderedLong:
   case vmIntrinsics::_getShortUnaligned:
   case vmIntrinsics::_getCharUnaligned:
   case vmIntrinsics::_getIntUnaligned:
--- a/src/share/vm/c1/c1_GraphBuilder.cpp	Thu Mar 24 11:48:37 2016 -0700
+++ b/src/share/vm/c1/c1_GraphBuilder.cpp	Fri Mar 25 15:34:30 2016 +0300
@@ -3450,9 +3450,6 @@
   case vmIntrinsics::_putLong_raw        : append_unsafe_put_raw(callee, T_LONG  ); return;
   case vmIntrinsics::_putFloat_raw       : append_unsafe_put_raw(callee, T_FLOAT ); return;
   case vmIntrinsics::_putDouble_raw      : append_unsafe_put_raw(callee, T_DOUBLE);  return;
-  case vmIntrinsics::_putOrderedObject   : append_unsafe_put_obj(callee, T_OBJECT,  true); return;
-  case vmIntrinsics::_putOrderedInt      : append_unsafe_put_obj(callee, T_INT,     true); return;
-  case vmIntrinsics::_putOrderedLong     : append_unsafe_put_obj(callee, T_LONG,    true); return;
   case vmIntrinsics::_compareAndSwapLong:
   case vmIntrinsics::_compareAndSwapInt:
   case vmIntrinsics::_compareAndSwapObject: append_unsafe_CAS(callee); return;
--- a/src/share/vm/classfile/vmSymbols.cpp	Thu Mar 24 11:48:37 2016 -0700
+++ b/src/share/vm/classfile/vmSymbols.cpp	Fri Mar 25 15:34:30 2016 +0300
@@ -592,9 +592,6 @@
   case vmIntrinsics::_putLong_raw:
   case vmIntrinsics::_putFloat_raw:
   case vmIntrinsics::_putDouble_raw:
-  case vmIntrinsics::_putOrderedObject:
-  case vmIntrinsics::_putOrderedLong:
-  case vmIntrinsics::_putOrderedInt:
   case vmIntrinsics::_getAndAddInt:
   case vmIntrinsics::_getAndAddLong:
   case vmIntrinsics::_getAndSetInt:
--- a/src/share/vm/classfile/vmSymbols.hpp	Thu Mar 24 11:48:37 2016 -0700
+++ b/src/share/vm/classfile/vmSymbols.hpp	Fri Mar 25 15:34:30 2016 +0300
@@ -1330,16 +1330,6 @@
   do_intrinsic(_weakCompareAndSwapIntAcquire,     jdk_internal_misc_Unsafe,  weakCompareAndSwapIntAcquire_name,     compareAndSwapInt_signature,        F_R) \
   do_intrinsic(_weakCompareAndSwapIntRelease,     jdk_internal_misc_Unsafe,  weakCompareAndSwapIntRelease_name,     compareAndSwapInt_signature,        F_R) \
                                                                                                                         \
-  do_intrinsic(_putOrderedObject,         jdk_internal_misc_Unsafe,        putOrderedObject_name, putOrderedObject_signature, F_RN) \
-   do_name(     putOrderedObject_name,                           "putOrderedObject")                                    \
-   do_alias(    putOrderedObject_signature,                     /*(LObject;JLObject;)V*/ putObject_signature)           \
-  do_intrinsic(_putOrderedLong,           jdk_internal_misc_Unsafe,        putOrderedLong_name, putOrderedLong_signature, F_RN)  \
-   do_name(     putOrderedLong_name,                             "putOrderedLong")                                      \
-   do_alias(    putOrderedLong_signature,                       /*(Ljava/lang/Object;JJ)V*/ putLong_signature)          \
-  do_intrinsic(_putOrderedInt,            jdk_internal_misc_Unsafe,        putOrderedInt_name, putOrderedInt_signature,   F_RN)  \
-   do_name(     putOrderedInt_name,                              "putOrderedInt")                                       \
-   do_alias(    putOrderedInt_signature,                        /*(Ljava/lang/Object;JI)V*/ putInt_signature)           \
-                                                                                                                        \
   do_intrinsic(_getAndAddInt,             jdk_internal_misc_Unsafe,     getAndAddInt_name, getAndAddInt_signature, F_R)       \
    do_name(     getAndAddInt_name,                                      "getAndAddInt")                                       \
    do_signature(getAndAddInt_signature,                                 "(Ljava/lang/Object;JI)I" )                           \
--- a/src/share/vm/opto/c2compiler.cpp	Thu Mar 24 11:48:37 2016 -0700
+++ b/src/share/vm/opto/c2compiler.cpp	Fri Mar 25 15:34:30 2016 +0300
@@ -484,9 +484,6 @@
   case vmIntrinsics::_putCharUnaligned:
   case vmIntrinsics::_putIntUnaligned:
   case vmIntrinsics::_putLongUnaligned:
-  case vmIntrinsics::_putOrderedObject:
-  case vmIntrinsics::_putOrderedInt:
-  case vmIntrinsics::_putOrderedLong:
   case vmIntrinsics::_loadFence:
   case vmIntrinsics::_storeFence:
   case vmIntrinsics::_fullFence:
--- a/src/share/vm/opto/library_call.cpp	Thu Mar 24 11:48:37 2016 -0700
+++ b/src/share/vm/opto/library_call.cpp	Fri Mar 25 15:34:30 2016 +0300
@@ -621,10 +621,6 @@
   case vmIntrinsics::_putIntUnaligned:          return inline_unsafe_access(!is_native_ptr,  is_store, T_INT,      Relaxed, true);
   case vmIntrinsics::_putLongUnaligned:         return inline_unsafe_access(!is_native_ptr,  is_store, T_LONG,     Relaxed, true);
 
-  case vmIntrinsics::_putOrderedObject:         return inline_unsafe_access(!is_native_ptr,  is_store, T_OBJECT,   Release, false);
-  case vmIntrinsics::_putOrderedInt:            return inline_unsafe_access(!is_native_ptr,  is_store, T_INT,      Release, false);
-  case vmIntrinsics::_putOrderedLong:           return inline_unsafe_access(!is_native_ptr,  is_store, T_LONG,     Release, false);
-
   case vmIntrinsics::_getObjectAcquire:         return inline_unsafe_access(!is_native_ptr, !is_store, T_OBJECT,   Acquire, false);
   case vmIntrinsics::_getBooleanAcquire:        return inline_unsafe_access(!is_native_ptr, !is_store, T_BOOLEAN,  Acquire, false);
   case vmIntrinsics::_getByteAcquire:           return inline_unsafe_access(!is_native_ptr, !is_store, T_BYTE,     Acquire, false);
--- a/src/share/vm/prims/unsafe.cpp	Thu Mar 24 11:48:37 2016 -0700
+++ b/src/share/vm/prims/unsafe.cpp	Fri Mar 25 15:34:30 2016 +0300
@@ -378,44 +378,6 @@
 
 #undef DEFINE_GETSETOOP_VOLATILE
 
-// The non-intrinsified versions of setOrdered just use setVolatile
-
-UNSAFE_ENTRY(void, Unsafe_SetOrderedInt(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jint x)) {
-  SET_FIELD_VOLATILE(obj, offset, jint, x);
-} UNSAFE_END
-
-UNSAFE_ENTRY(void, Unsafe_SetOrderedObject(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jobject x_h)) {
-  oop x = JNIHandles::resolve(x_h);
-  oop p = JNIHandles::resolve(obj);
-  void* addr = index_oop_from_field_offset_long(p, offset);
-  OrderAccess::release();
-
-  if (UseCompressedOops) {
-    oop_store((narrowOop*)addr, x);
-  } else {
-    oop_store((oop*)addr, x);
-  }
-
-  OrderAccess::fence();
-} UNSAFE_END
-
-UNSAFE_ENTRY(void, Unsafe_SetOrderedLong(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jlong x)) {
-#ifdef SUPPORTS_NATIVE_CX8
-  SET_FIELD_VOLATILE(obj, offset, jlong, x);
-#else
-
-  // Keep old code for platforms which may not have atomic long (8 bytes) instructions
-  if (VM_Version::supports_cx8()) {
-    SET_FIELD_VOLATILE(obj, offset, jlong, x);
-  } else {
-    Handle p(THREAD, JNIHandles::resolve(obj));
-    jlong* addr = (jlong*)(index_oop_from_field_offset_long(p(), offset));
-    MutexLockerEx mu(UnsafeJlong_lock, Mutex::_no_safepoint_check_flag);
-    Atomic::store(x, addr);
-  }
-#endif
-} UNSAFE_END
-
 UNSAFE_LEAF(void, Unsafe_LoadFence(JNIEnv *env, jobject unsafe)) {
   OrderAccess::acquire();
 } UNSAFE_END
@@ -1230,9 +1192,6 @@
     {CC "compareAndExchangeIntVolatile",  CC "(" OBJ "J""I""I"")I", FN_PTR(Unsafe_CompareAndExchangeInt)},
     {CC "compareAndExchangeLongVolatile", CC "(" OBJ "J""J""J"")J", FN_PTR(Unsafe_CompareAndExchangeLong)},
 
-    {CC "putOrderedObject",   CC "(" OBJ "J" OBJ ")V",   FN_PTR(Unsafe_SetOrderedObject)},
-    {CC "putOrderedInt",      CC "(" OBJ "JI)V",         FN_PTR(Unsafe_SetOrderedInt)},
-    {CC "putOrderedLong",     CC "(" OBJ "JJ)V",         FN_PTR(Unsafe_SetOrderedLong)},
     {CC "park",               CC "(ZJ)V",                FN_PTR(Unsafe_Park)},
     {CC "unpark",             CC "(" OBJ ")V",           FN_PTR(Unsafe_Unpark)},
 
--- a/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestBoolean.java	Thu Mar 24 11:48:37 2016 -0700
+++ b/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestBoolean.java	Fri Mar 25 15:34:30 2016 +0300
@@ -147,3 +147,4 @@
     }
 
 }
+
--- a/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestByte.java	Thu Mar 24 11:48:37 2016 -0700
+++ b/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestByte.java	Fri Mar 25 15:34:30 2016 +0300
@@ -184,3 +184,4 @@
         }
     }
 }
+
--- a/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestChar.java	Thu Mar 24 11:48:37 2016 -0700
+++ b/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestChar.java	Fri Mar 25 15:34:30 2016 +0300
@@ -202,3 +202,4 @@
         }
     }
 }
+
--- a/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestDouble.java	Thu Mar 24 11:48:37 2016 -0700
+++ b/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestDouble.java	Fri Mar 25 15:34:30 2016 +0300
@@ -184,3 +184,4 @@
         }
     }
 }
+
--- a/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestFloat.java	Thu Mar 24 11:48:37 2016 -0700
+++ b/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestFloat.java	Fri Mar 25 15:34:30 2016 +0300
@@ -184,3 +184,4 @@
         }
     }
 }
+
--- a/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestInt.java	Thu Mar 24 11:48:37 2016 -0700
+++ b/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestInt.java	Fri Mar 25 15:34:30 2016 +0300
@@ -156,12 +156,6 @@
             assertEquals(x, 2, "putVolatile int value");
         }
 
-        // Lazy
-        {
-            UNSAFE.putOrderedInt(base, offset, 1);
-            int x = UNSAFE.getIntVolatile(base, offset);
-            assertEquals(x, 1, "putRelease int value");
-        }
 
         // Lazy
         {
@@ -305,3 +299,4 @@
         }
     }
 }
+
--- a/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestLong.java	Thu Mar 24 11:48:37 2016 -0700
+++ b/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestLong.java	Fri Mar 25 15:34:30 2016 +0300
@@ -156,12 +156,6 @@
             assertEquals(x, 2L, "putVolatile long value");
         }
 
-        // Lazy
-        {
-            UNSAFE.putOrderedLong(base, offset, 1L);
-            long x = UNSAFE.getLongVolatile(base, offset);
-            assertEquals(x, 1L, "putRelease long value");
-        }
 
         // Lazy
         {
@@ -305,3 +299,4 @@
         }
     }
 }
+
--- a/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestObject.java	Thu Mar 24 11:48:37 2016 -0700
+++ b/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestObject.java	Fri Mar 25 15:34:30 2016 +0300
@@ -127,12 +127,6 @@
             assertEquals(x, "bar", "putVolatile Object value");
         }
 
-        // Lazy
-        {
-            UNSAFE.putOrderedObject(base, offset, "foo");
-            Object x = UNSAFE.getObjectVolatile(base, offset);
-            assertEquals(x, "foo", "putRelease Object value");
-        }
 
         // Lazy
         {
@@ -241,3 +235,4 @@
     }
 
 }
+
--- a/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestShort.java	Thu Mar 24 11:48:37 2016 -0700
+++ b/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestShort.java	Fri Mar 25 15:34:30 2016 +0300
@@ -202,3 +202,4 @@
         }
     }
 }
+
--- a/test/compiler/unsafe/SunMiscUnsafeAccessTestBoolean.java	Thu Mar 24 11:48:37 2016 -0700
+++ b/test/compiler/unsafe/SunMiscUnsafeAccessTestBoolean.java	Fri Mar 25 15:34:30 2016 +0300
@@ -130,6 +130,8 @@
 
 
 
+
     }
 
 }
+
--- a/test/compiler/unsafe/SunMiscUnsafeAccessTestByte.java	Thu Mar 24 11:48:37 2016 -0700
+++ b/test/compiler/unsafe/SunMiscUnsafeAccessTestByte.java	Fri Mar 25 15:34:30 2016 +0300
@@ -159,6 +159,7 @@
 
 
 
+
     }
 
     static void testAccess(long address) {
@@ -170,3 +171,4 @@
         }
     }
 }
+
--- a/test/compiler/unsafe/SunMiscUnsafeAccessTestChar.java	Thu Mar 24 11:48:37 2016 -0700
+++ b/test/compiler/unsafe/SunMiscUnsafeAccessTestChar.java	Fri Mar 25 15:34:30 2016 +0300
@@ -159,6 +159,7 @@
 
 
 
+
     }
 
     static void testAccess(long address) {
@@ -170,3 +171,4 @@
         }
     }
 }
+
--- a/test/compiler/unsafe/SunMiscUnsafeAccessTestDouble.java	Thu Mar 24 11:48:37 2016 -0700
+++ b/test/compiler/unsafe/SunMiscUnsafeAccessTestDouble.java	Fri Mar 25 15:34:30 2016 +0300
@@ -159,6 +159,7 @@
 
 
 
+
     }
 
     static void testAccess(long address) {
@@ -170,3 +171,4 @@
         }
     }
 }
+
--- a/test/compiler/unsafe/SunMiscUnsafeAccessTestFloat.java	Thu Mar 24 11:48:37 2016 -0700
+++ b/test/compiler/unsafe/SunMiscUnsafeAccessTestFloat.java	Fri Mar 25 15:34:30 2016 +0300
@@ -159,6 +159,7 @@
 
 
 
+
     }
 
     static void testAccess(long address) {
@@ -170,3 +171,4 @@
         }
     }
 }
+
--- a/test/compiler/unsafe/SunMiscUnsafeAccessTestInt.java	Thu Mar 24 11:48:37 2016 -0700
+++ b/test/compiler/unsafe/SunMiscUnsafeAccessTestInt.java	Fri Mar 25 15:34:30 2016 +0300
@@ -164,6 +164,7 @@
         }
 
 
+
         UNSAFE.putInt(base, offset, 1);
 
         // Compare
@@ -181,6 +182,7 @@
             assertEquals(x, 2, "failing compareAndSwap int value");
         }
 
+
         // Compare set and get
         {
             int o = UNSAFE.getAndSetInt(base, offset, 1);
@@ -209,3 +211,4 @@
         }
     }
 }
+
--- a/test/compiler/unsafe/SunMiscUnsafeAccessTestLong.java	Thu Mar 24 11:48:37 2016 -0700
+++ b/test/compiler/unsafe/SunMiscUnsafeAccessTestLong.java	Fri Mar 25 15:34:30 2016 +0300
@@ -164,6 +164,7 @@
         }
 
 
+
         UNSAFE.putLong(base, offset, 1L);
 
         // Compare
@@ -181,6 +182,7 @@
             assertEquals(x, 2L, "failing compareAndSwap long value");
         }
 
+
         // Compare set and get
         {
             long o = UNSAFE.getAndSetLong(base, offset, 1L);
@@ -209,3 +211,4 @@
         }
     }
 }
+
--- a/test/compiler/unsafe/SunMiscUnsafeAccessTestObject.java	Thu Mar 24 11:48:37 2016 -0700
+++ b/test/compiler/unsafe/SunMiscUnsafeAccessTestObject.java	Fri Mar 25 15:34:30 2016 +0300
@@ -135,6 +135,7 @@
         }
 
 
+
         UNSAFE.putObject(base, offset, "foo");
 
         // Compare
@@ -152,6 +153,7 @@
             assertEquals(x, "bar", "failing compareAndSwap Object value");
         }
 
+
         // Compare set and get
         {
             Object o = UNSAFE.getAndSetObject(base, offset, "foo");
@@ -163,3 +165,4 @@
     }
 
 }
+
--- a/test/compiler/unsafe/SunMiscUnsafeAccessTestShort.java	Thu Mar 24 11:48:37 2016 -0700
+++ b/test/compiler/unsafe/SunMiscUnsafeAccessTestShort.java	Fri Mar 25 15:34:30 2016 +0300
@@ -159,6 +159,7 @@
 
 
 
+
     }
 
     static void testAccess(long address) {
@@ -170,3 +171,4 @@
         }
     }
 }
+
--- a/test/compiler/unsafe/X-UnsafeAccessTest.java.template	Thu Mar 24 11:48:37 2016 -0700
+++ b/test/compiler/unsafe/X-UnsafeAccessTest.java.template	Fri Mar 25 15:34:30 2016 +0300
@@ -160,6 +160,7 @@
             assertEquals(x, $value2$, "putVolatile $type$ value");
         }
 
+#if[!JdkInternalMisc]
 #if[Ordered]
         // Lazy
         {
@@ -168,6 +169,7 @@
             assertEquals(x, $value1$, "putRelease $type$ value");
         }
 #end[Ordered]
+#end[!JdkInternalMisc]
 
 #if[JdkInternalMisc]
         // Lazy