hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestLong.java
changeset 38281 b28e2739b429
parent 38234 06263a71233c
child 39419 cc993a4ab581
--- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestLong.java	Fri May 06 14:44:09 2016 +0000
+++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestLong.java	Fri May 06 17:59:35 2016 +0300
@@ -281,6 +281,18 @@
             assertEquals(x, 2L, "weakCompareAndSwapRelease long");
         }
 
+        {
+            boolean success = false;
+            for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+                success = UNSAFE.weakCompareAndSwapLongVolatile(base, offset, 2L, 1L);
+            }
+            assertEquals(success, true, "weakCompareAndSwapVolatile long");
+            long x = UNSAFE.getLong(base, offset);
+            assertEquals(x, 1L, "weakCompareAndSwapVolatile long");
+        }
+
+        UNSAFE.putLong(base, offset, 2L);
+
         // Compare set and get
         {
             long o = UNSAFE.getAndSetLong(base, offset, 1L);