--- a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template Fri May 06 06:23:30 2016 -0700
+++ b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template Mon May 09 12:39:41 2016 +0300
@@ -105,7 +105,6 @@
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE));
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE));
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
- assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_VOLATILE));
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
@@ -115,7 +114,6 @@
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE));
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE));
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET));
- assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_VOLATILE));
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE));
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE));
assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET));
@@ -299,10 +297,6 @@
});
checkUOE(() -> {
- boolean r = vh.weakCompareAndSetVolatile(recv, $value1$, $value2$);
- });
-
- checkUOE(() -> {
boolean r = vh.weakCompareAndSetAcquire(recv, $value1$, $value2$);
});
@@ -389,10 +383,6 @@
});
checkUOE(() -> {
- boolean r = vh.weakCompareAndSetVolatile($value1$, $value2$);
- });
-
- checkUOE(() -> {
boolean r = vh.weakCompareAndSetAcquire($value1$, $value2$);
});
@@ -504,39 +494,41 @@
}
{
- boolean r = vh.weakCompareAndSet(recv, $value1$, $value2$);
- assertEquals(r, true, "weakCompareAndSet $type$");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSet(recv, $value1$, $value2$);
+ }
+ assertEquals(success, true, "weakCompareAndSet $type$");
$type$ x = ($type$) vh.get(recv);
assertEquals(x, $value2$, "weakCompareAndSet $type$ value");
}
{
- boolean r = vh.weakCompareAndSetAcquire(recv, $value2$, $value1$);
- assertEquals(r, true, "weakCompareAndSetAcquire $type$");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetAcquire(recv, $value2$, $value1$);
+ }
+ assertEquals(success, true, "weakCompareAndSetAcquire $type$");
$type$ x = ($type$) vh.get(recv);
assertEquals(x, $value1$, "weakCompareAndSetAcquire $type$");
}
{
- boolean r = vh.weakCompareAndSetRelease(recv, $value1$, $value2$);
- assertEquals(r, true, "weakCompareAndSetRelease $type$");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetRelease(recv, $value1$, $value2$);
+ }
+ assertEquals(success, true, "weakCompareAndSetRelease $type$");
$type$ x = ($type$) vh.get(recv);
assertEquals(x, $value2$, "weakCompareAndSetRelease $type$");
}
- {
- boolean r = vh.weakCompareAndSetVolatile(recv, $value2$, $value1$);
- assertEquals(r, true, "weakCompareAndSetVolatile $type$");
- $type$ x = ($type$) vh.get(recv);
- assertEquals(x, $value1$, "weakCompareAndSetVolatile $type$ value");
- }
-
// Compare set and get
{
- $type$ o = ($type$) vh.getAndSet(recv, $value2$);
- assertEquals(o, $value1$, "getAndSet $type$");
+ $type$ o = ($type$) vh.getAndSet(recv, $value1$);
+ assertEquals(o, $value2$, "getAndSet $type$");
$type$ x = ($type$) vh.get(recv);
- assertEquals(x, $value2$, "getAndSet $type$ value");
+ assertEquals(x, $value1$, "getAndSet $type$ value");
}
#end[CAS]
@@ -576,10 +568,6 @@
});
checkUOE(() -> {
- boolean r = vh.weakCompareAndSetVolatile(recv, $value1$, $value2$);
- });
-
- checkUOE(() -> {
boolean r = vh.weakCompareAndSetAcquire(recv, $value1$, $value2$);
});
@@ -691,39 +679,41 @@
}
{
- boolean r = (boolean) vh.weakCompareAndSet($value1$, $value2$);
- assertEquals(r, true, "weakCompareAndSet $type$");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSet($value1$, $value2$);
+ }
+ assertEquals(success, true, "weakCompareAndSet $type$");
$type$ x = ($type$) vh.get();
assertEquals(x, $value2$, "weakCompareAndSet $type$ value");
}
{
- boolean r = (boolean) vh.weakCompareAndSetAcquire($value2$, $value1$);
- assertEquals(r, true, "weakCompareAndSetAcquire $type$");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetAcquire($value2$, $value1$);
+ }
+ assertEquals(success, true, "weakCompareAndSetAcquire $type$");
$type$ x = ($type$) vh.get();
assertEquals(x, $value1$, "weakCompareAndSetAcquire $type$");
}
{
- boolean r = (boolean) vh.weakCompareAndSetRelease($value1$, $value2$);
- assertEquals(r, true, "weakCompareAndSetRelease $type$");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetRelease($value1$, $value2$);
+ }
+ assertEquals(success, true, "weakCompareAndSetRelease $type$");
$type$ x = ($type$) vh.get();
assertEquals(x, $value2$, "weakCompareAndSetRelease $type$");
}
- {
- boolean r = (boolean) vh.weakCompareAndSetVolatile($value2$, $value1$);
- assertEquals(r, true, "weakCompareAndSetVolatile $type$");
- $type$ x = ($type$) vh.get();
- assertEquals(x, $value1$, "weakCompareAndSetVolatile $type$ value");
- }
-
// Compare set and get
{
- $type$ o = ($type$) vh.getAndSet( $value2$);
- assertEquals(o, $value1$, "getAndSet $type$");
+ $type$ o = ($type$) vh.getAndSet( $value1$);
+ assertEquals(o, $value2$, "getAndSet $type$");
$type$ x = ($type$) vh.get();
- assertEquals(x, $value2$, "getAndSet $type$ value");
+ assertEquals(x, $value1$, "getAndSet $type$ value");
}
#end[CAS]
@@ -763,10 +753,6 @@
});
checkUOE(() -> {
- boolean r = vh.weakCompareAndSetVolatile($value1$, $value2$);
- });
-
- checkUOE(() -> {
boolean r = vh.weakCompareAndSetAcquire($value1$, $value2$);
});
@@ -881,39 +867,41 @@
}
{
- boolean r = vh.weakCompareAndSet(array, i, $value1$, $value2$);
- assertEquals(r, true, "weakCompareAndSet $type$");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSet(array, i, $value1$, $value2$);
+ }
+ assertEquals(success, true, "weakCompareAndSet $type$");
$type$ x = ($type$) vh.get(array, i);
assertEquals(x, $value2$, "weakCompareAndSet $type$ value");
}
{
- boolean r = vh.weakCompareAndSetAcquire(array, i, $value2$, $value1$);
- assertEquals(r, true, "weakCompareAndSetAcquire $type$");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetAcquire(array, i, $value2$, $value1$);
+ }
+ assertEquals(success, true, "weakCompareAndSetAcquire $type$");
$type$ x = ($type$) vh.get(array, i);
assertEquals(x, $value1$, "weakCompareAndSetAcquire $type$");
}
{
- boolean r = vh.weakCompareAndSetRelease(array, i, $value1$, $value2$);
- assertEquals(r, true, "weakCompareAndSetRelease $type$");
+ boolean success = false;
+ for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+ success = vh.weakCompareAndSetRelease(array, i, $value1$, $value2$);
+ }
+ assertEquals(success, true, "weakCompareAndSetRelease $type$");
$type$ x = ($type$) vh.get(array, i);
assertEquals(x, $value2$, "weakCompareAndSetRelease $type$");
}
- {
- boolean r = vh.weakCompareAndSetVolatile(array, i, $value2$, $value1$);
- assertEquals(r, true, "weakCompareAndSetVolatile $type$");
- $type$ x = ($type$) vh.get(array, i);
- assertEquals(x, $value1$, "weakCompareAndSetVolatile $type$ value");
- }
-
// Compare set and get
{
- $type$ o = ($type$) vh.getAndSet(array, i, $value2$);
- assertEquals(o, $value1$, "getAndSet $type$");
+ $type$ o = ($type$) vh.getAndSet(array, i, $value1$);
+ assertEquals(o, $value2$, "getAndSet $type$");
$type$ x = ($type$) vh.get(array, i);
- assertEquals(x, $value2$, "getAndSet $type$ value");
+ assertEquals(x, $value1$, "getAndSet $type$ value");
}
#end[CAS]
@@ -957,10 +945,6 @@
});
checkUOE(() -> {
- boolean r = vh.weakCompareAndSetVolatile(array, i, $value1$, $value2$);
- });
-
- checkUOE(() -> {
boolean r = vh.weakCompareAndSetAcquire(array, i, $value1$, $value2$);
});
@@ -1040,10 +1024,6 @@
});
checkIOOBE(() -> {
- boolean r = vh.weakCompareAndSetVolatile(array, ci, $value1$, $value2$);
- });
-
- checkIOOBE(() -> {
boolean r = vh.weakCompareAndSetAcquire(array, ci, $value1$, $value2$);
});