mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 14:24:46 +02:00
8152698: Remove obsolete Unsafe.putOrdered{X} methods, usages, runtime and compiler support
Reviewed-by: kvn, psandoz
This commit is contained in:
parent
752d1b46bb
commit
d8f23ea33b
26 changed files with 32 additions and 85 deletions
|
@ -209,9 +209,6 @@ bool Compiler::is_intrinsic_supported(const methodHandle& method) {
|
|||
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:
|
||||
|
|
|
@ -3450,9 +3450,6 @@ void GraphBuilder::build_graph_for_intrinsic(ciMethod* callee) {
|
|||
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;
|
||||
|
|
|
@ -592,9 +592,6 @@ bool vmIntrinsics::is_disabled_by_flags(const methodHandle& method) {
|
|||
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:
|
||||
|
|
|
@ -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" ) \
|
||||
|
|
|
@ -484,9 +484,6 @@ bool C2Compiler::is_intrinsic_supported(const methodHandle& method, bool is_virt
|
|||
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:
|
||||
|
|
|
@ -621,10 +621,6 @@ bool LibraryCallKit::try_to_inline(int predicate) {
|
|||
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);
|
||||
|
|
|
@ -378,44 +378,6 @@ DEFINE_GETSETOOP_VOLATILE(jlong, Long);
|
|||
|
||||
#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 @@ static JNINativeMethod jdk_internal_misc_Unsafe_methods[] = {
|
|||
{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)},
|
||||
|
||||
|
|
|
@ -147,3 +147,4 @@ public class JdkInternalMiscUnsafeAccessTestBoolean {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -184,3 +184,4 @@ public class JdkInternalMiscUnsafeAccessTestByte {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -202,3 +202,4 @@ public class JdkInternalMiscUnsafeAccessTestChar {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -184,3 +184,4 @@ public class JdkInternalMiscUnsafeAccessTestDouble {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -184,3 +184,4 @@ public class JdkInternalMiscUnsafeAccessTestFloat {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -156,12 +156,6 @@ public class JdkInternalMiscUnsafeAccessTestInt {
|
|||
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 @@ public class JdkInternalMiscUnsafeAccessTestInt {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -156,12 +156,6 @@ public class JdkInternalMiscUnsafeAccessTestLong {
|
|||
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 @@ public class JdkInternalMiscUnsafeAccessTestLong {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -127,12 +127,6 @@ public class JdkInternalMiscUnsafeAccessTestObject {
|
|||
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 @@ public class JdkInternalMiscUnsafeAccessTestObject {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -202,3 +202,4 @@ public class JdkInternalMiscUnsafeAccessTestShort {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -130,6 +130,8 @@ public class SunMiscUnsafeAccessTestBoolean {
|
|||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -159,6 +159,7 @@ public class SunMiscUnsafeAccessTestByte {
|
|||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void testAccess(long address) {
|
||||
|
@ -170,3 +171,4 @@ public class SunMiscUnsafeAccessTestByte {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -159,6 +159,7 @@ public class SunMiscUnsafeAccessTestChar {
|
|||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void testAccess(long address) {
|
||||
|
@ -170,3 +171,4 @@ public class SunMiscUnsafeAccessTestChar {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -159,6 +159,7 @@ public class SunMiscUnsafeAccessTestDouble {
|
|||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void testAccess(long address) {
|
||||
|
@ -170,3 +171,4 @@ public class SunMiscUnsafeAccessTestDouble {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -159,6 +159,7 @@ public class SunMiscUnsafeAccessTestFloat {
|
|||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void testAccess(long address) {
|
||||
|
@ -170,3 +171,4 @@ public class SunMiscUnsafeAccessTestFloat {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -164,6 +164,7 @@ public class SunMiscUnsafeAccessTestInt {
|
|||
}
|
||||
|
||||
|
||||
|
||||
UNSAFE.putInt(base, offset, 1);
|
||||
|
||||
// Compare
|
||||
|
@ -181,6 +182,7 @@ public class SunMiscUnsafeAccessTestInt {
|
|||
assertEquals(x, 2, "failing compareAndSwap int value");
|
||||
}
|
||||
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
int o = UNSAFE.getAndSetInt(base, offset, 1);
|
||||
|
@ -209,3 +211,4 @@ public class SunMiscUnsafeAccessTestInt {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -164,6 +164,7 @@ public class SunMiscUnsafeAccessTestLong {
|
|||
}
|
||||
|
||||
|
||||
|
||||
UNSAFE.putLong(base, offset, 1L);
|
||||
|
||||
// Compare
|
||||
|
@ -181,6 +182,7 @@ public class SunMiscUnsafeAccessTestLong {
|
|||
assertEquals(x, 2L, "failing compareAndSwap long value");
|
||||
}
|
||||
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
long o = UNSAFE.getAndSetLong(base, offset, 1L);
|
||||
|
@ -209,3 +211,4 @@ public class SunMiscUnsafeAccessTestLong {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -135,6 +135,7 @@ public class SunMiscUnsafeAccessTestObject {
|
|||
}
|
||||
|
||||
|
||||
|
||||
UNSAFE.putObject(base, offset, "foo");
|
||||
|
||||
// Compare
|
||||
|
@ -152,6 +153,7 @@ public class SunMiscUnsafeAccessTestObject {
|
|||
assertEquals(x, "bar", "failing compareAndSwap Object value");
|
||||
}
|
||||
|
||||
|
||||
// Compare set and get
|
||||
{
|
||||
Object o = UNSAFE.getAndSetObject(base, offset, "foo");
|
||||
|
@ -163,3 +165,4 @@ public class SunMiscUnsafeAccessTestObject {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -159,6 +159,7 @@ public class SunMiscUnsafeAccessTestShort {
|
|||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void testAccess(long address) {
|
||||
|
@ -170,3 +171,4 @@ public class SunMiscUnsafeAccessTestShort {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -160,6 +160,7 @@ public class $Qualifier$UnsafeAccessTest$Type$ {
|
|||
assertEquals(x, $value2$, "putVolatile $type$ value");
|
||||
}
|
||||
|
||||
#if[!JdkInternalMisc]
|
||||
#if[Ordered]
|
||||
// Lazy
|
||||
{
|
||||
|
@ -168,6 +169,7 @@ public class $Qualifier$UnsafeAccessTest$Type$ {
|
|||
assertEquals(x, $value1$, "putRelease $type$ value");
|
||||
}
|
||||
#end[Ordered]
|
||||
#end[!JdkInternalMisc]
|
||||
|
||||
#if[JdkInternalMisc]
|
||||
// Lazy
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue