checkpoint
[sbp.git] / src / edu / berkeley / sbp / GSS.java
index 7408eba..d25593f 100644 (file)
@@ -16,9 +16,10 @@ class GSS {
     public int resets = 0;
     public int waits = 0;
 
-    HashMapBag<Integer,Sequence>       inhibited = new HashMapBag<Integer,Sequence>();
-    HashMapBag<Sequence,Phase.Waiting> waiting   = new HashMapBag<Sequence,Phase.Waiting>();
-    HashMapBag<Integer,Sequence>       performed = new HashMapBag<Integer,Sequence>();
+    HashMapBag<Integer,Sequence>       inhibited       = new HashMapBag<Integer,Sequence>();
+    HashMapBag<Integer,Sequence>       expectedInhibit = new HashMapBag<Integer,Sequence>();
+    HashMapBag<Sequence,Phase.Waiting> waiting         = new HashMapBag<Sequence,Phase.Waiting>();
+    HashMapBag<Integer,Sequence>       performed       = new HashMapBag<Integer,Sequence>();
     
     /** FIXME */
     public  Forest.Ref finalResult;
@@ -63,6 +64,8 @@ class GSS {
             performed.clear();
             hash = new IntPairMap<Phase.Node>();
             singularReductions = new IntPairMap<Forest>();
+            expectedInhibit.clear();
+            expectedInhibit.addAll(inhibited);
             good = false;
             closed = false;
             reducing = false;
@@ -175,6 +178,7 @@ class GSS {
                     throw new Reset();
                 }
                 inhibited.add(p, seq);
+                expectedInhibit.remove(p, seq);
             }
         }
         
@@ -196,6 +200,11 @@ class GSS {
                     reducing_list[i] = null;
                     n.performReductions();
                 }
+                if (expectedInhibit.size() > 0) {
+                    inhibited.removeAll(expectedInhibit);
+                    System.out.println("\n!!!!\n");
+                    throw new Reset();
+                }
             } catch (Reset r) {
                 reset();
                 reduce();