changeset 14:714038e28c9e

generator: remove homomorhic tests
author shade
date Mon, 08 Jul 2013 20:29:16 +0400
parents 04d8b91e649b
children 54f6c963f8af
files generator/src/main/java/org/openjdk/jcstress/tracer/TraceGen.java
diffstat 1 files changed, 32 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/generator/src/main/java/org/openjdk/jcstress/tracer/TraceGen.java	Mon Jul 08 20:04:46 2013 +0400
+++ b/generator/src/main/java/org/openjdk/jcstress/tracer/TraceGen.java	Mon Jul 08 20:29:16 2013 +0400
@@ -69,12 +69,15 @@
             allTraces.addAll(traces);
         }
 
+        Set<String> generatedTraces = new HashSet<String>();
+
         List<Trace> newTraces = new ArrayList<Trace>();
         for (Trace trace : allTraces) {
             if (!trace.hasLoads()) continue;
             if (!trace.hasStores()) continue;
             if (trace.hasNonMatchingLoads()) continue;
             if (trace.hasNonMatchingStores()) continue;
+            if (!generatedTraces.add(trace.canonicalId())) continue;
 
             int constId = 0;
             int resId = 0;
@@ -376,6 +379,35 @@
             return sb.toString();
         }
 
+        public String canonicalId() {
+            int varId = 0;
+            Map<Integer, Integer> varMap = new HashMap<Integer, Integer>();
+            for (Op op : ops) {
+                Integer id = varMap.get(op.getVarId());
+                if (id == null) {
+                    id = varId++;
+                    varMap.put(op.getVarId(), id);
+                }
+            }
+
+            StringBuilder sb = new StringBuilder();
+            for (Op op : ops) {
+                switch (op.getType()) {
+                    case LOAD:
+                        sb.append("L");
+                        break;
+                    case STORE:
+                        sb.append("S");
+                        break;
+                    default:
+                        throw new IllegalStateException();
+                }
+                sb.append(varMap.get(op.getVarId()) + 1);
+                sb.append("_");
+            }
+            return sb.toString();
+        }
+
         public boolean hasNonMatchingLoads() {
             Set<Integer> stores = new HashSet<Integer>();
             for (Op op : ops) {