checkpoint
[sbp.git] / src / edu / berkeley / sbp / GSS.java
index 3c1174e..3c1b9da 100644 (file)
@@ -122,7 +122,6 @@ class GSS {
             for(int i=0; i<num; i++) {
                 Node n = reducing_list[i];
                 reducing_list[i] = null;
-                n.queueEmptyReductions();
                 n.queueReductions();
             }
         }
@@ -210,41 +209,17 @@ class GSS {
                 if (allqueued) return;
                 allqueued = true;
                 int where = parents().size();
-                for(Parser.Table.Reduction r : token==null ? state.getEofReductions() : state.getReductions(token))
+                for(Parser.Table.Reduction r : state.getReductions(token))
                     if (r.numPop >= 1)
                         r.reduce(this, null, null);
-                for(int i=0; i<where; i++)
-                    queueReductions(get(i), false);
             }
 
             /** FIXME */
-            public void queueReductions(Node n2) { queueReductions(n2, true); }
-            public void queueReductions(Node n2, boolean includeLongs) {
+            public void queueReductions(Node n2) {
                 if (!allqueued) { queueReductions(); return; }
-                Node n = this;
-                for(Parser.Table.Reduction r : token==null ? n.state.getEofReductions() : n.state.getReductions(token)) {
-                    
-                    // UGLY HACK
-                    // The problem here is that a "reduction of length 1"
-                    // performed twice with different values of n2 needs
-                    // to only create a *single* new result, but must add
-                    // multiple parents to the node holding that result.
-                    // The current reducer doesn't differentiate between
-                    // the next node of an n-pop reduction and the
-                    // ultimate parent of the last pop, so we need to
-                    // cache instances here as a way of avoiding
-                    // recreating them.
-                    if (r.numPop <= 0) continue;
-                    if (includeLongs) {
-                        if (r.numPop == 1) {
-                            Forest ret = n.cache().get(r);
-                            if (ret != null) r.reduce(this, n2, ret);
-                            else n.cache().put(r, r.reduce(this, n2, null));
-                        } else {
-                            r.reduce(this, n2, null);
-                        }
-                    }
-                }
+                for(Parser.Table.Reduction r : state.getReductions(token))
+                    if (r.numPop > 0)
+                        r.reduce(this, n2, null);
             }