changeset 146:39a1c4786c47

Put @Contended over fences tests: dodges the unlucky behavior when vars share a cache line.
author shade
date Mon, 14 Apr 2014 00:58:18 +0400
parents e09318cc1dbe
children 0dc313c61567
files tests-custom/src/main/java/org/openjdk/jcstress/tests/fences/FencedAcquireReleaseTest.java tests-custom/src/main/java/org/openjdk/jcstress/tests/fences/FencedDekkerTest.java tests-custom/src/main/java/org/openjdk/jcstress/tests/fences/FencedReadTwiceTest.java tests-custom/src/main/java/org/openjdk/jcstress/tests/fences/UnfencedAcquireReleaseTest.java tests-custom/src/main/java/org/openjdk/jcstress/tests/fences/UnfencedDekkerTest.java tests-custom/src/main/java/org/openjdk/jcstress/tests/fences/UnfencedReadTwiceTest.java
diffstat 6 files changed, 22 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests-custom/src/main/java/org/openjdk/jcstress/tests/fences/FencedAcquireReleaseTest.java	Sat Mar 29 08:49:37 2014 +0400
+++ b/tests-custom/src/main/java/org/openjdk/jcstress/tests/fences/FencedAcquireReleaseTest.java	Mon Apr 14 00:58:18 2014 +0400
@@ -29,6 +29,7 @@
 import org.openjdk.jcstress.annotations.State;
 import org.openjdk.jcstress.infra.results.IntResult2;
 import org.openjdk.jcstress.util.UnsafeHolder;
+import sun.misc.Contended;
 
 /**
  * Tests if acquire-release fences induce proper happens-before.
@@ -40,6 +41,8 @@
 public class FencedAcquireReleaseTest {
 
     int x;
+
+    @Contended
     int y; // acq/rel var
 
     @Actor
--- a/tests-custom/src/main/java/org/openjdk/jcstress/tests/fences/FencedDekkerTest.java	Sat Mar 29 08:49:37 2014 +0400
+++ b/tests-custom/src/main/java/org/openjdk/jcstress/tests/fences/FencedDekkerTest.java	Mon Apr 14 00:58:18 2014 +0400
@@ -29,6 +29,7 @@
 import org.openjdk.jcstress.annotations.State;
 import org.openjdk.jcstress.infra.results.IntResult2;
 import org.openjdk.jcstress.util.UnsafeHolder;
+import sun.misc.Contended;
 
 /**
  * Tests if read-after-write using fences preserves SC
@@ -39,7 +40,10 @@
 @State
 public class FencedDekkerTest {
 
+    @Contended
     int a;
+
+    @Contended
     int b;
 
     @Actor
--- a/tests-custom/src/main/java/org/openjdk/jcstress/tests/fences/FencedReadTwiceTest.java	Sat Mar 29 08:49:37 2014 +0400
+++ b/tests-custom/src/main/java/org/openjdk/jcstress/tests/fences/FencedReadTwiceTest.java	Mon Apr 14 00:58:18 2014 +0400
@@ -29,6 +29,7 @@
 import org.openjdk.jcstress.annotations.State;
 import org.openjdk.jcstress.infra.results.IntResult3;
 import org.openjdk.jcstress.util.UnsafeHolder;
+import sun.misc.Contended;
 
 /**
  * Test if acquire/release forces re-read
@@ -39,7 +40,10 @@
 @State
 public class FencedReadTwiceTest {
 
+    @Contended
     int x;
+
+    @Contended
     int y;
 
     @Actor
--- a/tests-custom/src/main/java/org/openjdk/jcstress/tests/fences/UnfencedAcquireReleaseTest.java	Sat Mar 29 08:49:37 2014 +0400
+++ b/tests-custom/src/main/java/org/openjdk/jcstress/tests/fences/UnfencedAcquireReleaseTest.java	Mon Apr 14 00:58:18 2014 +0400
@@ -28,6 +28,7 @@
 import org.openjdk.jcstress.annotations.JCStressTest;
 import org.openjdk.jcstress.annotations.State;
 import org.openjdk.jcstress.infra.results.IntResult2;
+import sun.misc.Contended;
 
 /**
  * Baseline for FencedAcquireReleaseTest
@@ -39,6 +40,8 @@
 public class UnfencedAcquireReleaseTest {
 
     int x;
+
+    @Contended
     int y; // acq/rel var
 
     @Actor
--- a/tests-custom/src/main/java/org/openjdk/jcstress/tests/fences/UnfencedDekkerTest.java	Sat Mar 29 08:49:37 2014 +0400
+++ b/tests-custom/src/main/java/org/openjdk/jcstress/tests/fences/UnfencedDekkerTest.java	Mon Apr 14 00:58:18 2014 +0400
@@ -30,6 +30,7 @@
 import org.openjdk.jcstress.annotations.State;
 import org.openjdk.jcstress.infra.results.IntResult2;
 import org.openjdk.jcstress.util.UnsafeHolder;
+import sun.misc.Contended;
 
 /**
  * Baseline for FencedDekkerTest
@@ -40,7 +41,10 @@
 @State
 public class UnfencedDekkerTest {
 
+    @Contended
     int a;
+
+    @Contended
     int b;
 
     @Actor
--- a/tests-custom/src/main/java/org/openjdk/jcstress/tests/fences/UnfencedReadTwiceTest.java	Sat Mar 29 08:49:37 2014 +0400
+++ b/tests-custom/src/main/java/org/openjdk/jcstress/tests/fences/UnfencedReadTwiceTest.java	Mon Apr 14 00:58:18 2014 +0400
@@ -28,6 +28,7 @@
 import org.openjdk.jcstress.annotations.JCStressTest;
 import org.openjdk.jcstress.annotations.State;
 import org.openjdk.jcstress.infra.results.IntResult3;
+import sun.misc.Contended;
 
 /**
  * Test if intervening write breaks reordering.
@@ -38,7 +39,10 @@
 @State
 public class UnfencedReadTwiceTest {
 
+    @Contended
     int x;
+
+    @Contended
     int y;
 
     @Actor