checkpoint harmony
[sbp.git] / src / edu / berkeley / sbp / GSS.java
index d2b040d..8c7b2db 100644 (file)
@@ -125,7 +125,7 @@ class GSS {
             p.holder.merge(pending);
             if (p.parents().contains(parent)) return true;
             p.parents().add(parent, true);
-            if (p!=parent && !fromEmptyReduction) p.queueReductions(parent);
+            if (p!=parent && !fromEmptyReduction && reducing) p.queueReductions(parent);
             return true;
         }
         private boolean newNode3(Node parent, Forest pending, State state, boolean fromEmptyReduction) {
@@ -141,8 +141,10 @@ class GSS {
             } while(false);
 
             Node n = new Node(parent, pending, state, fromEmptyReduction);  // ALLOC
-            n.queueEmptyReductions();
-            if (!fromEmptyReduction) n.queueReductions(parent);
+            if (reducing) {
+                n.queueEmptyReductions();
+                if (!fromEmptyReduction) n.queueReductions(parent);
+            }
             return true;
         }
 
@@ -247,12 +249,11 @@ class GSS {
             }
         }
        
-        // GSS Nodes //////////////////////////////////////////////////////////////////////////////
+        // Node /////////////////////////////////////////////////////////////////////////////////
 
         /** a node in the GSS */
         public final class Node extends FastSet<Node> implements Invokable<Reduction, Node, Node> {
 
-            public boolean touched = false;
             private Forest.Ref holder = null;
             private boolean allqueued = false;
 
@@ -260,8 +261,7 @@ class GSS {
             public final State state;
 
             /** which Phase this Node belongs to (node that Node is also a non-static inner class of Phase) */
-            public Phase phase() { return Phase.this; }
-
+            public  Phase phase() { return Phase.this; }
             public  Forest.Ref holder() { return holder==null ? (holder = new Forest.Ref()) : holder; }
             public  Forest pending() { return Phase.this.closed ? holder().resolve() : holder; }
             public  FastSet<Node> parents() { return this; }
@@ -270,7 +270,6 @@ class GSS {
                 if (!reducing) return;
                 if (allqueued) return;
                 allqueued = true;
-                int where = parents().size();
                 state.invokeReductions(token, this, this, null);
             }
 
@@ -282,10 +281,8 @@ class GSS {
             public final void invoke(Reduction r, Node n, Node n2) {
                 if (n==null) {
                     if (r.position.pos==0) r.reduce(this);
-                    return;
-                }
-                if (r.position.pos==0) return;
-                if (n2==null) r.reduce(n);
+                } else if (r.position.pos==0) return;
+                else if (n2==null) r.reduce(n);
                 else          r.reduce(n, n2);
             }
             public void queueEmptyReductions() {