8181292: Backport Rename internal Unsafe.compare methods from 10 to 9
Co-authored-by: Claes Redestad <claes.redestad@oracle.com> Reviewed-by: psandoz, dholmes, thartmann, kvn
This commit is contained in:
parent
c4d86b2455
commit
061b09e847
hotspot
src
jdk.internal.vm.compiler/share/classes
org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test
org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements
share/vm
test/compiler
c2/cr8004867
intrinsics/unsafe
profiling
unsafe
JdkInternalMiscUnsafeAccessTestBoolean.javaJdkInternalMiscUnsafeAccessTestByte.javaJdkInternalMiscUnsafeAccessTestChar.javaJdkInternalMiscUnsafeAccessTestDouble.javaJdkInternalMiscUnsafeAccessTestFloat.javaJdkInternalMiscUnsafeAccessTestInt.javaJdkInternalMiscUnsafeAccessTestLong.javaJdkInternalMiscUnsafeAccessTestObject.javaJdkInternalMiscUnsafeAccessTestShort.javaSunMiscUnsafeAccessTestBoolean.javaSunMiscUnsafeAccessTestByte.javaSunMiscUnsafeAccessTestChar.javaSunMiscUnsafeAccessTestDouble.javaSunMiscUnsafeAccessTestFloat.javaSunMiscUnsafeAccessTestInt.javaSunMiscUnsafeAccessTestLong.javaSunMiscUnsafeAccessTestObject.javaSunMiscUnsafeAccessTestShort.javaX-UnsafeAccessTest.java.template
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2017, 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
|
||||
@ -246,21 +246,21 @@ public class CheckGraalIntrinsics extends GraalTest {
|
||||
"jdk/internal/misc/Unsafe.allocateUninitializedArray0(Ljava/lang/Class;I)Ljava/lang/Object;",
|
||||
"jdk/internal/misc/Unsafe.compareAndExchangeByteAcquire(Ljava/lang/Object;JBB)B",
|
||||
"jdk/internal/misc/Unsafe.compareAndExchangeByteRelease(Ljava/lang/Object;JBB)B",
|
||||
"jdk/internal/misc/Unsafe.compareAndExchangeByteVolatile(Ljava/lang/Object;JBB)B",
|
||||
"jdk/internal/misc/Unsafe.compareAndExchangeByte(Ljava/lang/Object;JBB)B",
|
||||
"jdk/internal/misc/Unsafe.compareAndExchangeIntAcquire(Ljava/lang/Object;JII)I",
|
||||
"jdk/internal/misc/Unsafe.compareAndExchangeIntRelease(Ljava/lang/Object;JII)I",
|
||||
"jdk/internal/misc/Unsafe.compareAndExchangeIntVolatile(Ljava/lang/Object;JII)I",
|
||||
"jdk/internal/misc/Unsafe.compareAndExchangeInt(Ljava/lang/Object;JII)I",
|
||||
"jdk/internal/misc/Unsafe.compareAndExchangeLongAcquire(Ljava/lang/Object;JJJ)J",
|
||||
"jdk/internal/misc/Unsafe.compareAndExchangeLongRelease(Ljava/lang/Object;JJJ)J",
|
||||
"jdk/internal/misc/Unsafe.compareAndExchangeLongVolatile(Ljava/lang/Object;JJJ)J",
|
||||
"jdk/internal/misc/Unsafe.compareAndExchangeLong(Ljava/lang/Object;JJJ)J",
|
||||
"jdk/internal/misc/Unsafe.compareAndExchangeObjectAcquire(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;",
|
||||
"jdk/internal/misc/Unsafe.compareAndExchangeObjectRelease(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;",
|
||||
"jdk/internal/misc/Unsafe.compareAndExchangeObjectVolatile(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;",
|
||||
"jdk/internal/misc/Unsafe.compareAndExchangeObject(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;",
|
||||
"jdk/internal/misc/Unsafe.compareAndExchangeShortAcquire(Ljava/lang/Object;JSS)S",
|
||||
"jdk/internal/misc/Unsafe.compareAndExchangeShortRelease(Ljava/lang/Object;JSS)S",
|
||||
"jdk/internal/misc/Unsafe.compareAndExchangeShortVolatile(Ljava/lang/Object;JSS)S",
|
||||
"jdk/internal/misc/Unsafe.compareAndSwapByte(Ljava/lang/Object;JBB)Z",
|
||||
"jdk/internal/misc/Unsafe.compareAndSwapShort(Ljava/lang/Object;JSS)Z",
|
||||
"jdk/internal/misc/Unsafe.compareAndExchangeShort(Ljava/lang/Object;JSS)S",
|
||||
"jdk/internal/misc/Unsafe.compareAndSetByte(Ljava/lang/Object;JBB)Z",
|
||||
"jdk/internal/misc/Unsafe.compareAndSetShort(Ljava/lang/Object;JSS)Z",
|
||||
"jdk/internal/misc/Unsafe.copyMemory0(Ljava/lang/Object;JLjava/lang/Object;JJ)V",
|
||||
"jdk/internal/misc/Unsafe.getAndAddByte(Ljava/lang/Object;JB)B",
|
||||
"jdk/internal/misc/Unsafe.getAndAddShort(Ljava/lang/Object;JS)S",
|
||||
@ -295,26 +295,26 @@ public class CheckGraalIntrinsics extends GraalTest {
|
||||
"jdk/internal/misc/Unsafe.putObjectOpaque(Ljava/lang/Object;JLjava/lang/Object;)V",
|
||||
"jdk/internal/misc/Unsafe.putShortOpaque(Ljava/lang/Object;JS)V",
|
||||
"jdk/internal/misc/Unsafe.unpark(Ljava/lang/Object;)V",
|
||||
"jdk/internal/misc/Unsafe.weakCompareAndSwapByte(Ljava/lang/Object;JBB)Z",
|
||||
"jdk/internal/misc/Unsafe.weakCompareAndSwapByteAcquire(Ljava/lang/Object;JBB)Z",
|
||||
"jdk/internal/misc/Unsafe.weakCompareAndSwapByteRelease(Ljava/lang/Object;JBB)Z",
|
||||
"jdk/internal/misc/Unsafe.weakCompareAndSwapByteVolatile(Ljava/lang/Object;JBB)Z",
|
||||
"jdk/internal/misc/Unsafe.weakCompareAndSwapInt(Ljava/lang/Object;JII)Z",
|
||||
"jdk/internal/misc/Unsafe.weakCompareAndSwapIntAcquire(Ljava/lang/Object;JII)Z",
|
||||
"jdk/internal/misc/Unsafe.weakCompareAndSwapIntRelease(Ljava/lang/Object;JII)Z",
|
||||
"jdk/internal/misc/Unsafe.weakCompareAndSwapIntVolatile(Ljava/lang/Object;JII)Z",
|
||||
"jdk/internal/misc/Unsafe.weakCompareAndSwapLong(Ljava/lang/Object;JJJ)Z",
|
||||
"jdk/internal/misc/Unsafe.weakCompareAndSwapLongAcquire(Ljava/lang/Object;JJJ)Z",
|
||||
"jdk/internal/misc/Unsafe.weakCompareAndSwapLongRelease(Ljava/lang/Object;JJJ)Z",
|
||||
"jdk/internal/misc/Unsafe.weakCompareAndSwapLongVolatile(Ljava/lang/Object;JJJ)Z",
|
||||
"jdk/internal/misc/Unsafe.weakCompareAndSwapObject(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z",
|
||||
"jdk/internal/misc/Unsafe.weakCompareAndSwapObjectAcquire(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z",
|
||||
"jdk/internal/misc/Unsafe.weakCompareAndSwapObjectRelease(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z",
|
||||
"jdk/internal/misc/Unsafe.weakCompareAndSwapObjectVolatile(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z",
|
||||
"jdk/internal/misc/Unsafe.weakCompareAndSwapShort(Ljava/lang/Object;JSS)Z",
|
||||
"jdk/internal/misc/Unsafe.weakCompareAndSwapShortAcquire(Ljava/lang/Object;JSS)Z",
|
||||
"jdk/internal/misc/Unsafe.weakCompareAndSwapShortRelease(Ljava/lang/Object;JSS)Z",
|
||||
"jdk/internal/misc/Unsafe.weakCompareAndSwapShortVolatile(Ljava/lang/Object;JSS)Z",
|
||||
"jdk/internal/misc/Unsafe.weakCompareAndSetBytePlain(Ljava/lang/Object;JBB)Z",
|
||||
"jdk/internal/misc/Unsafe.weakCompareAndSetByteAcquire(Ljava/lang/Object;JBB)Z",
|
||||
"jdk/internal/misc/Unsafe.weakCompareAndSetByteRelease(Ljava/lang/Object;JBB)Z",
|
||||
"jdk/internal/misc/Unsafe.weakCompareAndSetByte(Ljava/lang/Object;JBB)Z",
|
||||
"jdk/internal/misc/Unsafe.weakCompareAndSetIntPlain(Ljava/lang/Object;JII)Z",
|
||||
"jdk/internal/misc/Unsafe.weakCompareAndSetIntAcquire(Ljava/lang/Object;JII)Z",
|
||||
"jdk/internal/misc/Unsafe.weakCompareAndSetIntRelease(Ljava/lang/Object;JII)Z",
|
||||
"jdk/internal/misc/Unsafe.weakCompareAndSetInt(Ljava/lang/Object;JII)Z",
|
||||
"jdk/internal/misc/Unsafe.weakCompareAndSetLongPlain(Ljava/lang/Object;JJJ)Z",
|
||||
"jdk/internal/misc/Unsafe.weakCompareAndSetLongAcquire(Ljava/lang/Object;JJJ)Z",
|
||||
"jdk/internal/misc/Unsafe.weakCompareAndSetLongRelease(Ljava/lang/Object;JJJ)Z",
|
||||
"jdk/internal/misc/Unsafe.weakCompareAndSetLong(Ljava/lang/Object;JJJ)Z",
|
||||
"jdk/internal/misc/Unsafe.weakCompareAndSetObjectPlain(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z",
|
||||
"jdk/internal/misc/Unsafe.weakCompareAndSetObjectAcquire(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z",
|
||||
"jdk/internal/misc/Unsafe.weakCompareAndSetObjectRelease(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z",
|
||||
"jdk/internal/misc/Unsafe.weakCompareAndSetObject(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z",
|
||||
"jdk/internal/misc/Unsafe.weakCompareAndSetShortPlain(Ljava/lang/Object;JSS)Z",
|
||||
"jdk/internal/misc/Unsafe.weakCompareAndSetShortAcquire(Ljava/lang/Object;JSS)Z",
|
||||
"jdk/internal/misc/Unsafe.weakCompareAndSetShortRelease(Ljava/lang/Object;JSS)Z",
|
||||
"jdk/internal/misc/Unsafe.weakCompareAndSetShort(Ljava/lang/Object;JSS)Z",
|
||||
"jdk/internal/util/Preconditions.checkIndex(IILjava/util/function/BiFunction;)I",
|
||||
"jdk/jfr/internal/JVM.counterTime()J",
|
||||
"jdk/jfr/internal/JVM.getBufferWriter()Ljava/lang/Object;",
|
||||
|
@ -251,7 +251,13 @@ public class StandardGraphBuilderPlugins {
|
||||
|
||||
for (JavaKind kind : new JavaKind[]{JavaKind.Int, JavaKind.Long, JavaKind.Object}) {
|
||||
Class<?> javaClass = kind == JavaKind.Object ? Object.class : kind.toJavaClass();
|
||||
r.register5("compareAndSwap" + kind.name(), Receiver.class, Object.class, long.class, javaClass, javaClass, new InvocationPlugin() {
|
||||
String casName;
|
||||
if (Java8OrEarlier) {
|
||||
casName = "compareAndSwap";
|
||||
} else {
|
||||
casName = "compareAndSet";
|
||||
}
|
||||
r.register5(casName + kind.name(), Receiver.class, Object.class, long.class, javaClass, javaClass, new InvocationPlugin() {
|
||||
@Override
|
||||
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver unsafe, ValueNode object, ValueNode offset, ValueNode expected, ValueNode x) {
|
||||
// Emits a null-check for the otherwise unused receiver
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2017, 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
|
||||
@ -108,7 +108,7 @@ bool Compiler::is_intrinsic_supported(const methodHandle& method) {
|
||||
}
|
||||
|
||||
switch (id) {
|
||||
case vmIntrinsics::_compareAndSwapLong:
|
||||
case vmIntrinsics::_compareAndSetLong:
|
||||
if (!VM_Version::supports_cx8()) return false;
|
||||
break;
|
||||
case vmIntrinsics::_getAndAddInt:
|
||||
@ -217,8 +217,8 @@ bool Compiler::is_intrinsic_supported(const methodHandle& method) {
|
||||
case vmIntrinsics::_updateDirectByteBufferCRC32C:
|
||||
#endif
|
||||
case vmIntrinsics::_vectorizedMismatch:
|
||||
case vmIntrinsics::_compareAndSwapInt:
|
||||
case vmIntrinsics::_compareAndSwapObject:
|
||||
case vmIntrinsics::_compareAndSetInt:
|
||||
case vmIntrinsics::_compareAndSetObject:
|
||||
case vmIntrinsics::_getCharStringU:
|
||||
case vmIntrinsics::_putCharStringU:
|
||||
#ifdef TRACE_HAVE_INTRINSICS
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2017, 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
|
||||
@ -3500,9 +3500,9 @@ void GraphBuilder::build_graph_for_intrinsic(ciMethod* callee, bool ignore_retur
|
||||
case vmIntrinsics::_putLongVolatile : append_unsafe_put_obj(callee, T_LONG, true); return;
|
||||
case vmIntrinsics::_putFloatVolatile : append_unsafe_put_obj(callee, T_FLOAT, true); return;
|
||||
case vmIntrinsics::_putDoubleVolatile : append_unsafe_put_obj(callee, T_DOUBLE, true); return;
|
||||
case vmIntrinsics::_compareAndSwapLong:
|
||||
case vmIntrinsics::_compareAndSwapInt:
|
||||
case vmIntrinsics::_compareAndSwapObject: append_unsafe_CAS(callee); return;
|
||||
case vmIntrinsics::_compareAndSetLong:
|
||||
case vmIntrinsics::_compareAndSetInt:
|
||||
case vmIntrinsics::_compareAndSetObject: append_unsafe_CAS(callee); return;
|
||||
case vmIntrinsics::_getAndAddInt:
|
||||
case vmIntrinsics::_getAndAddLong : append_unsafe_get_and_set_obj(callee, true); return;
|
||||
case vmIntrinsics::_getAndSetInt :
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2017, 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
|
||||
@ -3212,13 +3212,13 @@ void LIRGenerator::do_Intrinsic(Intrinsic* x) {
|
||||
// java.nio.Buffer.checkIndex
|
||||
case vmIntrinsics::_checkIndex: do_NIOCheckIndex(x); break;
|
||||
|
||||
case vmIntrinsics::_compareAndSwapObject:
|
||||
case vmIntrinsics::_compareAndSetObject:
|
||||
do_CompareAndSwap(x, objectType);
|
||||
break;
|
||||
case vmIntrinsics::_compareAndSwapInt:
|
||||
case vmIntrinsics::_compareAndSetInt:
|
||||
do_CompareAndSwap(x, intType);
|
||||
break;
|
||||
case vmIntrinsics::_compareAndSwapLong:
|
||||
case vmIntrinsics::_compareAndSetLong:
|
||||
do_CompareAndSwap(x, longType);
|
||||
break;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, 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
|
||||
@ -632,25 +632,28 @@ bool vmIntrinsics::is_disabled_by_flags(vmIntrinsics::ID id) {
|
||||
case vmIntrinsics::_loadFence:
|
||||
case vmIntrinsics::_storeFence:
|
||||
case vmIntrinsics::_fullFence:
|
||||
case vmIntrinsics::_compareAndSwapLong:
|
||||
case vmIntrinsics::_weakCompareAndSwapLong:
|
||||
case vmIntrinsics::_weakCompareAndSwapLongAcquire:
|
||||
case vmIntrinsics::_weakCompareAndSwapLongRelease:
|
||||
case vmIntrinsics::_compareAndSwapInt:
|
||||
case vmIntrinsics::_weakCompareAndSwapInt:
|
||||
case vmIntrinsics::_weakCompareAndSwapIntAcquire:
|
||||
case vmIntrinsics::_weakCompareAndSwapIntRelease:
|
||||
case vmIntrinsics::_compareAndSwapObject:
|
||||
case vmIntrinsics::_weakCompareAndSwapObject:
|
||||
case vmIntrinsics::_weakCompareAndSwapObjectAcquire:
|
||||
case vmIntrinsics::_weakCompareAndSwapObjectRelease:
|
||||
case vmIntrinsics::_compareAndExchangeIntVolatile:
|
||||
case vmIntrinsics::_compareAndSetLong:
|
||||
case vmIntrinsics::_weakCompareAndSetLong:
|
||||
case vmIntrinsics::_weakCompareAndSetLongPlain:
|
||||
case vmIntrinsics::_weakCompareAndSetLongAcquire:
|
||||
case vmIntrinsics::_weakCompareAndSetLongRelease:
|
||||
case vmIntrinsics::_compareAndSetInt:
|
||||
case vmIntrinsics::_weakCompareAndSetInt:
|
||||
case vmIntrinsics::_weakCompareAndSetIntPlain:
|
||||
case vmIntrinsics::_weakCompareAndSetIntAcquire:
|
||||
case vmIntrinsics::_weakCompareAndSetIntRelease:
|
||||
case vmIntrinsics::_compareAndSetObject:
|
||||
case vmIntrinsics::_weakCompareAndSetObject:
|
||||
case vmIntrinsics::_weakCompareAndSetObjectPlain:
|
||||
case vmIntrinsics::_weakCompareAndSetObjectAcquire:
|
||||
case vmIntrinsics::_weakCompareAndSetObjectRelease:
|
||||
case vmIntrinsics::_compareAndExchangeInt:
|
||||
case vmIntrinsics::_compareAndExchangeIntAcquire:
|
||||
case vmIntrinsics::_compareAndExchangeIntRelease:
|
||||
case vmIntrinsics::_compareAndExchangeLongVolatile:
|
||||
case vmIntrinsics::_compareAndExchangeLong:
|
||||
case vmIntrinsics::_compareAndExchangeLongAcquire:
|
||||
case vmIntrinsics::_compareAndExchangeLongRelease:
|
||||
case vmIntrinsics::_compareAndExchangeObjectVolatile:
|
||||
case vmIntrinsics::_compareAndExchangeObject:
|
||||
case vmIntrinsics::_compareAndExchangeObjectAcquire:
|
||||
case vmIntrinsics::_compareAndExchangeObjectRelease:
|
||||
if (!InlineUnsafeOps) return true;
|
||||
|
@ -1244,100 +1244,100 @@
|
||||
do_intrinsic(_putIntUnaligned, jdk_internal_misc_Unsafe, putIntUnaligned_name, putInt_signature, F_R) \
|
||||
do_intrinsic(_putLongUnaligned, jdk_internal_misc_Unsafe, putLongUnaligned_name, putLong_signature, F_R) \
|
||||
\
|
||||
do_signature(compareAndSwapObject_signature, "(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z") \
|
||||
do_signature(compareAndSetObject_signature, "(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z") \
|
||||
do_signature(compareAndExchangeObject_signature, "(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;") \
|
||||
do_signature(compareAndSwapLong_signature, "(Ljava/lang/Object;JJJ)Z") \
|
||||
do_signature(compareAndSetLong_signature, "(Ljava/lang/Object;JJJ)Z") \
|
||||
do_signature(compareAndExchangeLong_signature, "(Ljava/lang/Object;JJJ)J") \
|
||||
do_signature(compareAndSwapInt_signature, "(Ljava/lang/Object;JII)Z") \
|
||||
do_signature(compareAndSetInt_signature, "(Ljava/lang/Object;JII)Z") \
|
||||
do_signature(compareAndExchangeInt_signature, "(Ljava/lang/Object;JII)I") \
|
||||
do_signature(compareAndSwapByte_signature, "(Ljava/lang/Object;JBB)Z") \
|
||||
do_signature(compareAndSetByte_signature, "(Ljava/lang/Object;JBB)Z") \
|
||||
do_signature(compareAndExchangeByte_signature, "(Ljava/lang/Object;JBB)B") \
|
||||
do_signature(compareAndSwapShort_signature, "(Ljava/lang/Object;JSS)Z") \
|
||||
do_signature(compareAndSetShort_signature, "(Ljava/lang/Object;JSS)Z") \
|
||||
do_signature(compareAndExchangeShort_signature, "(Ljava/lang/Object;JSS)S") \
|
||||
\
|
||||
do_name(compareAndSwapObject_name, "compareAndSwapObject") \
|
||||
do_name(compareAndExchangeObjectVolatile_name, "compareAndExchangeObjectVolatile") \
|
||||
do_name(compareAndSetObject_name, "compareAndSetObject") \
|
||||
do_name(compareAndExchangeObject_name, "compareAndExchangeObject") \
|
||||
do_name(compareAndExchangeObjectAcquire_name, "compareAndExchangeObjectAcquire") \
|
||||
do_name(compareAndExchangeObjectRelease_name, "compareAndExchangeObjectRelease") \
|
||||
do_name(compareAndSwapLong_name, "compareAndSwapLong") \
|
||||
do_name(compareAndExchangeLongVolatile_name, "compareAndExchangeLongVolatile") \
|
||||
do_name(compareAndSetLong_name, "compareAndSetLong") \
|
||||
do_name(compareAndExchangeLong_name, "compareAndExchangeLong") \
|
||||
do_name(compareAndExchangeLongAcquire_name, "compareAndExchangeLongAcquire") \
|
||||
do_name(compareAndExchangeLongRelease_name, "compareAndExchangeLongRelease") \
|
||||
do_name(compareAndSwapInt_name, "compareAndSwapInt") \
|
||||
do_name(compareAndExchangeIntVolatile_name, "compareAndExchangeIntVolatile") \
|
||||
do_name(compareAndSetInt_name, "compareAndSetInt") \
|
||||
do_name(compareAndExchangeInt_name, "compareAndExchangeInt") \
|
||||
do_name(compareAndExchangeIntAcquire_name, "compareAndExchangeIntAcquire") \
|
||||
do_name(compareAndExchangeIntRelease_name, "compareAndExchangeIntRelease") \
|
||||
do_name(compareAndSwapByte_name, "compareAndSwapByte") \
|
||||
do_name(compareAndExchangeByteVolatile_name, "compareAndExchangeByteVolatile") \
|
||||
do_name(compareAndSetByte_name, "compareAndSetByte") \
|
||||
do_name(compareAndExchangeByte_name, "compareAndExchangeByte") \
|
||||
do_name(compareAndExchangeByteAcquire_name, "compareAndExchangeByteAcquire") \
|
||||
do_name(compareAndExchangeByteRelease_name, "compareAndExchangeByteRelease") \
|
||||
do_name(compareAndSwapShort_name, "compareAndSwapShort") \
|
||||
do_name(compareAndExchangeShortVolatile_name, "compareAndExchangeShortVolatile") \
|
||||
do_name(compareAndSetShort_name, "compareAndSetShort") \
|
||||
do_name(compareAndExchangeShort_name, "compareAndExchangeShort") \
|
||||
do_name(compareAndExchangeShortAcquire_name, "compareAndExchangeShortAcquire") \
|
||||
do_name(compareAndExchangeShortRelease_name, "compareAndExchangeShortRelease") \
|
||||
\
|
||||
do_name(weakCompareAndSwapObject_name, "weakCompareAndSwapObject") \
|
||||
do_name(weakCompareAndSwapObjectAcquire_name, "weakCompareAndSwapObjectAcquire") \
|
||||
do_name(weakCompareAndSwapObjectRelease_name, "weakCompareAndSwapObjectRelease") \
|
||||
do_name(weakCompareAndSwapObjectVolatile_name, "weakCompareAndSwapObjectVolatile") \
|
||||
do_name(weakCompareAndSwapLong_name, "weakCompareAndSwapLong") \
|
||||
do_name(weakCompareAndSwapLongAcquire_name, "weakCompareAndSwapLongAcquire") \
|
||||
do_name(weakCompareAndSwapLongRelease_name, "weakCompareAndSwapLongRelease") \
|
||||
do_name(weakCompareAndSwapLongVolatile_name, "weakCompareAndSwapLongVolatile") \
|
||||
do_name(weakCompareAndSwapInt_name, "weakCompareAndSwapInt") \
|
||||
do_name(weakCompareAndSwapIntAcquire_name, "weakCompareAndSwapIntAcquire") \
|
||||
do_name(weakCompareAndSwapIntRelease_name, "weakCompareAndSwapIntRelease") \
|
||||
do_name(weakCompareAndSwapIntVolatile_name, "weakCompareAndSwapIntVolatile") \
|
||||
do_name(weakCompareAndSwapByte_name, "weakCompareAndSwapByte") \
|
||||
do_name(weakCompareAndSwapByteAcquire_name, "weakCompareAndSwapByteAcquire") \
|
||||
do_name(weakCompareAndSwapByteRelease_name, "weakCompareAndSwapByteRelease") \
|
||||
do_name(weakCompareAndSwapByteVolatile_name, "weakCompareAndSwapByteVolatile") \
|
||||
do_name(weakCompareAndSwapShort_name, "weakCompareAndSwapShort") \
|
||||
do_name(weakCompareAndSwapShortAcquire_name, "weakCompareAndSwapShortAcquire") \
|
||||
do_name(weakCompareAndSwapShortRelease_name, "weakCompareAndSwapShortRelease") \
|
||||
do_name(weakCompareAndSwapShortVolatile_name, "weakCompareAndSwapShortVolatile") \
|
||||
do_name(weakCompareAndSetObjectPlain_name, "weakCompareAndSetObjectPlain") \
|
||||
do_name(weakCompareAndSetObjectAcquire_name, "weakCompareAndSetObjectAcquire") \
|
||||
do_name(weakCompareAndSetObjectRelease_name, "weakCompareAndSetObjectRelease") \
|
||||
do_name(weakCompareAndSetObject_name, "weakCompareAndSetObject") \
|
||||
do_name(weakCompareAndSetLongPlain_name, "weakCompareAndSetLongPlain") \
|
||||
do_name(weakCompareAndSetLongAcquire_name, "weakCompareAndSetLongAcquire") \
|
||||
do_name(weakCompareAndSetLongRelease_name, "weakCompareAndSetLongRelease") \
|
||||
do_name(weakCompareAndSetLong_name, "weakCompareAndSetLong") \
|
||||
do_name(weakCompareAndSetIntPlain_name, "weakCompareAndSetIntPlain") \
|
||||
do_name(weakCompareAndSetIntAcquire_name, "weakCompareAndSetIntAcquire") \
|
||||
do_name(weakCompareAndSetIntRelease_name, "weakCompareAndSetIntRelease") \
|
||||
do_name(weakCompareAndSetInt_name, "weakCompareAndSetInt") \
|
||||
do_name(weakCompareAndSetBytePlain_name, "weakCompareAndSetBytePlain") \
|
||||
do_name(weakCompareAndSetByteAcquire_name, "weakCompareAndSetByteAcquire") \
|
||||
do_name(weakCompareAndSetByteRelease_name, "weakCompareAndSetByteRelease") \
|
||||
do_name(weakCompareAndSetByte_name, "weakCompareAndSetByte") \
|
||||
do_name(weakCompareAndSetShortPlain_name, "weakCompareAndSetShortPlain") \
|
||||
do_name(weakCompareAndSetShortAcquire_name, "weakCompareAndSetShortAcquire") \
|
||||
do_name(weakCompareAndSetShortRelease_name, "weakCompareAndSetShortRelease") \
|
||||
do_name(weakCompareAndSetShort_name, "weakCompareAndSetShort") \
|
||||
\
|
||||
do_intrinsic(_compareAndSwapObject, jdk_internal_misc_Unsafe, compareAndSwapObject_name, compareAndSwapObject_signature, F_RN) \
|
||||
do_intrinsic(_compareAndExchangeObjectVolatile, jdk_internal_misc_Unsafe, compareAndExchangeObjectVolatile_name, compareAndExchangeObject_signature, F_RN) \
|
||||
do_intrinsic(_compareAndSetObject, jdk_internal_misc_Unsafe, compareAndSetObject_name, compareAndSetObject_signature, F_RN) \
|
||||
do_intrinsic(_compareAndExchangeObject, jdk_internal_misc_Unsafe, compareAndExchangeObject_name, compareAndExchangeObject_signature, F_RN) \
|
||||
do_intrinsic(_compareAndExchangeObjectAcquire, jdk_internal_misc_Unsafe, compareAndExchangeObjectAcquire_name, compareAndExchangeObject_signature, F_R) \
|
||||
do_intrinsic(_compareAndExchangeObjectRelease, jdk_internal_misc_Unsafe, compareAndExchangeObjectRelease_name, compareAndExchangeObject_signature, F_R) \
|
||||
do_intrinsic(_compareAndSwapLong, jdk_internal_misc_Unsafe, compareAndSwapLong_name, compareAndSwapLong_signature, F_RN) \
|
||||
do_intrinsic(_compareAndExchangeLongVolatile, jdk_internal_misc_Unsafe, compareAndExchangeLongVolatile_name, compareAndExchangeLong_signature, F_RN) \
|
||||
do_intrinsic(_compareAndSetLong, jdk_internal_misc_Unsafe, compareAndSetLong_name, compareAndSetLong_signature, F_RN) \
|
||||
do_intrinsic(_compareAndExchangeLong, jdk_internal_misc_Unsafe, compareAndExchangeLong_name, compareAndExchangeLong_signature, F_RN) \
|
||||
do_intrinsic(_compareAndExchangeLongAcquire, jdk_internal_misc_Unsafe, compareAndExchangeLongAcquire_name, compareAndExchangeLong_signature, F_R) \
|
||||
do_intrinsic(_compareAndExchangeLongRelease, jdk_internal_misc_Unsafe, compareAndExchangeLongRelease_name, compareAndExchangeLong_signature, F_R) \
|
||||
do_intrinsic(_compareAndSwapInt, jdk_internal_misc_Unsafe, compareAndSwapInt_name, compareAndSwapInt_signature, F_RN) \
|
||||
do_intrinsic(_compareAndExchangeIntVolatile, jdk_internal_misc_Unsafe, compareAndExchangeIntVolatile_name, compareAndExchangeInt_signature, F_RN) \
|
||||
do_intrinsic(_compareAndSetInt, jdk_internal_misc_Unsafe, compareAndSetInt_name, compareAndSetInt_signature, F_RN) \
|
||||
do_intrinsic(_compareAndExchangeInt, jdk_internal_misc_Unsafe, compareAndExchangeInt_name, compareAndExchangeInt_signature, F_RN) \
|
||||
do_intrinsic(_compareAndExchangeIntAcquire, jdk_internal_misc_Unsafe, compareAndExchangeIntAcquire_name, compareAndExchangeInt_signature, F_R) \
|
||||
do_intrinsic(_compareAndExchangeIntRelease, jdk_internal_misc_Unsafe, compareAndExchangeIntRelease_name, compareAndExchangeInt_signature, F_R) \
|
||||
do_intrinsic(_compareAndSwapByte, jdk_internal_misc_Unsafe, compareAndSwapByte_name, compareAndSwapByte_signature, F_R) \
|
||||
do_intrinsic(_compareAndExchangeByteVolatile, jdk_internal_misc_Unsafe, compareAndExchangeByteVolatile_name, compareAndExchangeByte_signature, F_R) \
|
||||
do_intrinsic(_compareAndSetByte, jdk_internal_misc_Unsafe, compareAndSetByte_name, compareAndSetByte_signature, F_R) \
|
||||
do_intrinsic(_compareAndExchangeByte, jdk_internal_misc_Unsafe, compareAndExchangeByte_name, compareAndExchangeByte_signature, F_R) \
|
||||
do_intrinsic(_compareAndExchangeByteAcquire, jdk_internal_misc_Unsafe, compareAndExchangeByteAcquire_name, compareAndExchangeByte_signature, F_R) \
|
||||
do_intrinsic(_compareAndExchangeByteRelease, jdk_internal_misc_Unsafe, compareAndExchangeByteRelease_name, compareAndExchangeByte_signature, F_R) \
|
||||
do_intrinsic(_compareAndSwapShort, jdk_internal_misc_Unsafe, compareAndSwapShort_name, compareAndSwapShort_signature, F_R) \
|
||||
do_intrinsic(_compareAndExchangeShortVolatile, jdk_internal_misc_Unsafe, compareAndExchangeShortVolatile_name, compareAndExchangeShort_signature, F_R) \
|
||||
do_intrinsic(_compareAndSetShort, jdk_internal_misc_Unsafe, compareAndSetShort_name, compareAndSetShort_signature, F_R) \
|
||||
do_intrinsic(_compareAndExchangeShort, jdk_internal_misc_Unsafe, compareAndExchangeShort_name, compareAndExchangeShort_signature, F_R) \
|
||||
do_intrinsic(_compareAndExchangeShortAcquire, jdk_internal_misc_Unsafe, compareAndExchangeShortAcquire_name, compareAndExchangeShort_signature, F_R) \
|
||||
do_intrinsic(_compareAndExchangeShortRelease, jdk_internal_misc_Unsafe, compareAndExchangeShortRelease_name, compareAndExchangeShort_signature, F_R) \
|
||||
\
|
||||
do_intrinsic(_weakCompareAndSwapObject, jdk_internal_misc_Unsafe, weakCompareAndSwapObject_name, compareAndSwapObject_signature, F_R) \
|
||||
do_intrinsic(_weakCompareAndSwapObjectAcquire, jdk_internal_misc_Unsafe, weakCompareAndSwapObjectAcquire_name, compareAndSwapObject_signature, F_R) \
|
||||
do_intrinsic(_weakCompareAndSwapObjectRelease, jdk_internal_misc_Unsafe, weakCompareAndSwapObjectRelease_name, compareAndSwapObject_signature, F_R) \
|
||||
do_intrinsic(_weakCompareAndSwapObjectVolatile, jdk_internal_misc_Unsafe, weakCompareAndSwapObjectVolatile_name, compareAndSwapObject_signature, F_R) \
|
||||
do_intrinsic(_weakCompareAndSwapLong, jdk_internal_misc_Unsafe, weakCompareAndSwapLong_name, compareAndSwapLong_signature, F_R) \
|
||||
do_intrinsic(_weakCompareAndSwapLongAcquire, jdk_internal_misc_Unsafe, weakCompareAndSwapLongAcquire_name, compareAndSwapLong_signature, F_R) \
|
||||
do_intrinsic(_weakCompareAndSwapLongRelease, jdk_internal_misc_Unsafe, weakCompareAndSwapLongRelease_name, compareAndSwapLong_signature, F_R) \
|
||||
do_intrinsic(_weakCompareAndSwapLongVolatile, jdk_internal_misc_Unsafe, weakCompareAndSwapLongVolatile_name, compareAndSwapLong_signature, F_R) \
|
||||
do_intrinsic(_weakCompareAndSwapInt, jdk_internal_misc_Unsafe, weakCompareAndSwapInt_name, compareAndSwapInt_signature, F_R) \
|
||||
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(_weakCompareAndSwapIntVolatile, jdk_internal_misc_Unsafe, weakCompareAndSwapIntVolatile_name, compareAndSwapInt_signature, F_R) \
|
||||
do_intrinsic(_weakCompareAndSwapByte, jdk_internal_misc_Unsafe, weakCompareAndSwapByte_name, compareAndSwapByte_signature, F_R) \
|
||||
do_intrinsic(_weakCompareAndSwapByteAcquire, jdk_internal_misc_Unsafe, weakCompareAndSwapByteAcquire_name, compareAndSwapByte_signature, F_R) \
|
||||
do_intrinsic(_weakCompareAndSwapByteRelease, jdk_internal_misc_Unsafe, weakCompareAndSwapByteRelease_name, compareAndSwapByte_signature, F_R) \
|
||||
do_intrinsic(_weakCompareAndSwapByteVolatile, jdk_internal_misc_Unsafe, weakCompareAndSwapByteVolatile_name, compareAndSwapByte_signature, F_R) \
|
||||
do_intrinsic(_weakCompareAndSwapShort, jdk_internal_misc_Unsafe, weakCompareAndSwapShort_name, compareAndSwapShort_signature, F_R) \
|
||||
do_intrinsic(_weakCompareAndSwapShortAcquire, jdk_internal_misc_Unsafe, weakCompareAndSwapShortAcquire_name, compareAndSwapShort_signature, F_R) \
|
||||
do_intrinsic(_weakCompareAndSwapShortRelease, jdk_internal_misc_Unsafe, weakCompareAndSwapShortRelease_name, compareAndSwapShort_signature, F_R) \
|
||||
do_intrinsic(_weakCompareAndSwapShortVolatile, jdk_internal_misc_Unsafe, weakCompareAndSwapShortVolatile_name, compareAndSwapShort_signature, F_R) \
|
||||
do_intrinsic(_weakCompareAndSetObjectPlain, jdk_internal_misc_Unsafe, weakCompareAndSetObjectPlain_name, compareAndSetObject_signature, F_R) \
|
||||
do_intrinsic(_weakCompareAndSetObjectAcquire, jdk_internal_misc_Unsafe, weakCompareAndSetObjectAcquire_name, compareAndSetObject_signature, F_R) \
|
||||
do_intrinsic(_weakCompareAndSetObjectRelease, jdk_internal_misc_Unsafe, weakCompareAndSetObjectRelease_name, compareAndSetObject_signature, F_R) \
|
||||
do_intrinsic(_weakCompareAndSetObject, jdk_internal_misc_Unsafe, weakCompareAndSetObject_name, compareAndSetObject_signature, F_R) \
|
||||
do_intrinsic(_weakCompareAndSetLongPlain, jdk_internal_misc_Unsafe, weakCompareAndSetLongPlain_name, compareAndSetLong_signature, F_R) \
|
||||
do_intrinsic(_weakCompareAndSetLongAcquire, jdk_internal_misc_Unsafe, weakCompareAndSetLongAcquire_name, compareAndSetLong_signature, F_R) \
|
||||
do_intrinsic(_weakCompareAndSetLongRelease, jdk_internal_misc_Unsafe, weakCompareAndSetLongRelease_name, compareAndSetLong_signature, F_R) \
|
||||
do_intrinsic(_weakCompareAndSetLong, jdk_internal_misc_Unsafe, weakCompareAndSetLong_name, compareAndSetLong_signature, F_R) \
|
||||
do_intrinsic(_weakCompareAndSetIntPlain, jdk_internal_misc_Unsafe, weakCompareAndSetIntPlain_name, compareAndSetInt_signature, F_R) \
|
||||
do_intrinsic(_weakCompareAndSetIntAcquire, jdk_internal_misc_Unsafe, weakCompareAndSetIntAcquire_name, compareAndSetInt_signature, F_R) \
|
||||
do_intrinsic(_weakCompareAndSetIntRelease, jdk_internal_misc_Unsafe, weakCompareAndSetIntRelease_name, compareAndSetInt_signature, F_R) \
|
||||
do_intrinsic(_weakCompareAndSetInt, jdk_internal_misc_Unsafe, weakCompareAndSetInt_name, compareAndSetInt_signature, F_R) \
|
||||
do_intrinsic(_weakCompareAndSetBytePlain, jdk_internal_misc_Unsafe, weakCompareAndSetBytePlain_name, compareAndSetByte_signature, F_R) \
|
||||
do_intrinsic(_weakCompareAndSetByteAcquire, jdk_internal_misc_Unsafe, weakCompareAndSetByteAcquire_name, compareAndSetByte_signature, F_R) \
|
||||
do_intrinsic(_weakCompareAndSetByteRelease, jdk_internal_misc_Unsafe, weakCompareAndSetByteRelease_name, compareAndSetByte_signature, F_R) \
|
||||
do_intrinsic(_weakCompareAndSetByte, jdk_internal_misc_Unsafe, weakCompareAndSetByte_name, compareAndSetByte_signature, F_R) \
|
||||
do_intrinsic(_weakCompareAndSetShortPlain, jdk_internal_misc_Unsafe, weakCompareAndSetShortPlain_name, compareAndSetShort_signature, F_R) \
|
||||
do_intrinsic(_weakCompareAndSetShortAcquire, jdk_internal_misc_Unsafe, weakCompareAndSetShortAcquire_name, compareAndSetShort_signature, F_R) \
|
||||
do_intrinsic(_weakCompareAndSetShortRelease, jdk_internal_misc_Unsafe, weakCompareAndSetShortRelease_name, compareAndSetShort_signature, F_R) \
|
||||
do_intrinsic(_weakCompareAndSetShort, jdk_internal_misc_Unsafe, weakCompareAndSetShort_name, compareAndSetShort_signature, F_R) \
|
||||
\
|
||||
do_intrinsic(_getAndAddInt, jdk_internal_misc_Unsafe, getAndAddInt_name, getAndAddInt_signature, F_R) \
|
||||
do_name( getAndAddInt_name, "getAndAddInt") \
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2017, 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
|
||||
@ -244,8 +244,8 @@ bool C2Compiler::is_intrinsic_supported(const methodHandle& method, bool is_virt
|
||||
if (!Matcher::match_rule_supported(Op_ReverseBytesL)) return false;
|
||||
break;
|
||||
|
||||
/* CompareAndSwap, Object: */
|
||||
case vmIntrinsics::_compareAndSwapObject:
|
||||
/* CompareAndSet, Object: */
|
||||
case vmIntrinsics::_compareAndSetObject:
|
||||
#ifdef _LP64
|
||||
if ( UseCompressedOops && !Matcher::match_rule_supported(Op_CompareAndSwapN)) return false;
|
||||
if (!UseCompressedOops && !Matcher::match_rule_supported(Op_CompareAndSwapP)) return false;
|
||||
@ -253,10 +253,10 @@ bool C2Compiler::is_intrinsic_supported(const methodHandle& method, bool is_virt
|
||||
if (!Matcher::match_rule_supported(Op_CompareAndSwapP)) return false;
|
||||
#endif
|
||||
break;
|
||||
case vmIntrinsics::_weakCompareAndSwapObject:
|
||||
case vmIntrinsics::_weakCompareAndSwapObjectAcquire:
|
||||
case vmIntrinsics::_weakCompareAndSwapObjectRelease:
|
||||
case vmIntrinsics::_weakCompareAndSwapObjectVolatile:
|
||||
case vmIntrinsics::_weakCompareAndSetObjectPlain:
|
||||
case vmIntrinsics::_weakCompareAndSetObjectAcquire:
|
||||
case vmIntrinsics::_weakCompareAndSetObjectRelease:
|
||||
case vmIntrinsics::_weakCompareAndSetObject:
|
||||
#ifdef _LP64
|
||||
if ( UseCompressedOops && !Matcher::match_rule_supported(Op_WeakCompareAndSwapN)) return false;
|
||||
if (!UseCompressedOops && !Matcher::match_rule_supported(Op_WeakCompareAndSwapP)) return false;
|
||||
@ -264,52 +264,52 @@ bool C2Compiler::is_intrinsic_supported(const methodHandle& method, bool is_virt
|
||||
if (!Matcher::match_rule_supported(Op_WeakCompareAndSwapP)) return false;
|
||||
#endif
|
||||
break;
|
||||
/* CompareAndSwap, Long: */
|
||||
case vmIntrinsics::_compareAndSwapLong:
|
||||
/* CompareAndSet, Long: */
|
||||
case vmIntrinsics::_compareAndSetLong:
|
||||
if (!Matcher::match_rule_supported(Op_CompareAndSwapL)) return false;
|
||||
break;
|
||||
case vmIntrinsics::_weakCompareAndSwapLong:
|
||||
case vmIntrinsics::_weakCompareAndSwapLongAcquire:
|
||||
case vmIntrinsics::_weakCompareAndSwapLongRelease:
|
||||
case vmIntrinsics::_weakCompareAndSwapLongVolatile:
|
||||
case vmIntrinsics::_weakCompareAndSetLongPlain:
|
||||
case vmIntrinsics::_weakCompareAndSetLongAcquire:
|
||||
case vmIntrinsics::_weakCompareAndSetLongRelease:
|
||||
case vmIntrinsics::_weakCompareAndSetLong:
|
||||
if (!Matcher::match_rule_supported(Op_WeakCompareAndSwapL)) return false;
|
||||
break;
|
||||
|
||||
/* CompareAndSwap, Int: */
|
||||
case vmIntrinsics::_compareAndSwapInt:
|
||||
/* CompareAndSet, Int: */
|
||||
case vmIntrinsics::_compareAndSetInt:
|
||||
if (!Matcher::match_rule_supported(Op_CompareAndSwapI)) return false;
|
||||
break;
|
||||
case vmIntrinsics::_weakCompareAndSwapInt:
|
||||
case vmIntrinsics::_weakCompareAndSwapIntAcquire:
|
||||
case vmIntrinsics::_weakCompareAndSwapIntRelease:
|
||||
case vmIntrinsics::_weakCompareAndSwapIntVolatile:
|
||||
case vmIntrinsics::_weakCompareAndSetIntPlain:
|
||||
case vmIntrinsics::_weakCompareAndSetIntAcquire:
|
||||
case vmIntrinsics::_weakCompareAndSetIntRelease:
|
||||
case vmIntrinsics::_weakCompareAndSetInt:
|
||||
if (!Matcher::match_rule_supported(Op_WeakCompareAndSwapL)) return false;
|
||||
break;
|
||||
|
||||
/* CompareAndSwap, Byte: */
|
||||
case vmIntrinsics::_compareAndSwapByte:
|
||||
/* CompareAndSet, Byte: */
|
||||
case vmIntrinsics::_compareAndSetByte:
|
||||
if (!Matcher::match_rule_supported(Op_CompareAndSwapB)) return false;
|
||||
break;
|
||||
case vmIntrinsics::_weakCompareAndSwapByte:
|
||||
case vmIntrinsics::_weakCompareAndSwapByteAcquire:
|
||||
case vmIntrinsics::_weakCompareAndSwapByteRelease:
|
||||
case vmIntrinsics::_weakCompareAndSwapByteVolatile:
|
||||
case vmIntrinsics::_weakCompareAndSetBytePlain:
|
||||
case vmIntrinsics::_weakCompareAndSetByteAcquire:
|
||||
case vmIntrinsics::_weakCompareAndSetByteRelease:
|
||||
case vmIntrinsics::_weakCompareAndSetByte:
|
||||
if (!Matcher::match_rule_supported(Op_WeakCompareAndSwapB)) return false;
|
||||
break;
|
||||
|
||||
/* CompareAndSwap, Short: */
|
||||
case vmIntrinsics::_compareAndSwapShort:
|
||||
/* CompareAndSet, Short: */
|
||||
case vmIntrinsics::_compareAndSetShort:
|
||||
if (!Matcher::match_rule_supported(Op_CompareAndSwapS)) return false;
|
||||
break;
|
||||
case vmIntrinsics::_weakCompareAndSwapShort:
|
||||
case vmIntrinsics::_weakCompareAndSwapShortAcquire:
|
||||
case vmIntrinsics::_weakCompareAndSwapShortRelease:
|
||||
case vmIntrinsics::_weakCompareAndSwapShortVolatile:
|
||||
case vmIntrinsics::_weakCompareAndSetShortPlain:
|
||||
case vmIntrinsics::_weakCompareAndSetShortAcquire:
|
||||
case vmIntrinsics::_weakCompareAndSetShortRelease:
|
||||
case vmIntrinsics::_weakCompareAndSetShort:
|
||||
if (!Matcher::match_rule_supported(Op_WeakCompareAndSwapS)) return false;
|
||||
break;
|
||||
|
||||
/* CompareAndExchange, Object: */
|
||||
case vmIntrinsics::_compareAndExchangeObjectVolatile:
|
||||
case vmIntrinsics::_compareAndExchangeObject:
|
||||
case vmIntrinsics::_compareAndExchangeObjectAcquire:
|
||||
case vmIntrinsics::_compareAndExchangeObjectRelease:
|
||||
#ifdef _LP64
|
||||
@ -321,28 +321,28 @@ bool C2Compiler::is_intrinsic_supported(const methodHandle& method, bool is_virt
|
||||
break;
|
||||
|
||||
/* CompareAndExchange, Long: */
|
||||
case vmIntrinsics::_compareAndExchangeLongVolatile:
|
||||
case vmIntrinsics::_compareAndExchangeLong:
|
||||
case vmIntrinsics::_compareAndExchangeLongAcquire:
|
||||
case vmIntrinsics::_compareAndExchangeLongRelease:
|
||||
if (!Matcher::match_rule_supported(Op_CompareAndExchangeL)) return false;
|
||||
break;
|
||||
|
||||
/* CompareAndExchange, Int: */
|
||||
case vmIntrinsics::_compareAndExchangeIntVolatile:
|
||||
case vmIntrinsics::_compareAndExchangeInt:
|
||||
case vmIntrinsics::_compareAndExchangeIntAcquire:
|
||||
case vmIntrinsics::_compareAndExchangeIntRelease:
|
||||
if (!Matcher::match_rule_supported(Op_CompareAndExchangeI)) return false;
|
||||
break;
|
||||
|
||||
/* CompareAndExchange, Byte: */
|
||||
case vmIntrinsics::_compareAndExchangeByteVolatile:
|
||||
case vmIntrinsics::_compareAndExchangeByte:
|
||||
case vmIntrinsics::_compareAndExchangeByteAcquire:
|
||||
case vmIntrinsics::_compareAndExchangeByteRelease:
|
||||
if (!Matcher::match_rule_supported(Op_CompareAndExchangeB)) return false;
|
||||
break;
|
||||
|
||||
/* CompareAndExchange, Short: */
|
||||
case vmIntrinsics::_compareAndExchangeShortVolatile:
|
||||
case vmIntrinsics::_compareAndExchangeShort:
|
||||
case vmIntrinsics::_compareAndExchangeShortAcquire:
|
||||
case vmIntrinsics::_compareAndExchangeShortRelease:
|
||||
if (!Matcher::match_rule_supported(Op_CompareAndExchangeS)) return false;
|
||||
|
@ -649,46 +649,46 @@ bool LibraryCallKit::try_to_inline(int predicate) {
|
||||
case vmIntrinsics::_putFloatOpaque: return inline_unsafe_access( is_store, T_FLOAT, Opaque, false);
|
||||
case vmIntrinsics::_putDoubleOpaque: return inline_unsafe_access( is_store, T_DOUBLE, Opaque, false);
|
||||
|
||||
case vmIntrinsics::_compareAndSwapObject: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap, Volatile);
|
||||
case vmIntrinsics::_compareAndSwapByte: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap, Volatile);
|
||||
case vmIntrinsics::_compareAndSwapShort: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap, Volatile);
|
||||
case vmIntrinsics::_compareAndSwapInt: return inline_unsafe_load_store(T_INT, LS_cmp_swap, Volatile);
|
||||
case vmIntrinsics::_compareAndSwapLong: return inline_unsafe_load_store(T_LONG, LS_cmp_swap, Volatile);
|
||||
case vmIntrinsics::_compareAndSetObject: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap, Volatile);
|
||||
case vmIntrinsics::_compareAndSetByte: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap, Volatile);
|
||||
case vmIntrinsics::_compareAndSetShort: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap, Volatile);
|
||||
case vmIntrinsics::_compareAndSetInt: return inline_unsafe_load_store(T_INT, LS_cmp_swap, Volatile);
|
||||
case vmIntrinsics::_compareAndSetLong: return inline_unsafe_load_store(T_LONG, LS_cmp_swap, Volatile);
|
||||
|
||||
case vmIntrinsics::_weakCompareAndSwapObject: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Relaxed);
|
||||
case vmIntrinsics::_weakCompareAndSwapObjectAcquire: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Acquire);
|
||||
case vmIntrinsics::_weakCompareAndSwapObjectRelease: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Release);
|
||||
case vmIntrinsics::_weakCompareAndSwapObjectVolatile: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Volatile);
|
||||
case vmIntrinsics::_weakCompareAndSwapByte: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap_weak, Relaxed);
|
||||
case vmIntrinsics::_weakCompareAndSwapByteAcquire: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap_weak, Acquire);
|
||||
case vmIntrinsics::_weakCompareAndSwapByteRelease: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap_weak, Release);
|
||||
case vmIntrinsics::_weakCompareAndSwapByteVolatile: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap_weak, Volatile);
|
||||
case vmIntrinsics::_weakCompareAndSwapShort: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap_weak, Relaxed);
|
||||
case vmIntrinsics::_weakCompareAndSwapShortAcquire: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap_weak, Acquire);
|
||||
case vmIntrinsics::_weakCompareAndSwapShortRelease: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap_weak, Release);
|
||||
case vmIntrinsics::_weakCompareAndSwapShortVolatile: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap_weak, Volatile);
|
||||
case vmIntrinsics::_weakCompareAndSwapInt: return inline_unsafe_load_store(T_INT, LS_cmp_swap_weak, Relaxed);
|
||||
case vmIntrinsics::_weakCompareAndSwapIntAcquire: return inline_unsafe_load_store(T_INT, LS_cmp_swap_weak, Acquire);
|
||||
case vmIntrinsics::_weakCompareAndSwapIntRelease: return inline_unsafe_load_store(T_INT, LS_cmp_swap_weak, Release);
|
||||
case vmIntrinsics::_weakCompareAndSwapIntVolatile: return inline_unsafe_load_store(T_INT, LS_cmp_swap_weak, Volatile);
|
||||
case vmIntrinsics::_weakCompareAndSwapLong: return inline_unsafe_load_store(T_LONG, LS_cmp_swap_weak, Relaxed);
|
||||
case vmIntrinsics::_weakCompareAndSwapLongAcquire: return inline_unsafe_load_store(T_LONG, LS_cmp_swap_weak, Acquire);
|
||||
case vmIntrinsics::_weakCompareAndSwapLongRelease: return inline_unsafe_load_store(T_LONG, LS_cmp_swap_weak, Release);
|
||||
case vmIntrinsics::_weakCompareAndSwapLongVolatile: return inline_unsafe_load_store(T_LONG, LS_cmp_swap_weak, Volatile);
|
||||
case vmIntrinsics::_weakCompareAndSetObjectPlain: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Relaxed);
|
||||
case vmIntrinsics::_weakCompareAndSetObjectAcquire: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Acquire);
|
||||
case vmIntrinsics::_weakCompareAndSetObjectRelease: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Release);
|
||||
case vmIntrinsics::_weakCompareAndSetObject: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Volatile);
|
||||
case vmIntrinsics::_weakCompareAndSetBytePlain: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap_weak, Relaxed);
|
||||
case vmIntrinsics::_weakCompareAndSetByteAcquire: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap_weak, Acquire);
|
||||
case vmIntrinsics::_weakCompareAndSetByteRelease: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap_weak, Release);
|
||||
case vmIntrinsics::_weakCompareAndSetByte: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap_weak, Volatile);
|
||||
case vmIntrinsics::_weakCompareAndSetShortPlain: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap_weak, Relaxed);
|
||||
case vmIntrinsics::_weakCompareAndSetShortAcquire: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap_weak, Acquire);
|
||||
case vmIntrinsics::_weakCompareAndSetShortRelease: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap_weak, Release);
|
||||
case vmIntrinsics::_weakCompareAndSetShort: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap_weak, Volatile);
|
||||
case vmIntrinsics::_weakCompareAndSetIntPlain: return inline_unsafe_load_store(T_INT, LS_cmp_swap_weak, Relaxed);
|
||||
case vmIntrinsics::_weakCompareAndSetIntAcquire: return inline_unsafe_load_store(T_INT, LS_cmp_swap_weak, Acquire);
|
||||
case vmIntrinsics::_weakCompareAndSetIntRelease: return inline_unsafe_load_store(T_INT, LS_cmp_swap_weak, Release);
|
||||
case vmIntrinsics::_weakCompareAndSetInt: return inline_unsafe_load_store(T_INT, LS_cmp_swap_weak, Volatile);
|
||||
case vmIntrinsics::_weakCompareAndSetLongPlain: return inline_unsafe_load_store(T_LONG, LS_cmp_swap_weak, Relaxed);
|
||||
case vmIntrinsics::_weakCompareAndSetLongAcquire: return inline_unsafe_load_store(T_LONG, LS_cmp_swap_weak, Acquire);
|
||||
case vmIntrinsics::_weakCompareAndSetLongRelease: return inline_unsafe_load_store(T_LONG, LS_cmp_swap_weak, Release);
|
||||
case vmIntrinsics::_weakCompareAndSetLong: return inline_unsafe_load_store(T_LONG, LS_cmp_swap_weak, Volatile);
|
||||
|
||||
case vmIntrinsics::_compareAndExchangeObjectVolatile: return inline_unsafe_load_store(T_OBJECT, LS_cmp_exchange, Volatile);
|
||||
case vmIntrinsics::_compareAndExchangeObject: return inline_unsafe_load_store(T_OBJECT, LS_cmp_exchange, Volatile);
|
||||
case vmIntrinsics::_compareAndExchangeObjectAcquire: return inline_unsafe_load_store(T_OBJECT, LS_cmp_exchange, Acquire);
|
||||
case vmIntrinsics::_compareAndExchangeObjectRelease: return inline_unsafe_load_store(T_OBJECT, LS_cmp_exchange, Release);
|
||||
case vmIntrinsics::_compareAndExchangeByteVolatile: return inline_unsafe_load_store(T_BYTE, LS_cmp_exchange, Volatile);
|
||||
case vmIntrinsics::_compareAndExchangeByte: return inline_unsafe_load_store(T_BYTE, LS_cmp_exchange, Volatile);
|
||||
case vmIntrinsics::_compareAndExchangeByteAcquire: return inline_unsafe_load_store(T_BYTE, LS_cmp_exchange, Acquire);
|
||||
case vmIntrinsics::_compareAndExchangeByteRelease: return inline_unsafe_load_store(T_BYTE, LS_cmp_exchange, Release);
|
||||
case vmIntrinsics::_compareAndExchangeShortVolatile: return inline_unsafe_load_store(T_SHORT, LS_cmp_exchange, Volatile);
|
||||
case vmIntrinsics::_compareAndExchangeShort: return inline_unsafe_load_store(T_SHORT, LS_cmp_exchange, Volatile);
|
||||
case vmIntrinsics::_compareAndExchangeShortAcquire: return inline_unsafe_load_store(T_SHORT, LS_cmp_exchange, Acquire);
|
||||
case vmIntrinsics::_compareAndExchangeShortRelease: return inline_unsafe_load_store(T_SHORT, LS_cmp_exchange, Release);
|
||||
case vmIntrinsics::_compareAndExchangeIntVolatile: return inline_unsafe_load_store(T_INT, LS_cmp_exchange, Volatile);
|
||||
case vmIntrinsics::_compareAndExchangeInt: return inline_unsafe_load_store(T_INT, LS_cmp_exchange, Volatile);
|
||||
case vmIntrinsics::_compareAndExchangeIntAcquire: return inline_unsafe_load_store(T_INT, LS_cmp_exchange, Acquire);
|
||||
case vmIntrinsics::_compareAndExchangeIntRelease: return inline_unsafe_load_store(T_INT, LS_cmp_exchange, Release);
|
||||
case vmIntrinsics::_compareAndExchangeLongVolatile: return inline_unsafe_load_store(T_LONG, LS_cmp_exchange, Volatile);
|
||||
case vmIntrinsics::_compareAndExchangeLong: return inline_unsafe_load_store(T_LONG, LS_cmp_exchange, Volatile);
|
||||
case vmIntrinsics::_compareAndExchangeLongAcquire: return inline_unsafe_load_store(T_LONG, LS_cmp_exchange, Acquire);
|
||||
case vmIntrinsics::_compareAndExchangeLongRelease: return inline_unsafe_load_store(T_LONG, LS_cmp_exchange, Release);
|
||||
|
||||
@ -2587,23 +2587,26 @@ bool LibraryCallKit::inline_unsafe_access(bool is_store, const BasicType type, c
|
||||
//
|
||||
// LS_cmp_swap:
|
||||
//
|
||||
// boolean compareAndSwapObject(Object o, long offset, Object expected, Object x);
|
||||
// boolean compareAndSwapInt( Object o, long offset, int expected, int x);
|
||||
// boolean compareAndSwapLong( Object o, long offset, long expected, long x);
|
||||
// boolean compareAndSetObject(Object o, long offset, Object expected, Object x);
|
||||
// boolean compareAndSetInt( Object o, long offset, int expected, int x);
|
||||
// boolean compareAndSetLong( Object o, long offset, long expected, long x);
|
||||
//
|
||||
// LS_cmp_swap_weak:
|
||||
//
|
||||
// boolean weakCompareAndSwapObject( Object o, long offset, Object expected, Object x);
|
||||
// boolean weakCompareAndSwapObjectAcquire(Object o, long offset, Object expected, Object x);
|
||||
// boolean weakCompareAndSwapObjectRelease(Object o, long offset, Object expected, Object x);
|
||||
// boolean weakCompareAndSetObject( Object o, long offset, Object expected, Object x);
|
||||
// boolean weakCompareAndSetObjectPlain( Object o, long offset, Object expected, Object x);
|
||||
// boolean weakCompareAndSetObjectAcquire(Object o, long offset, Object expected, Object x);
|
||||
// boolean weakCompareAndSetObjectRelease(Object o, long offset, Object expected, Object x);
|
||||
//
|
||||
// boolean weakCompareAndSwapInt( Object o, long offset, int expected, int x);
|
||||
// boolean weakCompareAndSwapIntAcquire( Object o, long offset, int expected, int x);
|
||||
// boolean weakCompareAndSwapIntRelease( Object o, long offset, int expected, int x);
|
||||
// boolean weakCompareAndSetInt( Object o, long offset, int expected, int x);
|
||||
// boolean weakCompareAndSetIntPlain( Object o, long offset, int expected, int x);
|
||||
// boolean weakCompareAndSetIntAcquire( Object o, long offset, int expected, int x);
|
||||
// boolean weakCompareAndSetIntRelease( Object o, long offset, int expected, int x);
|
||||
//
|
||||
// boolean weakCompareAndSwapLong( Object o, long offset, long expected, long x);
|
||||
// boolean weakCompareAndSwapLongAcquire( Object o, long offset, long expected, long x);
|
||||
// boolean weakCompareAndSwapLongRelease( Object o, long offset, long expected, long x);
|
||||
// boolean weakCompareAndSetLong( Object o, long offset, long expected, long x);
|
||||
// boolean weakCompareAndSetLongPlain( Object o, long offset, long expected, long x);
|
||||
// boolean weakCompareAndSetLongAcquire( Object o, long offset, long expected, long x);
|
||||
// boolean weakCompareAndSetLongRelease( Object o, long offset, long expected, long x);
|
||||
//
|
||||
// LS_cmp_exchange:
|
||||
//
|
||||
@ -4965,7 +4968,7 @@ bool LibraryCallKit::inline_arraycopy() {
|
||||
// See arraycopy_restore_alloc_state() comment
|
||||
// if alloc == NULL we don't have to worry about a tightly coupled allocation so we can emit all needed guards
|
||||
// if saved_jvms != NULL (then alloc != NULL) then we can handle guards and a tightly coupled allocation
|
||||
// if saved_jvms == NULL and alloc != NULL, we can’t emit any guards
|
||||
// if saved_jvms == NULL and alloc != NULL, we can't emit any guards
|
||||
bool can_emit_guards = (alloc == NULL || saved_jvms != NULL);
|
||||
|
||||
// The following tests must be performed
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2017, 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
|
||||
@ -378,7 +378,7 @@ UNSAFE_ENTRY(jobject, Unsafe_GetUncompressedObject(JNIEnv *env, jobject unsafe,
|
||||
// On platforms which do not support atomic compare-and-swap of jlong (8 byte)
|
||||
// values we have to use a lock-based scheme to enforce atomicity. This has to be
|
||||
// applied to all Unsafe operations that set the value of a jlong field. Even so
|
||||
// the compareAndSwapLong operation will not be atomic with respect to direct stores
|
||||
// the compareAndSetLong operation will not be atomic with respect to direct stores
|
||||
// to the field from Java code. It is important therefore that any Java code that
|
||||
// utilizes these Unsafe jlong operations does not perform direct stores. To permit
|
||||
// direct loads of the field from Java code we must also use Atomic::store within the
|
||||
@ -1013,7 +1013,7 @@ UNSAFE_ENTRY(jlong, Unsafe_CompareAndExchangeLong(JNIEnv *env, jobject unsafe, j
|
||||
#endif
|
||||
} UNSAFE_END
|
||||
|
||||
UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSwapObject(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jobject e_h, jobject x_h)) {
|
||||
UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSetObject(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jobject e_h, jobject x_h)) {
|
||||
oop x = JNIHandles::resolve(x_h);
|
||||
oop e = JNIHandles::resolve(e_h);
|
||||
oop p = JNIHandles::resolve(obj);
|
||||
@ -1028,14 +1028,14 @@ UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSwapObject(JNIEnv *env, jobject unsafe,
|
||||
return true;
|
||||
} UNSAFE_END
|
||||
|
||||
UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSwapInt(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jint e, jint x)) {
|
||||
UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSetInt(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jint e, jint x)) {
|
||||
oop p = JNIHandles::resolve(obj);
|
||||
jint* addr = (jint *)index_oop_from_field_offset_long(p, offset);
|
||||
|
||||
return (jint)(Atomic::cmpxchg(x, addr, e)) == e;
|
||||
} UNSAFE_END
|
||||
|
||||
UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSwapLong(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jlong e, jlong x)) {
|
||||
UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSetLong(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jlong e, jlong x)) {
|
||||
Handle p(THREAD, JNIHandles::resolve(obj));
|
||||
jlong* addr = (jlong*)index_oop_from_field_offset_long(p(), offset);
|
||||
|
||||
@ -1194,12 +1194,12 @@ static JNINativeMethod jdk_internal_misc_Unsafe_methods[] = {
|
||||
{CC "defineClass0", CC "(" DC_Args ")" CLS, FN_PTR(Unsafe_DefineClass0)},
|
||||
{CC "allocateInstance", CC "(" CLS ")" OBJ, FN_PTR(Unsafe_AllocateInstance)},
|
||||
{CC "throwException", CC "(" THR ")V", FN_PTR(Unsafe_ThrowException)},
|
||||
{CC "compareAndSwapObject", CC "(" OBJ "J" OBJ "" OBJ ")Z", FN_PTR(Unsafe_CompareAndSwapObject)},
|
||||
{CC "compareAndSwapInt", CC "(" OBJ "J""I""I"")Z", FN_PTR(Unsafe_CompareAndSwapInt)},
|
||||
{CC "compareAndSwapLong", CC "(" OBJ "J""J""J"")Z", FN_PTR(Unsafe_CompareAndSwapLong)},
|
||||
{CC "compareAndExchangeObjectVolatile", CC "(" OBJ "J" OBJ "" OBJ ")" OBJ, FN_PTR(Unsafe_CompareAndExchangeObject)},
|
||||
{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 "compareAndSetObject",CC "(" OBJ "J" OBJ "" OBJ ")Z", FN_PTR(Unsafe_CompareAndSetObject)},
|
||||
{CC "compareAndSetInt", CC "(" OBJ "J""I""I"")Z", FN_PTR(Unsafe_CompareAndSetInt)},
|
||||
{CC "compareAndSetLong", CC "(" OBJ "J""J""J"")Z", FN_PTR(Unsafe_CompareAndSetLong)},
|
||||
{CC "compareAndExchangeObject", CC "(" OBJ "J" OBJ "" OBJ ")" OBJ, FN_PTR(Unsafe_CompareAndExchangeObject)},
|
||||
{CC "compareAndExchangeInt", CC "(" OBJ "J""I""I"")I", FN_PTR(Unsafe_CompareAndExchangeInt)},
|
||||
{CC "compareAndExchangeLong", CC "(" OBJ "J""J""J"")J", FN_PTR(Unsafe_CompareAndExchangeLong)},
|
||||
|
||||
{CC "park", CC "(ZJ)V", FN_PTR(Unsafe_Park)},
|
||||
{CC "unpark", CC "(" OBJ ")V", FN_PTR(Unsafe_Unpark)},
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright 2009 Red Hat, Inc.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -66,7 +66,7 @@ bool SharkIntrinsics::is_intrinsic(ciMethod *target) {
|
||||
return true;
|
||||
|
||||
// Unsafe
|
||||
case vmIntrinsics::_compareAndSwapInt:
|
||||
case vmIntrinsics::_compareAndSetInt:
|
||||
return true;
|
||||
|
||||
default:
|
||||
@ -140,8 +140,8 @@ void SharkIntrinsics::do_intrinsic() {
|
||||
break;
|
||||
|
||||
// Unsafe
|
||||
case vmIntrinsics::_compareAndSwapInt:
|
||||
do_Unsafe_compareAndSwapInt();
|
||||
case vmIntrinsics::_compareAndSetInt:
|
||||
do_Unsafe_compareAndSetInt();
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -241,7 +241,7 @@ void SharkIntrinsics::do_Thread_currentThread() {
|
||||
true));
|
||||
}
|
||||
|
||||
void SharkIntrinsics::do_Unsafe_compareAndSwapInt() {
|
||||
void SharkIntrinsics::do_Unsafe_compareAndSetInt() {
|
||||
// Pop the arguments
|
||||
Value *x = state()->pop()->jint_value();
|
||||
Value *e = state()->pop()->jint_value();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright 2009 Red Hat, Inc.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -58,7 +58,7 @@ class SharkIntrinsics : public SharkTargetInvariants {
|
||||
void do_Object_getClass();
|
||||
void do_System_currentTimeMillis();
|
||||
void do_Thread_currentThread();
|
||||
void do_Unsafe_compareAndSwapInt();
|
||||
void do_Unsafe_compareAndSetInt();
|
||||
};
|
||||
|
||||
#endif // SHARE_VM_SHARK_SHARKINTRINSICS_HPP
|
||||
|
@ -773,221 +773,221 @@ public class TestIntUnsafeCAS {
|
||||
|
||||
static void test_ci(int[] a) {
|
||||
for (int i = 0; i < ARRLEN; i+=1) {
|
||||
unsafe.compareAndSwapInt(a, byte_offset(i), -1, -123);
|
||||
unsafe.compareAndSetInt(a, byte_offset(i), -1, -123);
|
||||
}
|
||||
}
|
||||
static void test_vi(int[] a, int b, int old) {
|
||||
for (int i = 0; i < ARRLEN; i+=1) {
|
||||
unsafe.compareAndSwapInt(a, byte_offset(i), old, b);
|
||||
unsafe.compareAndSetInt(a, byte_offset(i), old, b);
|
||||
}
|
||||
}
|
||||
static void test_cp(int[] a, int[] b) {
|
||||
for (int i = 0; i < ARRLEN; i+=1) {
|
||||
unsafe.compareAndSwapInt(a, byte_offset(i), -123, b[i]);
|
||||
unsafe.compareAndSetInt(a, byte_offset(i), -123, b[i]);
|
||||
}
|
||||
}
|
||||
static void test_2ci(int[] a, int[] b) {
|
||||
for (int i = 0; i < ARRLEN; i+=1) {
|
||||
unsafe.compareAndSwapInt(a, byte_offset(i), 123, -123);
|
||||
unsafe.compareAndSwapInt(b, byte_offset(i), 123, -103);
|
||||
unsafe.compareAndSetInt(a, byte_offset(i), 123, -123);
|
||||
unsafe.compareAndSetInt(b, byte_offset(i), 123, -103);
|
||||
}
|
||||
}
|
||||
static void test_2vi(int[] a, int[] b, int c, int d) {
|
||||
for (int i = 0; i < ARRLEN; i+=1) {
|
||||
unsafe.compareAndSwapInt(a, byte_offset(i), -123, c);
|
||||
unsafe.compareAndSwapInt(b, byte_offset(i), -103, d);
|
||||
unsafe.compareAndSetInt(a, byte_offset(i), -123, c);
|
||||
unsafe.compareAndSetInt(b, byte_offset(i), -103, d);
|
||||
}
|
||||
}
|
||||
static void test_ci_neg(int[] a, int old) {
|
||||
for (int i = ARRLEN-1; i >= 0; i-=1) {
|
||||
unsafe.compareAndSwapInt(a, byte_offset(i), old, -123);
|
||||
unsafe.compareAndSetInt(a, byte_offset(i), old, -123);
|
||||
}
|
||||
}
|
||||
static void test_vi_neg(int[] a, int b, int old) {
|
||||
for (int i = ARRLEN-1; i >= 0; i-=1) {
|
||||
unsafe.compareAndSwapInt(a, byte_offset(i), old, b);
|
||||
unsafe.compareAndSetInt(a, byte_offset(i), old, b);
|
||||
}
|
||||
}
|
||||
static void test_cp_neg(int[] a, int[] b) {
|
||||
for (int i = ARRLEN-1; i >= 0; i-=1) {
|
||||
unsafe.compareAndSwapInt(a, byte_offset(i), -123, b[i]);
|
||||
unsafe.compareAndSetInt(a, byte_offset(i), -123, b[i]);
|
||||
}
|
||||
}
|
||||
static void test_2ci_neg(int[] a, int[] b) {
|
||||
for (int i = ARRLEN-1; i >= 0; i-=1) {
|
||||
unsafe.compareAndSwapInt(a, byte_offset(i), 123, -123);
|
||||
unsafe.compareAndSwapInt(b, byte_offset(i), 123, -103);
|
||||
unsafe.compareAndSetInt(a, byte_offset(i), 123, -123);
|
||||
unsafe.compareAndSetInt(b, byte_offset(i), 123, -103);
|
||||
}
|
||||
}
|
||||
static void test_2vi_neg(int[] a, int[] b, int c, int d) {
|
||||
for (int i = ARRLEN-1; i >= 0; i-=1) {
|
||||
unsafe.compareAndSwapInt(a, byte_offset(i), -123, c);
|
||||
unsafe.compareAndSwapInt(b, byte_offset(i), -103, d);
|
||||
unsafe.compareAndSetInt(a, byte_offset(i), -123, c);
|
||||
unsafe.compareAndSetInt(b, byte_offset(i), -103, d);
|
||||
}
|
||||
}
|
||||
static void test_ci_oppos(int[] a, int old) {
|
||||
int limit = ARRLEN-1;
|
||||
for (int i = 0; i < ARRLEN; i+=1) {
|
||||
unsafe.compareAndSwapInt(a, byte_offset(limit-i), old, -123);
|
||||
unsafe.compareAndSetInt(a, byte_offset(limit-i), old, -123);
|
||||
}
|
||||
}
|
||||
static void test_vi_oppos(int[] a, int b, int old) {
|
||||
int limit = ARRLEN-1;
|
||||
for (int i = limit; i >= 0; i-=1) {
|
||||
unsafe.compareAndSwapInt(a, byte_offset(limit-i), old, b);
|
||||
unsafe.compareAndSetInt(a, byte_offset(limit-i), old, b);
|
||||
}
|
||||
}
|
||||
static void test_cp_oppos(int[] a, int[] b) {
|
||||
int limit = ARRLEN-1;
|
||||
for (int i = 0; i < ARRLEN; i+=1) {
|
||||
unsafe.compareAndSwapInt(a, byte_offset(i), -123, b[limit-i]);
|
||||
unsafe.compareAndSetInt(a, byte_offset(i), -123, b[limit-i]);
|
||||
}
|
||||
}
|
||||
static void test_2ci_oppos(int[] a, int[] b) {
|
||||
int limit = ARRLEN-1;
|
||||
for (int i = 0; i < ARRLEN; i+=1) {
|
||||
unsafe.compareAndSwapInt(a, byte_offset(limit-i), 123, -123);
|
||||
unsafe.compareAndSwapInt(b, byte_offset(i), 123, -103);
|
||||
unsafe.compareAndSetInt(a, byte_offset(limit-i), 123, -123);
|
||||
unsafe.compareAndSetInt(b, byte_offset(i), 123, -103);
|
||||
}
|
||||
}
|
||||
static void test_2vi_oppos(int[] a, int[] b, int c, int d) {
|
||||
int limit = ARRLEN-1;
|
||||
for (int i = limit; i >= 0; i-=1) {
|
||||
unsafe.compareAndSwapInt(a, byte_offset(i), -123, c);
|
||||
unsafe.compareAndSwapInt(b, byte_offset(limit-i), -103, d);
|
||||
unsafe.compareAndSetInt(a, byte_offset(i), -123, c);
|
||||
unsafe.compareAndSetInt(b, byte_offset(limit-i), -103, d);
|
||||
}
|
||||
}
|
||||
static void test_ci_off(int[] a, int old) {
|
||||
for (int i = 0; i < ARRLEN-OFFSET; i+=1) {
|
||||
unsafe.compareAndSwapInt(a, byte_offset(i+OFFSET), old, -123);
|
||||
unsafe.compareAndSetInt(a, byte_offset(i+OFFSET), old, -123);
|
||||
}
|
||||
}
|
||||
static void test_vi_off(int[] a, int b, int old) {
|
||||
for (int i = 0; i < ARRLEN-OFFSET; i+=1) {
|
||||
unsafe.compareAndSwapInt(a, byte_offset(i+OFFSET), old, b);
|
||||
unsafe.compareAndSetInt(a, byte_offset(i+OFFSET), old, b);
|
||||
}
|
||||
}
|
||||
static void test_cp_off(int[] a, int[] b) {
|
||||
for (int i = 0; i < ARRLEN-OFFSET; i+=1) {
|
||||
unsafe.compareAndSwapInt(a, byte_offset(i+OFFSET), -123, b[i+OFFSET]);
|
||||
unsafe.compareAndSetInt(a, byte_offset(i+OFFSET), -123, b[i+OFFSET]);
|
||||
}
|
||||
}
|
||||
static void test_2ci_off(int[] a, int[] b) {
|
||||
for (int i = 0; i < ARRLEN-OFFSET; i+=1) {
|
||||
unsafe.compareAndSwapInt(a, byte_offset(i+OFFSET), 123, -123);
|
||||
unsafe.compareAndSwapInt(b, byte_offset(i+OFFSET), 123, -103);
|
||||
unsafe.compareAndSetInt(a, byte_offset(i+OFFSET), 123, -123);
|
||||
unsafe.compareAndSetInt(b, byte_offset(i+OFFSET), 123, -103);
|
||||
}
|
||||
}
|
||||
static void test_2vi_off(int[] a, int[] b, int c, int d) {
|
||||
for (int i = 0; i < ARRLEN-OFFSET; i+=1) {
|
||||
unsafe.compareAndSwapInt(a, byte_offset(i+OFFSET), -123, c);
|
||||
unsafe.compareAndSwapInt(b, byte_offset(i+OFFSET), -103, d);
|
||||
unsafe.compareAndSetInt(a, byte_offset(i+OFFSET), -123, c);
|
||||
unsafe.compareAndSetInt(b, byte_offset(i+OFFSET), -103, d);
|
||||
}
|
||||
}
|
||||
static void test_ci_inv(int[] a, int k, int old) {
|
||||
for (int i = 0; i < ARRLEN-k; i+=1) {
|
||||
unsafe.compareAndSwapInt(a, byte_offset(i+k), old, -123);
|
||||
unsafe.compareAndSetInt(a, byte_offset(i+k), old, -123);
|
||||
}
|
||||
}
|
||||
static void test_vi_inv(int[] a, int b, int k, int old) {
|
||||
for (int i = 0; i < ARRLEN-k; i+=1) {
|
||||
unsafe.compareAndSwapInt(a, byte_offset(i+k), old, b);
|
||||
unsafe.compareAndSetInt(a, byte_offset(i+k), old, b);
|
||||
}
|
||||
}
|
||||
static void test_cp_inv(int[] a, int[] b, int k) {
|
||||
for (int i = 0; i < ARRLEN-k; i+=1) {
|
||||
unsafe.compareAndSwapInt(a, byte_offset(i+k), -123, b[i+k]);
|
||||
unsafe.compareAndSetInt(a, byte_offset(i+k), -123, b[i+k]);
|
||||
}
|
||||
}
|
||||
static void test_2ci_inv(int[] a, int[] b, int k) {
|
||||
for (int i = 0; i < ARRLEN-k; i+=1) {
|
||||
unsafe.compareAndSwapInt(a, byte_offset(i+k), 123, -123);
|
||||
unsafe.compareAndSwapInt(b, byte_offset(i+k), 123, -103);
|
||||
unsafe.compareAndSetInt(a, byte_offset(i+k), 123, -123);
|
||||
unsafe.compareAndSetInt(b, byte_offset(i+k), 123, -103);
|
||||
}
|
||||
}
|
||||
static void test_2vi_inv(int[] a, int[] b, int c, int d, int k) {
|
||||
for (int i = 0; i < ARRLEN-k; i+=1) {
|
||||
unsafe.compareAndSwapInt(a, byte_offset(i+k), -123, c);
|
||||
unsafe.compareAndSwapInt(b, byte_offset(i+k), -103, d);
|
||||
unsafe.compareAndSetInt(a, byte_offset(i+k), -123, c);
|
||||
unsafe.compareAndSetInt(b, byte_offset(i+k), -103, d);
|
||||
}
|
||||
}
|
||||
static void test_ci_scl(int[] a, int old) {
|
||||
for (int i = 0; i*SCALE < ARRLEN; i+=1) {
|
||||
unsafe.compareAndSwapInt(a, byte_offset(i*SCALE), old, -123);
|
||||
unsafe.compareAndSetInt(a, byte_offset(i*SCALE), old, -123);
|
||||
}
|
||||
}
|
||||
static void test_vi_scl(int[] a, int b, int old) {
|
||||
for (int i = 0; i*SCALE < ARRLEN; i+=1) {
|
||||
unsafe.compareAndSwapInt(a, byte_offset(i*SCALE), old, b);
|
||||
unsafe.compareAndSetInt(a, byte_offset(i*SCALE), old, b);
|
||||
}
|
||||
}
|
||||
static void test_cp_scl(int[] a, int[] b) {
|
||||
for (int i = 0; i*SCALE < ARRLEN; i+=1) {
|
||||
unsafe.compareAndSwapInt(a, byte_offset(i*SCALE), -123, b[i*SCALE]);
|
||||
unsafe.compareAndSetInt(a, byte_offset(i*SCALE), -123, b[i*SCALE]);
|
||||
}
|
||||
}
|
||||
static void test_2ci_scl(int[] a, int[] b) {
|
||||
for (int i = 0; i*SCALE < ARRLEN; i+=1) {
|
||||
unsafe.compareAndSwapInt(a, byte_offset(i*SCALE), 123, -123);
|
||||
unsafe.compareAndSwapInt(b, byte_offset(i*SCALE), 123, -103);
|
||||
unsafe.compareAndSetInt(a, byte_offset(i*SCALE), 123, -123);
|
||||
unsafe.compareAndSetInt(b, byte_offset(i*SCALE), 123, -103);
|
||||
}
|
||||
}
|
||||
static void test_2vi_scl(int[] a, int[] b, int c, int d) {
|
||||
for (int i = 0; i*SCALE < ARRLEN; i+=1) {
|
||||
unsafe.compareAndSwapInt(a, byte_offset(i*SCALE), -123, c);
|
||||
unsafe.compareAndSwapInt(b, byte_offset(i*SCALE), -103, d);
|
||||
unsafe.compareAndSetInt(a, byte_offset(i*SCALE), -123, c);
|
||||
unsafe.compareAndSetInt(b, byte_offset(i*SCALE), -103, d);
|
||||
}
|
||||
}
|
||||
static void test_cp_alndst(int[] a, int[] b) {
|
||||
for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) {
|
||||
unsafe.compareAndSwapInt(a, byte_offset(i+ALIGN_OFF), -1, b[i]);
|
||||
unsafe.compareAndSetInt(a, byte_offset(i+ALIGN_OFF), -1, b[i]);
|
||||
}
|
||||
}
|
||||
static void test_cp_alnsrc(int[] a, int[] b) {
|
||||
for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) {
|
||||
int old = unsafe.getIntVolatile(a, byte_offset(i));
|
||||
unsafe.compareAndSwapInt(a, byte_offset(i), old, b[i+ALIGN_OFF]);
|
||||
unsafe.compareAndSetInt(a, byte_offset(i), old, b[i+ALIGN_OFF]);
|
||||
}
|
||||
}
|
||||
static void test_2ci_aln(int[] a, int[] b) {
|
||||
for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) {
|
||||
unsafe.compareAndSwapInt(a, byte_offset(i+ALIGN_OFF), -1, -123);
|
||||
unsafe.compareAndSetInt(a, byte_offset(i+ALIGN_OFF), -1, -123);
|
||||
int old = unsafe.getIntVolatile(b, byte_offset(i));
|
||||
unsafe.compareAndSwapInt(b, byte_offset(i), old, -103);
|
||||
unsafe.compareAndSetInt(b, byte_offset(i), old, -103);
|
||||
}
|
||||
}
|
||||
static void test_2vi_aln(int[] a, int[] b, int c, int d) {
|
||||
for (int i = 0; i < ARRLEN-ALIGN_OFF; i+=1) {
|
||||
int old = unsafe.getIntVolatile(a, byte_offset(i));
|
||||
unsafe.compareAndSwapInt(a, byte_offset(i), old, c);
|
||||
unsafe.compareAndSetInt(a, byte_offset(i), old, c);
|
||||
old = unsafe.getIntVolatile(b, byte_offset(i+ALIGN_OFF));
|
||||
unsafe.compareAndSwapInt(b, byte_offset(i+ALIGN_OFF), old, d);
|
||||
unsafe.compareAndSetInt(b, byte_offset(i+ALIGN_OFF), old, d);
|
||||
}
|
||||
}
|
||||
static void test_cp_unalndst(int[] a, int[] b) {
|
||||
for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) {
|
||||
unsafe.compareAndSwapInt(a, byte_offset(i+UNALIGN_OFF), -1, b[i]);
|
||||
unsafe.compareAndSetInt(a, byte_offset(i+UNALIGN_OFF), -1, b[i]);
|
||||
}
|
||||
}
|
||||
static void test_cp_unalnsrc(int[] a, int[] b) {
|
||||
for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) {
|
||||
int old = unsafe.getIntVolatile(a, byte_offset(i));
|
||||
unsafe.compareAndSwapInt(a, byte_offset(i), old, b[i+UNALIGN_OFF]);
|
||||
unsafe.compareAndSetInt(a, byte_offset(i), old, b[i+UNALIGN_OFF]);
|
||||
}
|
||||
}
|
||||
static void test_2ci_unaln(int[] a, int[] b) {
|
||||
for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) {
|
||||
unsafe.compareAndSwapInt(a, byte_offset(i+UNALIGN_OFF), -1, -123);
|
||||
unsafe.compareAndSetInt(a, byte_offset(i+UNALIGN_OFF), -1, -123);
|
||||
int old = unsafe.getIntVolatile(b, byte_offset(i));
|
||||
unsafe.compareAndSwapInt(b, byte_offset(i), old, -103);
|
||||
unsafe.compareAndSetInt(b, byte_offset(i), old, -103);
|
||||
}
|
||||
}
|
||||
static void test_2vi_unaln(int[] a, int[] b, int c, int d) {
|
||||
for (int i = 0; i < ARRLEN-UNALIGN_OFF; i+=1) {
|
||||
int old = unsafe.getIntVolatile(a, byte_offset(i));
|
||||
unsafe.compareAndSwapInt(a, byte_offset(i), old, c);
|
||||
unsafe.compareAndSetInt(a, byte_offset(i), old, c);
|
||||
old = unsafe.getIntVolatile(b, byte_offset(i+UNALIGN_OFF));
|
||||
unsafe.compareAndSwapInt(b, byte_offset(i+UNALIGN_OFF), old, d);
|
||||
unsafe.compareAndSetInt(b, byte_offset(i+UNALIGN_OFF), old, d);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, Red Hat, Inc. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -53,7 +54,7 @@ public class TestCAEAntiDep {
|
||||
}
|
||||
|
||||
static int m(TestCAEAntiDep test, Object expected, Object x) {
|
||||
C old = (C)UNSAFE.compareAndExchangeObjectVolatile(test, O_OFFSET, expected, x);
|
||||
C old = (C)UNSAFE.compareAndExchangeObject(test, O_OFFSET, expected, x);
|
||||
int res = old.f1;
|
||||
old.f1 = 0x42;
|
||||
return res;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2017, 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
|
||||
@ -72,9 +72,8 @@ public class UnsafeTwoCASLong {
|
||||
}
|
||||
|
||||
static void testAccess(Object base, long offset) {
|
||||
UNSAFE.compareAndSwapLong(base, offset, 1L, 2L);
|
||||
UNSAFE.compareAndSwapLong(base, offset, 2L, 1L);
|
||||
UNSAFE.compareAndSetLong(base, offset, 1L, 2L);
|
||||
UNSAFE.compareAndSetLong(base, offset, 2L, 1L);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ public class UnsafeAccess {
|
||||
static Object helperUnsafeLoadStore(Object o, boolean isObjArray) {
|
||||
if (isObjArray) {
|
||||
Object o1 = U.getObject(o, off);
|
||||
U.compareAndSwapObject(o, off, o1, new Object());
|
||||
U.compareAndSetObject(o, off, o1, new Object());
|
||||
}
|
||||
return o;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2017, 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
|
||||
@ -151,32 +151,32 @@ public class JdkInternalMiscUnsafeAccessTestBoolean {
|
||||
|
||||
// Compare
|
||||
{
|
||||
boolean r = UNSAFE.compareAndSwapBoolean(base, offset, true, false);
|
||||
assertEquals(r, true, "success compareAndSwap boolean");
|
||||
boolean r = UNSAFE.compareAndSetBoolean(base, offset, true, false);
|
||||
assertEquals(r, true, "success compareAndSet boolean");
|
||||
boolean x = UNSAFE.getBoolean(base, offset);
|
||||
assertEquals(x, false, "success compareAndSwap boolean value");
|
||||
assertEquals(x, false, "success compareAndSet boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = UNSAFE.compareAndSwapBoolean(base, offset, true, false);
|
||||
assertEquals(r, false, "failing compareAndSwap boolean");
|
||||
boolean r = UNSAFE.compareAndSetBoolean(base, offset, true, false);
|
||||
assertEquals(r, false, "failing compareAndSet boolean");
|
||||
boolean x = UNSAFE.getBoolean(base, offset);
|
||||
assertEquals(x, false, "failing compareAndSwap boolean value");
|
||||
assertEquals(x, false, "failing compareAndSet boolean value");
|
||||
}
|
||||
|
||||
// Advanced compare
|
||||
{
|
||||
boolean r = UNSAFE.compareAndExchangeBooleanVolatile(base, offset, false, true);
|
||||
assertEquals(r, false, "success compareAndExchangeVolatile boolean");
|
||||
boolean r = UNSAFE.compareAndExchangeBoolean(base, offset, false, true);
|
||||
assertEquals(r, false, "success compareAndExchange boolean");
|
||||
boolean x = UNSAFE.getBoolean(base, offset);
|
||||
assertEquals(x, true, "success compareAndExchangeVolatile boolean value");
|
||||
assertEquals(x, true, "success compareAndExchange boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = UNSAFE.compareAndExchangeBooleanVolatile(base, offset, false, false);
|
||||
assertEquals(r, true, "failing compareAndExchangeVolatile boolean");
|
||||
boolean r = UNSAFE.compareAndExchangeBoolean(base, offset, false, false);
|
||||
assertEquals(r, true, "failing compareAndExchange boolean");
|
||||
boolean x = UNSAFE.getBoolean(base, offset);
|
||||
assertEquals(x, true, "failing compareAndExchangeVolatile boolean value");
|
||||
assertEquals(x, true, "failing compareAndExchange boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
@ -210,41 +210,41 @@ public class JdkInternalMiscUnsafeAccessTestBoolean {
|
||||
{
|
||||
boolean success = false;
|
||||
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
|
||||
success = UNSAFE.weakCompareAndSwapBoolean(base, offset, true, false);
|
||||
success = UNSAFE.weakCompareAndSetBooleanPlain(base, offset, true, false);
|
||||
}
|
||||
assertEquals(success, true, "weakCompareAndSwap boolean");
|
||||
assertEquals(success, true, "weakCompareAndSetPlain boolean");
|
||||
boolean x = UNSAFE.getBoolean(base, offset);
|
||||
assertEquals(x, false, "weakCompareAndSwap boolean value");
|
||||
assertEquals(x, false, "weakCompareAndSetPlain boolean value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
|
||||
success = UNSAFE.weakCompareAndSwapBooleanAcquire(base, offset, false, true);
|
||||
success = UNSAFE.weakCompareAndSetBooleanAcquire(base, offset, false, true);
|
||||
}
|
||||
assertEquals(success, true, "weakCompareAndSwapAcquire boolean");
|
||||
assertEquals(success, true, "weakCompareAndSetAcquire boolean");
|
||||
boolean x = UNSAFE.getBoolean(base, offset);
|
||||
assertEquals(x, true, "weakCompareAndSwapAcquire boolean");
|
||||
assertEquals(x, true, "weakCompareAndSetAcquire boolean");
|
||||
}
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
|
||||
success = UNSAFE.weakCompareAndSwapBooleanRelease(base, offset, true, false);
|
||||
success = UNSAFE.weakCompareAndSetBooleanRelease(base, offset, true, false);
|
||||
}
|
||||
assertEquals(success, true, "weakCompareAndSwapRelease boolean");
|
||||
assertEquals(success, true, "weakCompareAndSetRelease boolean");
|
||||
boolean x = UNSAFE.getBoolean(base, offset);
|
||||
assertEquals(x, false, "weakCompareAndSwapRelease boolean");
|
||||
assertEquals(x, false, "weakCompareAndSetRelease boolean");
|
||||
}
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
|
||||
success = UNSAFE.weakCompareAndSwapBooleanVolatile(base, offset, false, true);
|
||||
success = UNSAFE.weakCompareAndSetBoolean(base, offset, false, true);
|
||||
}
|
||||
assertEquals(success, true, "weakCompareAndSwapVolatile boolean");
|
||||
assertEquals(success, true, "weakCompareAndSet boolean");
|
||||
boolean x = UNSAFE.getBoolean(base, offset);
|
||||
assertEquals(x, true, "weakCompareAndSwapVolatile boolean");
|
||||
assertEquals(x, true, "weakCompareAndSet boolean");
|
||||
}
|
||||
|
||||
UNSAFE.putBoolean(base, offset, false);
|
||||
@ -260,4 +260,3 @@ public class JdkInternalMiscUnsafeAccessTestBoolean {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2017, 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
|
||||
@ -180,32 +180,32 @@ public class JdkInternalMiscUnsafeAccessTestByte {
|
||||
|
||||
// Compare
|
||||
{
|
||||
boolean r = UNSAFE.compareAndSwapByte(base, offset, (byte)0x01, (byte)0x23);
|
||||
assertEquals(r, true, "success compareAndSwap byte");
|
||||
boolean r = UNSAFE.compareAndSetByte(base, offset, (byte)0x01, (byte)0x23);
|
||||
assertEquals(r, true, "success compareAndSet byte");
|
||||
byte x = UNSAFE.getByte(base, offset);
|
||||
assertEquals(x, (byte)0x23, "success compareAndSwap byte value");
|
||||
assertEquals(x, (byte)0x23, "success compareAndSet byte value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = UNSAFE.compareAndSwapByte(base, offset, (byte)0x01, (byte)0x45);
|
||||
assertEquals(r, false, "failing compareAndSwap byte");
|
||||
boolean r = UNSAFE.compareAndSetByte(base, offset, (byte)0x01, (byte)0x45);
|
||||
assertEquals(r, false, "failing compareAndSet byte");
|
||||
byte x = UNSAFE.getByte(base, offset);
|
||||
assertEquals(x, (byte)0x23, "failing compareAndSwap byte value");
|
||||
assertEquals(x, (byte)0x23, "failing compareAndSet byte value");
|
||||
}
|
||||
|
||||
// Advanced compare
|
||||
{
|
||||
byte r = UNSAFE.compareAndExchangeByteVolatile(base, offset, (byte)0x23, (byte)0x01);
|
||||
assertEquals(r, (byte)0x23, "success compareAndExchangeVolatile byte");
|
||||
byte r = UNSAFE.compareAndExchangeByte(base, offset, (byte)0x23, (byte)0x01);
|
||||
assertEquals(r, (byte)0x23, "success compareAndExchange byte");
|
||||
byte x = UNSAFE.getByte(base, offset);
|
||||
assertEquals(x, (byte)0x01, "success compareAndExchangeVolatile byte value");
|
||||
assertEquals(x, (byte)0x01, "success compareAndExchange byte value");
|
||||
}
|
||||
|
||||
{
|
||||
byte r = UNSAFE.compareAndExchangeByteVolatile(base, offset, (byte)0x23, (byte)0x45);
|
||||
assertEquals(r, (byte)0x01, "failing compareAndExchangeVolatile byte");
|
||||
byte r = UNSAFE.compareAndExchangeByte(base, offset, (byte)0x23, (byte)0x45);
|
||||
assertEquals(r, (byte)0x01, "failing compareAndExchange byte");
|
||||
byte x = UNSAFE.getByte(base, offset);
|
||||
assertEquals(x, (byte)0x01, "failing compareAndExchangeVolatile byte value");
|
||||
assertEquals(x, (byte)0x01, "failing compareAndExchange byte value");
|
||||
}
|
||||
|
||||
{
|
||||
@ -239,41 +239,41 @@ public class JdkInternalMiscUnsafeAccessTestByte {
|
||||
{
|
||||
boolean success = false;
|
||||
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
|
||||
success = UNSAFE.weakCompareAndSwapByte(base, offset, (byte)0x01, (byte)0x23);
|
||||
success = UNSAFE.weakCompareAndSetBytePlain(base, offset, (byte)0x01, (byte)0x23);
|
||||
}
|
||||
assertEquals(success, true, "weakCompareAndSwap byte");
|
||||
assertEquals(success, true, "weakCompareAndSetPlain byte");
|
||||
byte x = UNSAFE.getByte(base, offset);
|
||||
assertEquals(x, (byte)0x23, "weakCompareAndSwap byte value");
|
||||
assertEquals(x, (byte)0x23, "weakCompareAndSetPlain byte value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
|
||||
success = UNSAFE.weakCompareAndSwapByteAcquire(base, offset, (byte)0x23, (byte)0x01);
|
||||
success = UNSAFE.weakCompareAndSetByteAcquire(base, offset, (byte)0x23, (byte)0x01);
|
||||
}
|
||||
assertEquals(success, true, "weakCompareAndSwapAcquire byte");
|
||||
assertEquals(success, true, "weakCompareAndSetAcquire byte");
|
||||
byte x = UNSAFE.getByte(base, offset);
|
||||
assertEquals(x, (byte)0x01, "weakCompareAndSwapAcquire byte");
|
||||
assertEquals(x, (byte)0x01, "weakCompareAndSetAcquire byte");
|
||||
}
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
|
||||
success = UNSAFE.weakCompareAndSwapByteRelease(base, offset, (byte)0x01, (byte)0x23);
|
||||
success = UNSAFE.weakCompareAndSetByteRelease(base, offset, (byte)0x01, (byte)0x23);
|
||||
}
|
||||
assertEquals(success, true, "weakCompareAndSwapRelease byte");
|
||||
assertEquals(success, true, "weakCompareAndSetRelease byte");
|
||||
byte x = UNSAFE.getByte(base, offset);
|
||||
assertEquals(x, (byte)0x23, "weakCompareAndSwapRelease byte");
|
||||
assertEquals(x, (byte)0x23, "weakCompareAndSetRelease byte");
|
||||
}
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
|
||||
success = UNSAFE.weakCompareAndSwapByteVolatile(base, offset, (byte)0x23, (byte)0x01);
|
||||
success = UNSAFE.weakCompareAndSetByte(base, offset, (byte)0x23, (byte)0x01);
|
||||
}
|
||||
assertEquals(success, true, "weakCompareAndSwapVolatile byte");
|
||||
assertEquals(success, true, "weakCompareAndSet byte");
|
||||
byte x = UNSAFE.getByte(base, offset);
|
||||
assertEquals(x, (byte)0x01, "weakCompareAndSwapVolatile byte");
|
||||
assertEquals(x, (byte)0x01, "weakCompareAndSet byte");
|
||||
}
|
||||
|
||||
UNSAFE.putByte(base, offset, (byte)0x23);
|
||||
@ -306,4 +306,3 @@ public class JdkInternalMiscUnsafeAccessTestByte {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2017, 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
|
||||
@ -198,32 +198,32 @@ public class JdkInternalMiscUnsafeAccessTestChar {
|
||||
|
||||
// Compare
|
||||
{
|
||||
boolean r = UNSAFE.compareAndSwapChar(base, offset, '\u0123', '\u4567');
|
||||
assertEquals(r, true, "success compareAndSwap char");
|
||||
boolean r = UNSAFE.compareAndSetChar(base, offset, '\u0123', '\u4567');
|
||||
assertEquals(r, true, "success compareAndSet char");
|
||||
char x = UNSAFE.getChar(base, offset);
|
||||
assertEquals(x, '\u4567', "success compareAndSwap char value");
|
||||
assertEquals(x, '\u4567', "success compareAndSet char value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = UNSAFE.compareAndSwapChar(base, offset, '\u0123', '\u89AB');
|
||||
assertEquals(r, false, "failing compareAndSwap char");
|
||||
boolean r = UNSAFE.compareAndSetChar(base, offset, '\u0123', '\u89AB');
|
||||
assertEquals(r, false, "failing compareAndSet char");
|
||||
char x = UNSAFE.getChar(base, offset);
|
||||
assertEquals(x, '\u4567', "failing compareAndSwap char value");
|
||||
assertEquals(x, '\u4567', "failing compareAndSet char value");
|
||||
}
|
||||
|
||||
// Advanced compare
|
||||
{
|
||||
char r = UNSAFE.compareAndExchangeCharVolatile(base, offset, '\u4567', '\u0123');
|
||||
assertEquals(r, '\u4567', "success compareAndExchangeVolatile char");
|
||||
char r = UNSAFE.compareAndExchangeChar(base, offset, '\u4567', '\u0123');
|
||||
assertEquals(r, '\u4567', "success compareAndExchange char");
|
||||
char x = UNSAFE.getChar(base, offset);
|
||||
assertEquals(x, '\u0123', "success compareAndExchangeVolatile char value");
|
||||
assertEquals(x, '\u0123', "success compareAndExchange char value");
|
||||
}
|
||||
|
||||
{
|
||||
char r = UNSAFE.compareAndExchangeCharVolatile(base, offset, '\u4567', '\u89AB');
|
||||
assertEquals(r, '\u0123', "failing compareAndExchangeVolatile char");
|
||||
char r = UNSAFE.compareAndExchangeChar(base, offset, '\u4567', '\u89AB');
|
||||
assertEquals(r, '\u0123', "failing compareAndExchange char");
|
||||
char x = UNSAFE.getChar(base, offset);
|
||||
assertEquals(x, '\u0123', "failing compareAndExchangeVolatile char value");
|
||||
assertEquals(x, '\u0123', "failing compareAndExchange char value");
|
||||
}
|
||||
|
||||
{
|
||||
@ -257,41 +257,41 @@ public class JdkInternalMiscUnsafeAccessTestChar {
|
||||
{
|
||||
boolean success = false;
|
||||
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
|
||||
success = UNSAFE.weakCompareAndSwapChar(base, offset, '\u0123', '\u4567');
|
||||
success = UNSAFE.weakCompareAndSetCharPlain(base, offset, '\u0123', '\u4567');
|
||||
}
|
||||
assertEquals(success, true, "weakCompareAndSwap char");
|
||||
assertEquals(success, true, "weakCompareAndSetPlain char");
|
||||
char x = UNSAFE.getChar(base, offset);
|
||||
assertEquals(x, '\u4567', "weakCompareAndSwap char value");
|
||||
assertEquals(x, '\u4567', "weakCompareAndSetPlain char value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
|
||||
success = UNSAFE.weakCompareAndSwapCharAcquire(base, offset, '\u4567', '\u0123');
|
||||
success = UNSAFE.weakCompareAndSetCharAcquire(base, offset, '\u4567', '\u0123');
|
||||
}
|
||||
assertEquals(success, true, "weakCompareAndSwapAcquire char");
|
||||
assertEquals(success, true, "weakCompareAndSetAcquire char");
|
||||
char x = UNSAFE.getChar(base, offset);
|
||||
assertEquals(x, '\u0123', "weakCompareAndSwapAcquire char");
|
||||
assertEquals(x, '\u0123', "weakCompareAndSetAcquire char");
|
||||
}
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
|
||||
success = UNSAFE.weakCompareAndSwapCharRelease(base, offset, '\u0123', '\u4567');
|
||||
success = UNSAFE.weakCompareAndSetCharRelease(base, offset, '\u0123', '\u4567');
|
||||
}
|
||||
assertEquals(success, true, "weakCompareAndSwapRelease char");
|
||||
assertEquals(success, true, "weakCompareAndSetRelease char");
|
||||
char x = UNSAFE.getChar(base, offset);
|
||||
assertEquals(x, '\u4567', "weakCompareAndSwapRelease char");
|
||||
assertEquals(x, '\u4567', "weakCompareAndSetRelease char");
|
||||
}
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
|
||||
success = UNSAFE.weakCompareAndSwapCharVolatile(base, offset, '\u4567', '\u0123');
|
||||
success = UNSAFE.weakCompareAndSetChar(base, offset, '\u4567', '\u0123');
|
||||
}
|
||||
assertEquals(success, true, "weakCompareAndSwapVolatile char");
|
||||
assertEquals(success, true, "weakCompareAndSet char");
|
||||
char x = UNSAFE.getChar(base, offset);
|
||||
assertEquals(x, '\u0123', "weakCompareAndSwapVolatile char");
|
||||
assertEquals(x, '\u0123', "weakCompareAndSet char");
|
||||
}
|
||||
|
||||
UNSAFE.putChar(base, offset, '\u4567');
|
||||
@ -324,4 +324,3 @@ public class JdkInternalMiscUnsafeAccessTestChar {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2017, 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
|
||||
@ -180,32 +180,32 @@ public class JdkInternalMiscUnsafeAccessTestDouble {
|
||||
|
||||
// Compare
|
||||
{
|
||||
boolean r = UNSAFE.compareAndSwapDouble(base, offset, 1.0d, 2.0d);
|
||||
assertEquals(r, true, "success compareAndSwap double");
|
||||
boolean r = UNSAFE.compareAndSetDouble(base, offset, 1.0d, 2.0d);
|
||||
assertEquals(r, true, "success compareAndSet double");
|
||||
double x = UNSAFE.getDouble(base, offset);
|
||||
assertEquals(x, 2.0d, "success compareAndSwap double value");
|
||||
assertEquals(x, 2.0d, "success compareAndSet double value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = UNSAFE.compareAndSwapDouble(base, offset, 1.0d, 3.0d);
|
||||
assertEquals(r, false, "failing compareAndSwap double");
|
||||
boolean r = UNSAFE.compareAndSetDouble(base, offset, 1.0d, 3.0d);
|
||||
assertEquals(r, false, "failing compareAndSet double");
|
||||
double x = UNSAFE.getDouble(base, offset);
|
||||
assertEquals(x, 2.0d, "failing compareAndSwap double value");
|
||||
assertEquals(x, 2.0d, "failing compareAndSet double value");
|
||||
}
|
||||
|
||||
// Advanced compare
|
||||
{
|
||||
double r = UNSAFE.compareAndExchangeDoubleVolatile(base, offset, 2.0d, 1.0d);
|
||||
assertEquals(r, 2.0d, "success compareAndExchangeVolatile double");
|
||||
double r = UNSAFE.compareAndExchangeDouble(base, offset, 2.0d, 1.0d);
|
||||
assertEquals(r, 2.0d, "success compareAndExchange double");
|
||||
double x = UNSAFE.getDouble(base, offset);
|
||||
assertEquals(x, 1.0d, "success compareAndExchangeVolatile double value");
|
||||
assertEquals(x, 1.0d, "success compareAndExchange double value");
|
||||
}
|
||||
|
||||
{
|
||||
double r = UNSAFE.compareAndExchangeDoubleVolatile(base, offset, 2.0d, 3.0d);
|
||||
assertEquals(r, 1.0d, "failing compareAndExchangeVolatile double");
|
||||
double r = UNSAFE.compareAndExchangeDouble(base, offset, 2.0d, 3.0d);
|
||||
assertEquals(r, 1.0d, "failing compareAndExchange double");
|
||||
double x = UNSAFE.getDouble(base, offset);
|
||||
assertEquals(x, 1.0d, "failing compareAndExchangeVolatile double value");
|
||||
assertEquals(x, 1.0d, "failing compareAndExchange double value");
|
||||
}
|
||||
|
||||
{
|
||||
@ -239,41 +239,41 @@ public class JdkInternalMiscUnsafeAccessTestDouble {
|
||||
{
|
||||
boolean success = false;
|
||||
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
|
||||
success = UNSAFE.weakCompareAndSwapDouble(base, offset, 1.0d, 2.0d);
|
||||
success = UNSAFE.weakCompareAndSetDoublePlain(base, offset, 1.0d, 2.0d);
|
||||
}
|
||||
assertEquals(success, true, "weakCompareAndSwap double");
|
||||
assertEquals(success, true, "weakCompareAndSetPlain double");
|
||||
double x = UNSAFE.getDouble(base, offset);
|
||||
assertEquals(x, 2.0d, "weakCompareAndSwap double value");
|
||||
assertEquals(x, 2.0d, "weakCompareAndSetPlain double value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
|
||||
success = UNSAFE.weakCompareAndSwapDoubleAcquire(base, offset, 2.0d, 1.0d);
|
||||
success = UNSAFE.weakCompareAndSetDoubleAcquire(base, offset, 2.0d, 1.0d);
|
||||
}
|
||||
assertEquals(success, true, "weakCompareAndSwapAcquire double");
|
||||
assertEquals(success, true, "weakCompareAndSetAcquire double");
|
||||
double x = UNSAFE.getDouble(base, offset);
|
||||
assertEquals(x, 1.0d, "weakCompareAndSwapAcquire double");
|
||||
assertEquals(x, 1.0d, "weakCompareAndSetAcquire double");
|
||||
}
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
|
||||
success = UNSAFE.weakCompareAndSwapDoubleRelease(base, offset, 1.0d, 2.0d);
|
||||
success = UNSAFE.weakCompareAndSetDoubleRelease(base, offset, 1.0d, 2.0d);
|
||||
}
|
||||
assertEquals(success, true, "weakCompareAndSwapRelease double");
|
||||
assertEquals(success, true, "weakCompareAndSetRelease double");
|
||||
double x = UNSAFE.getDouble(base, offset);
|
||||
assertEquals(x, 2.0d, "weakCompareAndSwapRelease double");
|
||||
assertEquals(x, 2.0d, "weakCompareAndSetRelease double");
|
||||
}
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
|
||||
success = UNSAFE.weakCompareAndSwapDoubleVolatile(base, offset, 2.0d, 1.0d);
|
||||
success = UNSAFE.weakCompareAndSetDouble(base, offset, 2.0d, 1.0d);
|
||||
}
|
||||
assertEquals(success, true, "weakCompareAndSwapVolatile double");
|
||||
assertEquals(success, true, "weakCompareAndSet double");
|
||||
double x = UNSAFE.getDouble(base, offset);
|
||||
assertEquals(x, 1.0d, "weakCompareAndSwapVolatile double");
|
||||
assertEquals(x, 1.0d, "weakCompareAndSet double");
|
||||
}
|
||||
|
||||
UNSAFE.putDouble(base, offset, 2.0d);
|
||||
@ -306,4 +306,3 @@ public class JdkInternalMiscUnsafeAccessTestDouble {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2017, 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
|
||||
@ -180,32 +180,32 @@ public class JdkInternalMiscUnsafeAccessTestFloat {
|
||||
|
||||
// Compare
|
||||
{
|
||||
boolean r = UNSAFE.compareAndSwapFloat(base, offset, 1.0f, 2.0f);
|
||||
assertEquals(r, true, "success compareAndSwap float");
|
||||
boolean r = UNSAFE.compareAndSetFloat(base, offset, 1.0f, 2.0f);
|
||||
assertEquals(r, true, "success compareAndSet float");
|
||||
float x = UNSAFE.getFloat(base, offset);
|
||||
assertEquals(x, 2.0f, "success compareAndSwap float value");
|
||||
assertEquals(x, 2.0f, "success compareAndSet float value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = UNSAFE.compareAndSwapFloat(base, offset, 1.0f, 3.0f);
|
||||
assertEquals(r, false, "failing compareAndSwap float");
|
||||
boolean r = UNSAFE.compareAndSetFloat(base, offset, 1.0f, 3.0f);
|
||||
assertEquals(r, false, "failing compareAndSet float");
|
||||
float x = UNSAFE.getFloat(base, offset);
|
||||
assertEquals(x, 2.0f, "failing compareAndSwap float value");
|
||||
assertEquals(x, 2.0f, "failing compareAndSet float value");
|
||||
}
|
||||
|
||||
// Advanced compare
|
||||
{
|
||||
float r = UNSAFE.compareAndExchangeFloatVolatile(base, offset, 2.0f, 1.0f);
|
||||
assertEquals(r, 2.0f, "success compareAndExchangeVolatile float");
|
||||
float r = UNSAFE.compareAndExchangeFloat(base, offset, 2.0f, 1.0f);
|
||||
assertEquals(r, 2.0f, "success compareAndExchange float");
|
||||
float x = UNSAFE.getFloat(base, offset);
|
||||
assertEquals(x, 1.0f, "success compareAndExchangeVolatile float value");
|
||||
assertEquals(x, 1.0f, "success compareAndExchange float value");
|
||||
}
|
||||
|
||||
{
|
||||
float r = UNSAFE.compareAndExchangeFloatVolatile(base, offset, 2.0f, 3.0f);
|
||||
assertEquals(r, 1.0f, "failing compareAndExchangeVolatile float");
|
||||
float r = UNSAFE.compareAndExchangeFloat(base, offset, 2.0f, 3.0f);
|
||||
assertEquals(r, 1.0f, "failing compareAndExchange float");
|
||||
float x = UNSAFE.getFloat(base, offset);
|
||||
assertEquals(x, 1.0f, "failing compareAndExchangeVolatile float value");
|
||||
assertEquals(x, 1.0f, "failing compareAndExchange float value");
|
||||
}
|
||||
|
||||
{
|
||||
@ -239,41 +239,41 @@ public class JdkInternalMiscUnsafeAccessTestFloat {
|
||||
{
|
||||
boolean success = false;
|
||||
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
|
||||
success = UNSAFE.weakCompareAndSwapFloat(base, offset, 1.0f, 2.0f);
|
||||
success = UNSAFE.weakCompareAndSetFloatPlain(base, offset, 1.0f, 2.0f);
|
||||
}
|
||||
assertEquals(success, true, "weakCompareAndSwap float");
|
||||
assertEquals(success, true, "weakCompareAndSetPlain float");
|
||||
float x = UNSAFE.getFloat(base, offset);
|
||||
assertEquals(x, 2.0f, "weakCompareAndSwap float value");
|
||||
assertEquals(x, 2.0f, "weakCompareAndSetPlain float value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
|
||||
success = UNSAFE.weakCompareAndSwapFloatAcquire(base, offset, 2.0f, 1.0f);
|
||||
success = UNSAFE.weakCompareAndSetFloatAcquire(base, offset, 2.0f, 1.0f);
|
||||
}
|
||||
assertEquals(success, true, "weakCompareAndSwapAcquire float");
|
||||
assertEquals(success, true, "weakCompareAndSetAcquire float");
|
||||
float x = UNSAFE.getFloat(base, offset);
|
||||
assertEquals(x, 1.0f, "weakCompareAndSwapAcquire float");
|
||||
assertEquals(x, 1.0f, "weakCompareAndSetAcquire float");
|
||||
}
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
|
||||
success = UNSAFE.weakCompareAndSwapFloatRelease(base, offset, 1.0f, 2.0f);
|
||||
success = UNSAFE.weakCompareAndSetFloatRelease(base, offset, 1.0f, 2.0f);
|
||||
}
|
||||
assertEquals(success, true, "weakCompareAndSwapRelease float");
|
||||
assertEquals(success, true, "weakCompareAndSetRelease float");
|
||||
float x = UNSAFE.getFloat(base, offset);
|
||||
assertEquals(x, 2.0f, "weakCompareAndSwapRelease float");
|
||||
assertEquals(x, 2.0f, "weakCompareAndSetRelease float");
|
||||
}
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
|
||||
success = UNSAFE.weakCompareAndSwapFloatVolatile(base, offset, 2.0f, 1.0f);
|
||||
success = UNSAFE.weakCompareAndSetFloat(base, offset, 2.0f, 1.0f);
|
||||
}
|
||||
assertEquals(success, true, "weakCompareAndSwapVolatile float");
|
||||
assertEquals(success, true, "weakCompareAndSet float");
|
||||
float x = UNSAFE.getFloat(base, offset);
|
||||
assertEquals(x, 1.0f, "weakCompareAndSwapVolatile float");
|
||||
assertEquals(x, 1.0f, "weakCompareAndSet float");
|
||||
}
|
||||
|
||||
UNSAFE.putFloat(base, offset, 2.0f);
|
||||
@ -306,4 +306,3 @@ public class JdkInternalMiscUnsafeAccessTestFloat {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2017, 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
|
||||
@ -198,32 +198,32 @@ public class JdkInternalMiscUnsafeAccessTestInt {
|
||||
|
||||
// Compare
|
||||
{
|
||||
boolean r = UNSAFE.compareAndSwapInt(base, offset, 0x01234567, 0x89ABCDEF);
|
||||
assertEquals(r, true, "success compareAndSwap int");
|
||||
boolean r = UNSAFE.compareAndSetInt(base, offset, 0x01234567, 0x89ABCDEF);
|
||||
assertEquals(r, true, "success compareAndSet int");
|
||||
int x = UNSAFE.getInt(base, offset);
|
||||
assertEquals(x, 0x89ABCDEF, "success compareAndSwap int value");
|
||||
assertEquals(x, 0x89ABCDEF, "success compareAndSet int value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = UNSAFE.compareAndSwapInt(base, offset, 0x01234567, 0xCAFEBABE);
|
||||
assertEquals(r, false, "failing compareAndSwap int");
|
||||
boolean r = UNSAFE.compareAndSetInt(base, offset, 0x01234567, 0xCAFEBABE);
|
||||
assertEquals(r, false, "failing compareAndSet int");
|
||||
int x = UNSAFE.getInt(base, offset);
|
||||
assertEquals(x, 0x89ABCDEF, "failing compareAndSwap int value");
|
||||
assertEquals(x, 0x89ABCDEF, "failing compareAndSet int value");
|
||||
}
|
||||
|
||||
// Advanced compare
|
||||
{
|
||||
int r = UNSAFE.compareAndExchangeIntVolatile(base, offset, 0x89ABCDEF, 0x01234567);
|
||||
assertEquals(r, 0x89ABCDEF, "success compareAndExchangeVolatile int");
|
||||
int r = UNSAFE.compareAndExchangeInt(base, offset, 0x89ABCDEF, 0x01234567);
|
||||
assertEquals(r, 0x89ABCDEF, "success compareAndExchange int");
|
||||
int x = UNSAFE.getInt(base, offset);
|
||||
assertEquals(x, 0x01234567, "success compareAndExchangeVolatile int value");
|
||||
assertEquals(x, 0x01234567, "success compareAndExchange int value");
|
||||
}
|
||||
|
||||
{
|
||||
int r = UNSAFE.compareAndExchangeIntVolatile(base, offset, 0x89ABCDEF, 0xCAFEBABE);
|
||||
assertEquals(r, 0x01234567, "failing compareAndExchangeVolatile int");
|
||||
int r = UNSAFE.compareAndExchangeInt(base, offset, 0x89ABCDEF, 0xCAFEBABE);
|
||||
assertEquals(r, 0x01234567, "failing compareAndExchange int");
|
||||
int x = UNSAFE.getInt(base, offset);
|
||||
assertEquals(x, 0x01234567, "failing compareAndExchangeVolatile int value");
|
||||
assertEquals(x, 0x01234567, "failing compareAndExchange int value");
|
||||
}
|
||||
|
||||
{
|
||||
@ -257,41 +257,41 @@ public class JdkInternalMiscUnsafeAccessTestInt {
|
||||
{
|
||||
boolean success = false;
|
||||
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
|
||||
success = UNSAFE.weakCompareAndSwapInt(base, offset, 0x01234567, 0x89ABCDEF);
|
||||
success = UNSAFE.weakCompareAndSetIntPlain(base, offset, 0x01234567, 0x89ABCDEF);
|
||||
}
|
||||
assertEquals(success, true, "weakCompareAndSwap int");
|
||||
assertEquals(success, true, "weakCompareAndSetPlain int");
|
||||
int x = UNSAFE.getInt(base, offset);
|
||||
assertEquals(x, 0x89ABCDEF, "weakCompareAndSwap int value");
|
||||
assertEquals(x, 0x89ABCDEF, "weakCompareAndSetPlain int value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
|
||||
success = UNSAFE.weakCompareAndSwapIntAcquire(base, offset, 0x89ABCDEF, 0x01234567);
|
||||
success = UNSAFE.weakCompareAndSetIntAcquire(base, offset, 0x89ABCDEF, 0x01234567);
|
||||
}
|
||||
assertEquals(success, true, "weakCompareAndSwapAcquire int");
|
||||
assertEquals(success, true, "weakCompareAndSetAcquire int");
|
||||
int x = UNSAFE.getInt(base, offset);
|
||||
assertEquals(x, 0x01234567, "weakCompareAndSwapAcquire int");
|
||||
assertEquals(x, 0x01234567, "weakCompareAndSetAcquire int");
|
||||
}
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
|
||||
success = UNSAFE.weakCompareAndSwapIntRelease(base, offset, 0x01234567, 0x89ABCDEF);
|
||||
success = UNSAFE.weakCompareAndSetIntRelease(base, offset, 0x01234567, 0x89ABCDEF);
|
||||
}
|
||||
assertEquals(success, true, "weakCompareAndSwapRelease int");
|
||||
assertEquals(success, true, "weakCompareAndSetRelease int");
|
||||
int x = UNSAFE.getInt(base, offset);
|
||||
assertEquals(x, 0x89ABCDEF, "weakCompareAndSwapRelease int");
|
||||
assertEquals(x, 0x89ABCDEF, "weakCompareAndSetRelease int");
|
||||
}
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
|
||||
success = UNSAFE.weakCompareAndSwapIntVolatile(base, offset, 0x89ABCDEF, 0x01234567);
|
||||
success = UNSAFE.weakCompareAndSetInt(base, offset, 0x89ABCDEF, 0x01234567);
|
||||
}
|
||||
assertEquals(success, true, "weakCompareAndSwapVolatile int");
|
||||
assertEquals(success, true, "weakCompareAndSet int");
|
||||
int x = UNSAFE.getInt(base, offset);
|
||||
assertEquals(x, 0x01234567, "weakCompareAndSwapVolatile int");
|
||||
assertEquals(x, 0x01234567, "weakCompareAndSet int");
|
||||
}
|
||||
|
||||
UNSAFE.putInt(base, offset, 0x89ABCDEF);
|
||||
@ -324,4 +324,3 @@ public class JdkInternalMiscUnsafeAccessTestInt {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2017, 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
|
||||
@ -198,32 +198,32 @@ public class JdkInternalMiscUnsafeAccessTestLong {
|
||||
|
||||
// Compare
|
||||
{
|
||||
boolean r = UNSAFE.compareAndSwapLong(base, offset, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(r, true, "success compareAndSwap long");
|
||||
boolean r = UNSAFE.compareAndSetLong(base, offset, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL);
|
||||
assertEquals(r, true, "success compareAndSet long");
|
||||
long x = UNSAFE.getLong(base, offset);
|
||||
assertEquals(x, 0xCAFEBABECAFEBABEL, "success compareAndSwap long value");
|
||||
assertEquals(x, 0xCAFEBABECAFEBABEL, "success compareAndSet long value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = UNSAFE.compareAndSwapLong(base, offset, 0x0123456789ABCDEFL, 0xDEADBEEFDEADBEEFL);
|
||||
assertEquals(r, false, "failing compareAndSwap long");
|
||||
boolean r = UNSAFE.compareAndSetLong(base, offset, 0x0123456789ABCDEFL, 0xDEADBEEFDEADBEEFL);
|
||||
assertEquals(r, false, "failing compareAndSet long");
|
||||
long x = UNSAFE.getLong(base, offset);
|
||||
assertEquals(x, 0xCAFEBABECAFEBABEL, "failing compareAndSwap long value");
|
||||
assertEquals(x, 0xCAFEBABECAFEBABEL, "failing compareAndSet long value");
|
||||
}
|
||||
|
||||
// Advanced compare
|
||||
{
|
||||
long r = UNSAFE.compareAndExchangeLongVolatile(base, offset, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL);
|
||||
assertEquals(r, 0xCAFEBABECAFEBABEL, "success compareAndExchangeVolatile long");
|
||||
long r = UNSAFE.compareAndExchangeLong(base, offset, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL);
|
||||
assertEquals(r, 0xCAFEBABECAFEBABEL, "success compareAndExchange long");
|
||||
long x = UNSAFE.getLong(base, offset);
|
||||
assertEquals(x, 0x0123456789ABCDEFL, "success compareAndExchangeVolatile long value");
|
||||
assertEquals(x, 0x0123456789ABCDEFL, "success compareAndExchange long value");
|
||||
}
|
||||
|
||||
{
|
||||
long r = UNSAFE.compareAndExchangeLongVolatile(base, offset, 0xCAFEBABECAFEBABEL, 0xDEADBEEFDEADBEEFL);
|
||||
assertEquals(r, 0x0123456789ABCDEFL, "failing compareAndExchangeVolatile long");
|
||||
long r = UNSAFE.compareAndExchangeLong(base, offset, 0xCAFEBABECAFEBABEL, 0xDEADBEEFDEADBEEFL);
|
||||
assertEquals(r, 0x0123456789ABCDEFL, "failing compareAndExchange long");
|
||||
long x = UNSAFE.getLong(base, offset);
|
||||
assertEquals(x, 0x0123456789ABCDEFL, "failing compareAndExchangeVolatile long value");
|
||||
assertEquals(x, 0x0123456789ABCDEFL, "failing compareAndExchange long value");
|
||||
}
|
||||
|
||||
{
|
||||
@ -257,41 +257,41 @@ public class JdkInternalMiscUnsafeAccessTestLong {
|
||||
{
|
||||
boolean success = false;
|
||||
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
|
||||
success = UNSAFE.weakCompareAndSwapLong(base, offset, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL);
|
||||
success = UNSAFE.weakCompareAndSetLongPlain(base, offset, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL);
|
||||
}
|
||||
assertEquals(success, true, "weakCompareAndSwap long");
|
||||
assertEquals(success, true, "weakCompareAndSetPlain long");
|
||||
long x = UNSAFE.getLong(base, offset);
|
||||
assertEquals(x, 0xCAFEBABECAFEBABEL, "weakCompareAndSwap long value");
|
||||
assertEquals(x, 0xCAFEBABECAFEBABEL, "weakCompareAndSetPlain long value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
|
||||
success = UNSAFE.weakCompareAndSwapLongAcquire(base, offset, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL);
|
||||
success = UNSAFE.weakCompareAndSetLongAcquire(base, offset, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL);
|
||||
}
|
||||
assertEquals(success, true, "weakCompareAndSwapAcquire long");
|
||||
assertEquals(success, true, "weakCompareAndSetAcquire long");
|
||||
long x = UNSAFE.getLong(base, offset);
|
||||
assertEquals(x, 0x0123456789ABCDEFL, "weakCompareAndSwapAcquire long");
|
||||
assertEquals(x, 0x0123456789ABCDEFL, "weakCompareAndSetAcquire long");
|
||||
}
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
|
||||
success = UNSAFE.weakCompareAndSwapLongRelease(base, offset, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL);
|
||||
success = UNSAFE.weakCompareAndSetLongRelease(base, offset, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL);
|
||||
}
|
||||
assertEquals(success, true, "weakCompareAndSwapRelease long");
|
||||
assertEquals(success, true, "weakCompareAndSetRelease long");
|
||||
long x = UNSAFE.getLong(base, offset);
|
||||
assertEquals(x, 0xCAFEBABECAFEBABEL, "weakCompareAndSwapRelease long");
|
||||
assertEquals(x, 0xCAFEBABECAFEBABEL, "weakCompareAndSetRelease long");
|
||||
}
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
|
||||
success = UNSAFE.weakCompareAndSwapLongVolatile(base, offset, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL);
|
||||
success = UNSAFE.weakCompareAndSetLong(base, offset, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL);
|
||||
}
|
||||
assertEquals(success, true, "weakCompareAndSwapVolatile long");
|
||||
assertEquals(success, true, "weakCompareAndSet long");
|
||||
long x = UNSAFE.getLong(base, offset);
|
||||
assertEquals(x, 0x0123456789ABCDEFL, "weakCompareAndSwapVolatile long");
|
||||
assertEquals(x, 0x0123456789ABCDEFL, "weakCompareAndSet long");
|
||||
}
|
||||
|
||||
UNSAFE.putLong(base, offset, 0xCAFEBABECAFEBABEL);
|
||||
@ -324,4 +324,3 @@ public class JdkInternalMiscUnsafeAccessTestLong {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2017, 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
|
||||
@ -151,32 +151,32 @@ public class JdkInternalMiscUnsafeAccessTestObject {
|
||||
|
||||
// Compare
|
||||
{
|
||||
boolean r = UNSAFE.compareAndSwapObject(base, offset, "foo", "bar");
|
||||
assertEquals(r, true, "success compareAndSwap Object");
|
||||
boolean r = UNSAFE.compareAndSetObject(base, offset, "foo", "bar");
|
||||
assertEquals(r, true, "success compareAndSet Object");
|
||||
Object x = UNSAFE.getObject(base, offset);
|
||||
assertEquals(x, "bar", "success compareAndSwap Object value");
|
||||
assertEquals(x, "bar", "success compareAndSet Object value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = UNSAFE.compareAndSwapObject(base, offset, "foo", "baz");
|
||||
assertEquals(r, false, "failing compareAndSwap Object");
|
||||
boolean r = UNSAFE.compareAndSetObject(base, offset, "foo", "baz");
|
||||
assertEquals(r, false, "failing compareAndSet Object");
|
||||
Object x = UNSAFE.getObject(base, offset);
|
||||
assertEquals(x, "bar", "failing compareAndSwap Object value");
|
||||
assertEquals(x, "bar", "failing compareAndSet Object value");
|
||||
}
|
||||
|
||||
// Advanced compare
|
||||
{
|
||||
Object r = UNSAFE.compareAndExchangeObjectVolatile(base, offset, "bar", "foo");
|
||||
assertEquals(r, "bar", "success compareAndExchangeVolatile Object");
|
||||
Object r = UNSAFE.compareAndExchangeObject(base, offset, "bar", "foo");
|
||||
assertEquals(r, "bar", "success compareAndExchange Object");
|
||||
Object x = UNSAFE.getObject(base, offset);
|
||||
assertEquals(x, "foo", "success compareAndExchangeVolatile Object value");
|
||||
assertEquals(x, "foo", "success compareAndExchange Object value");
|
||||
}
|
||||
|
||||
{
|
||||
Object r = UNSAFE.compareAndExchangeObjectVolatile(base, offset, "bar", "baz");
|
||||
assertEquals(r, "foo", "failing compareAndExchangeVolatile Object");
|
||||
Object r = UNSAFE.compareAndExchangeObject(base, offset, "bar", "baz");
|
||||
assertEquals(r, "foo", "failing compareAndExchange Object");
|
||||
Object x = UNSAFE.getObject(base, offset);
|
||||
assertEquals(x, "foo", "failing compareAndExchangeVolatile Object value");
|
||||
assertEquals(x, "foo", "failing compareAndExchange Object value");
|
||||
}
|
||||
|
||||
{
|
||||
@ -210,41 +210,41 @@ public class JdkInternalMiscUnsafeAccessTestObject {
|
||||
{
|
||||
boolean success = false;
|
||||
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
|
||||
success = UNSAFE.weakCompareAndSwapObject(base, offset, "foo", "bar");
|
||||
success = UNSAFE.weakCompareAndSetObjectPlain(base, offset, "foo", "bar");
|
||||
}
|
||||
assertEquals(success, true, "weakCompareAndSwap Object");
|
||||
assertEquals(success, true, "weakCompareAndSetPlain Object");
|
||||
Object x = UNSAFE.getObject(base, offset);
|
||||
assertEquals(x, "bar", "weakCompareAndSwap Object value");
|
||||
assertEquals(x, "bar", "weakCompareAndSetPlain Object value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
|
||||
success = UNSAFE.weakCompareAndSwapObjectAcquire(base, offset, "bar", "foo");
|
||||
success = UNSAFE.weakCompareAndSetObjectAcquire(base, offset, "bar", "foo");
|
||||
}
|
||||
assertEquals(success, true, "weakCompareAndSwapAcquire Object");
|
||||
assertEquals(success, true, "weakCompareAndSetAcquire Object");
|
||||
Object x = UNSAFE.getObject(base, offset);
|
||||
assertEquals(x, "foo", "weakCompareAndSwapAcquire Object");
|
||||
assertEquals(x, "foo", "weakCompareAndSetAcquire Object");
|
||||
}
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
|
||||
success = UNSAFE.weakCompareAndSwapObjectRelease(base, offset, "foo", "bar");
|
||||
success = UNSAFE.weakCompareAndSetObjectRelease(base, offset, "foo", "bar");
|
||||
}
|
||||
assertEquals(success, true, "weakCompareAndSwapRelease Object");
|
||||
assertEquals(success, true, "weakCompareAndSetRelease Object");
|
||||
Object x = UNSAFE.getObject(base, offset);
|
||||
assertEquals(x, "bar", "weakCompareAndSwapRelease Object");
|
||||
assertEquals(x, "bar", "weakCompareAndSetRelease Object");
|
||||
}
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
|
||||
success = UNSAFE.weakCompareAndSwapObjectVolatile(base, offset, "bar", "foo");
|
||||
success = UNSAFE.weakCompareAndSetObject(base, offset, "bar", "foo");
|
||||
}
|
||||
assertEquals(success, true, "weakCompareAndSwapVolatile Object");
|
||||
assertEquals(success, true, "weakCompareAndSet Object");
|
||||
Object x = UNSAFE.getObject(base, offset);
|
||||
assertEquals(x, "foo", "weakCompareAndSwapVolatile Object");
|
||||
assertEquals(x, "foo", "weakCompareAndSet Object");
|
||||
}
|
||||
|
||||
UNSAFE.putObject(base, offset, "bar");
|
||||
@ -260,4 +260,3 @@ public class JdkInternalMiscUnsafeAccessTestObject {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2017, 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
|
||||
@ -198,32 +198,32 @@ public class JdkInternalMiscUnsafeAccessTestShort {
|
||||
|
||||
// Compare
|
||||
{
|
||||
boolean r = UNSAFE.compareAndSwapShort(base, offset, (short)0x0123, (short)0x4567);
|
||||
assertEquals(r, true, "success compareAndSwap short");
|
||||
boolean r = UNSAFE.compareAndSetShort(base, offset, (short)0x0123, (short)0x4567);
|
||||
assertEquals(r, true, "success compareAndSet short");
|
||||
short x = UNSAFE.getShort(base, offset);
|
||||
assertEquals(x, (short)0x4567, "success compareAndSwap short value");
|
||||
assertEquals(x, (short)0x4567, "success compareAndSet short value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean r = UNSAFE.compareAndSwapShort(base, offset, (short)0x0123, (short)0x89AB);
|
||||
assertEquals(r, false, "failing compareAndSwap short");
|
||||
boolean r = UNSAFE.compareAndSetShort(base, offset, (short)0x0123, (short)0x89AB);
|
||||
assertEquals(r, false, "failing compareAndSet short");
|
||||
short x = UNSAFE.getShort(base, offset);
|
||||
assertEquals(x, (short)0x4567, "failing compareAndSwap short value");
|
||||
assertEquals(x, (short)0x4567, "failing compareAndSet short value");
|
||||
}
|
||||
|
||||
// Advanced compare
|
||||
{
|
||||
short r = UNSAFE.compareAndExchangeShortVolatile(base, offset, (short)0x4567, (short)0x0123);
|
||||
assertEquals(r, (short)0x4567, "success compareAndExchangeVolatile short");
|
||||
short r = UNSAFE.compareAndExchangeShort(base, offset, (short)0x4567, (short)0x0123);
|
||||
assertEquals(r, (short)0x4567, "success compareAndExchange short");
|
||||
short x = UNSAFE.getShort(base, offset);
|
||||
assertEquals(x, (short)0x0123, "success compareAndExchangeVolatile short value");
|
||||
assertEquals(x, (short)0x0123, "success compareAndExchange short value");
|
||||
}
|
||||
|
||||
{
|
||||
short r = UNSAFE.compareAndExchangeShortVolatile(base, offset, (short)0x4567, (short)0x89AB);
|
||||
assertEquals(r, (short)0x0123, "failing compareAndExchangeVolatile short");
|
||||
short r = UNSAFE.compareAndExchangeShort(base, offset, (short)0x4567, (short)0x89AB);
|
||||
assertEquals(r, (short)0x0123, "failing compareAndExchange short");
|
||||
short x = UNSAFE.getShort(base, offset);
|
||||
assertEquals(x, (short)0x0123, "failing compareAndExchangeVolatile short value");
|
||||
assertEquals(x, (short)0x0123, "failing compareAndExchange short value");
|
||||
}
|
||||
|
||||
{
|
||||
@ -257,41 +257,41 @@ public class JdkInternalMiscUnsafeAccessTestShort {
|
||||
{
|
||||
boolean success = false;
|
||||
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
|
||||
success = UNSAFE.weakCompareAndSwapShort(base, offset, (short)0x0123, (short)0x4567);
|
||||
success = UNSAFE.weakCompareAndSetShortPlain(base, offset, (short)0x0123, (short)0x4567);
|
||||
}
|
||||
assertEquals(success, true, "weakCompareAndSwap short");
|
||||
assertEquals(success, true, "weakCompareAndSetPlain short");
|
||||
short x = UNSAFE.getShort(base, offset);
|
||||
assertEquals(x, (short)0x4567, "weakCompareAndSwap short value");
|
||||
assertEquals(x, (short)0x4567, "weakCompareAndSetPlain short value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
|
||||
success = UNSAFE.weakCompareAndSwapShortAcquire(base, offset, (short)0x4567, (short)0x0123);
|
||||
success = UNSAFE.weakCompareAndSetShortAcquire(base, offset, (short)0x4567, (short)0x0123);
|
||||
}
|
||||
assertEquals(success, true, "weakCompareAndSwapAcquire short");
|
||||
assertEquals(success, true, "weakCompareAndSetAcquire short");
|
||||
short x = UNSAFE.getShort(base, offset);
|
||||
assertEquals(x, (short)0x0123, "weakCompareAndSwapAcquire short");
|
||||
assertEquals(x, (short)0x0123, "weakCompareAndSetAcquire short");
|
||||
}
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
|
||||
success = UNSAFE.weakCompareAndSwapShortRelease(base, offset, (short)0x0123, (short)0x4567);
|
||||
success = UNSAFE.weakCompareAndSetShortRelease(base, offset, (short)0x0123, (short)0x4567);
|
||||
}
|
||||
assertEquals(success, true, "weakCompareAndSwapRelease short");
|
||||
assertEquals(success, true, "weakCompareAndSetRelease short");
|
||||
short x = UNSAFE.getShort(base, offset);
|
||||
assertEquals(x, (short)0x4567, "weakCompareAndSwapRelease short");
|
||||
assertEquals(x, (short)0x4567, "weakCompareAndSetRelease short");
|
||||
}
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
|
||||
success = UNSAFE.weakCompareAndSwapShortVolatile(base, offset, (short)0x4567, (short)0x0123);
|
||||
success = UNSAFE.weakCompareAndSetShort(base, offset, (short)0x4567, (short)0x0123);
|
||||
}
|
||||
assertEquals(success, true, "weakCompareAndSwapVolatile short");
|
||||
assertEquals(success, true, "weakCompareAndSet short");
|
||||
short x = UNSAFE.getShort(base, offset);
|
||||
assertEquals(x, (short)0x0123, "weakCompareAndSwapVolatile short");
|
||||
assertEquals(x, (short)0x0123, "weakCompareAndSet short");
|
||||
}
|
||||
|
||||
UNSAFE.putShort(base, offset, (short)0x4567);
|
||||
@ -324,4 +324,3 @@ public class JdkInternalMiscUnsafeAccessTestShort {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2017, 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
|
||||
@ -138,4 +138,3 @@ public class SunMiscUnsafeAccessTestBoolean {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2017, 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
|
||||
@ -175,4 +175,3 @@ public class SunMiscUnsafeAccessTestByte {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2017, 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
|
||||
@ -175,4 +175,3 @@ public class SunMiscUnsafeAccessTestChar {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2017, 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
|
||||
@ -175,4 +175,3 @@ public class SunMiscUnsafeAccessTestDouble {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2017, 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
|
||||
@ -175,4 +175,3 @@ public class SunMiscUnsafeAccessTestFloat {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2017, 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
|
||||
@ -216,4 +216,3 @@ public class SunMiscUnsafeAccessTestInt {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2017, 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
|
||||
@ -216,4 +216,3 @@ public class SunMiscUnsafeAccessTestLong {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2017, 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
|
||||
@ -170,4 +170,3 @@ public class SunMiscUnsafeAccessTestObject {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2017, 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
|
||||
@ -175,4 +175,3 @@ public class SunMiscUnsafeAccessTestShort {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2017, 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
|
||||
@ -26,7 +26,11 @@
|
||||
* @bug 8143628
|
||||
* @summary Test unsafe access for $type$
|
||||
*
|
||||
#if[JdkInternalMisc]
|
||||
* @modules $module$/$package$:+open
|
||||
#else[JdkInternalMisc]
|
||||
* @modules $module$/$package$
|
||||
#end[JdkInternalMisc]
|
||||
* @run testng/othervm -Diters=100 -Xint compiler.unsafe.$Qualifier$UnsafeAccessTest$Type$
|
||||
* @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 compiler.unsafe.$Qualifier$UnsafeAccessTest$Type$
|
||||
* @run testng/othervm -Diters=20000 -XX:-TieredCompilation compiler.unsafe.$Qualifier$UnsafeAccessTest$Type$
|
||||
@ -219,33 +223,51 @@ public class $Qualifier$UnsafeAccessTest$Type$ {
|
||||
|
||||
// Compare
|
||||
{
|
||||
#if[JdkInternalMisc]
|
||||
boolean r = UNSAFE.compareAndSet$Type$(base, offset, $value1$, $value2$);
|
||||
assertEquals(r, true, "success compareAndSet $type$");
|
||||
#else[JdkInternalMisc]
|
||||
boolean r = UNSAFE.compareAndSwap$Type$(base, offset, $value1$, $value2$);
|
||||
assertEquals(r, true, "success compareAndSwap $type$");
|
||||
#end[JdkInternalMisc]
|
||||
$type$ x = UNSAFE.get$Type$(base, offset);
|
||||
#if[JdkInternalMisc]
|
||||
assertEquals(x, $value2$, "success compareAndSet $type$ value");
|
||||
#else[JdkInternalMisc]
|
||||
assertEquals(x, $value2$, "success compareAndSwap $type$ value");
|
||||
#end[JdkInternalMisc]
|
||||
}
|
||||
|
||||
{
|
||||
#if[JdkInternalMisc]
|
||||
boolean r = UNSAFE.compareAndSet$Type$(base, offset, $value1$, $value3$);
|
||||
assertEquals(r, false, "failing compareAndSet $type$");
|
||||
#else[JdkInternalMisc]
|
||||
boolean r = UNSAFE.compareAndSwap$Type$(base, offset, $value1$, $value3$);
|
||||
assertEquals(r, false, "failing compareAndSwap $type$");
|
||||
#end[JdkInternalMisc]
|
||||
$type$ x = UNSAFE.get$Type$(base, offset);
|
||||
#if[JdkInternalMisc]
|
||||
assertEquals(x, $value2$, "failing compareAndSet $type$ value");
|
||||
#else[JdkInternalMisc]
|
||||
assertEquals(x, $value2$, "failing compareAndSwap $type$ value");
|
||||
#end[JdkInternalMisc]
|
||||
}
|
||||
|
||||
#if[JdkInternalMisc]
|
||||
// Advanced compare
|
||||
{
|
||||
$type$ r = UNSAFE.compareAndExchange$Type$Volatile(base, offset, $value2$, $value1$);
|
||||
assertEquals(r, $value2$, "success compareAndExchangeVolatile $type$");
|
||||
$type$ r = UNSAFE.compareAndExchange$Type$(base, offset, $value2$, $value1$);
|
||||
assertEquals(r, $value2$, "success compareAndExchange $type$");
|
||||
$type$ x = UNSAFE.get$Type$(base, offset);
|
||||
assertEquals(x, $value1$, "success compareAndExchangeVolatile $type$ value");
|
||||
assertEquals(x, $value1$, "success compareAndExchange $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
$type$ r = UNSAFE.compareAndExchange$Type$Volatile(base, offset, $value2$, $value3$);
|
||||
assertEquals(r, $value1$, "failing compareAndExchangeVolatile $type$");
|
||||
$type$ r = UNSAFE.compareAndExchange$Type$(base, offset, $value2$, $value3$);
|
||||
assertEquals(r, $value1$, "failing compareAndExchange $type$");
|
||||
$type$ x = UNSAFE.get$Type$(base, offset);
|
||||
assertEquals(x, $value1$, "failing compareAndExchangeVolatile $type$ value");
|
||||
assertEquals(x, $value1$, "failing compareAndExchange $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
@ -279,41 +301,41 @@ public class $Qualifier$UnsafeAccessTest$Type$ {
|
||||
{
|
||||
boolean success = false;
|
||||
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
|
||||
success = UNSAFE.weakCompareAndSwap$Type$(base, offset, $value1$, $value2$);
|
||||
success = UNSAFE.weakCompareAndSet$Type$Plain(base, offset, $value1$, $value2$);
|
||||
}
|
||||
assertEquals(success, true, "weakCompareAndSwap $type$");
|
||||
assertEquals(success, true, "weakCompareAndSetPlain $type$");
|
||||
$type$ x = UNSAFE.get$Type$(base, offset);
|
||||
assertEquals(x, $value2$, "weakCompareAndSwap $type$ value");
|
||||
assertEquals(x, $value2$, "weakCompareAndSetPlain $type$ value");
|
||||
}
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
|
||||
success = UNSAFE.weakCompareAndSwap$Type$Acquire(base, offset, $value2$, $value1$);
|
||||
success = UNSAFE.weakCompareAndSet$Type$Acquire(base, offset, $value2$, $value1$);
|
||||
}
|
||||
assertEquals(success, true, "weakCompareAndSwapAcquire $type$");
|
||||
assertEquals(success, true, "weakCompareAndSetAcquire $type$");
|
||||
$type$ x = UNSAFE.get$Type$(base, offset);
|
||||
assertEquals(x, $value1$, "weakCompareAndSwapAcquire $type$");
|
||||
assertEquals(x, $value1$, "weakCompareAndSetAcquire $type$");
|
||||
}
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
|
||||
success = UNSAFE.weakCompareAndSwap$Type$Release(base, offset, $value1$, $value2$);
|
||||
success = UNSAFE.weakCompareAndSet$Type$Release(base, offset, $value1$, $value2$);
|
||||
}
|
||||
assertEquals(success, true, "weakCompareAndSwapRelease $type$");
|
||||
assertEquals(success, true, "weakCompareAndSetRelease $type$");
|
||||
$type$ x = UNSAFE.get$Type$(base, offset);
|
||||
assertEquals(x, $value2$, "weakCompareAndSwapRelease $type$");
|
||||
assertEquals(x, $value2$, "weakCompareAndSetRelease $type$");
|
||||
}
|
||||
|
||||
{
|
||||
boolean success = false;
|
||||
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
|
||||
success = UNSAFE.weakCompareAndSwap$Type$Volatile(base, offset, $value2$, $value1$);
|
||||
success = UNSAFE.weakCompareAndSet$Type$(base, offset, $value2$, $value1$);
|
||||
}
|
||||
assertEquals(success, true, "weakCompareAndSwapVolatile $type$");
|
||||
assertEquals(success, true, "weakCompareAndSet $type$");
|
||||
$type$ x = UNSAFE.get$Type$(base, offset);
|
||||
assertEquals(x, $value1$, "weakCompareAndSwapVolatile $type$");
|
||||
assertEquals(x, $value1$, "weakCompareAndSet $type$");
|
||||
}
|
||||
|
||||
#end[JdkInternalMisc]
|
||||
@ -354,4 +376,3 @@ public class $Qualifier$UnsafeAccessTest$Type$ {
|
||||
#end[!boolean]
|
||||
#end[!Object]
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user