changeset 264:2a45a3af4a7e

Chapters 0.b/c should ignore the tests with standalone load/store pairs.
author shade
date Thu, 19 May 2016 23:22:35 +0300
parents 6a36770db68b
children f4a0d5bc585c
files jcstress-test-gen/pom.xml jcstress-test-gen/src/main/java/org/openjdk/jcstress/generator/seqcst/SeqCstTraceGenerator.java
diffstat 2 files changed, 27 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/jcstress-test-gen/pom.xml	Thu May 19 23:04:46 2016 +0300
+++ b/jcstress-test-gen/pom.xml	Thu May 19 23:22:35 2016 +0300
@@ -132,4 +132,12 @@
 
     </build>
 
+    <dependencies>
+        <dependency>
+            <groupId>org.openjdk.jcstress</groupId>
+            <artifactId>jcstress-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+
 </project>
--- a/jcstress-test-gen/src/main/java/org/openjdk/jcstress/generator/seqcst/SeqCstTraceGenerator.java	Thu May 19 23:04:46 2016 +0300
+++ b/jcstress-test-gen/src/main/java/org/openjdk/jcstress/generator/seqcst/SeqCstTraceGenerator.java	Thu May 19 23:22:35 2016 +0300
@@ -27,6 +27,8 @@
 import org.openjdk.jcstress.generator.ResultGenerator;
 import org.openjdk.jcstress.generator.TestGenerator;
 import org.openjdk.jcstress.generator.Utils;
+import org.openjdk.jcstress.util.HashMultiset;
+import org.openjdk.jcstress.util.Multiset;
 
 import java.io.FileNotFoundException;
 import java.io.PrintWriter;
@@ -154,6 +156,7 @@
                 .filter(MultiThread::isMultiThread)               // really have multiple threads
                 .filter(MultiThread::hasNoSingleLoadThreads)      // threads with single loads produce duplicate tests
                 .filter(MultiThread::hasNoThreadsWithSameLoads)   // threads with the same loads produce duplicate tests
+                .filter(MultiThread::hasNoIntraThreadPairs)       // has no operations that do not span threads
                 .collect(Collectors.toList());
 
         System.out.print(multiThreads.size() + " interesting... ");
@@ -633,6 +636,22 @@
             return true;
         }
 
+        public boolean hasNoIntraThreadPairs() {
+            Multiset<Integer> vars = new HashMultiset<>();
+            for (Trace trace : threads) {
+                Set<Integer> touched =
+                        trace.ops.stream()
+                                .map(Op::getVarId)
+                                .collect(Collectors.toSet());
+                touched.forEach(vars::add);
+            }
+
+            for (Integer v : vars.keys()) {
+                if (vars.count(v) == 1) return false;
+            }
+            return true;
+        }
+
         public boolean isMultiThread() {
             return threads.size() > 1;
         }