--- a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template Fri Apr 29 09:40:08 2016 +0200
+++ b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template Wed May 04 17:17:28 2016 +0300
@@ -494,22 +494,31 @@
}
{
- 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$");
}
@@ -670,22 +679,31 @@
}
{
- 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$");
}
@@ -849,22 +867,31 @@
}
{
- 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$");
}