tentative checkpoint
[sbp.git] / src / edu / berkeley / sbp / GSS.java
index 0718a10..65af62e 100644 (file)
@@ -41,7 +41,6 @@ class GSS {
 
         boolean reducing;
         private IntPairMap<Phase.Node> hash;  /* ALLOC */
-        private IntPairMap<Forest> singularReductions;  /* ALLOC */
         private boolean closed;
         private boolean good;
         private Phase next = null;
@@ -69,7 +68,6 @@ class GSS {
             lastperformed.addAll(performed);
             performed.clear();
             hash = new IntPairMap<Phase.Node>();
-            singularReductions = new IntPairMap<Forest>();
             reset = false;
             good = false;
             closed = false;
@@ -220,7 +218,6 @@ class GSS {
             // this massively improves GC performance
             if (prev!=null && parser.helpgc) {
                 prev.hash = null;
-                prev.singularReductions = null;
             }
             this.next = next;
             closed = true;
@@ -358,23 +355,16 @@ class GSS {
                     if (n==null) return;
                     Forest[] holder = new Forest[r.pos];
                     if (r.pos==0) n.finish(r, r.zero(), n.phase(), holder);
-                    else          n.reduce(r, r.pos-1,  n.phase(), holder, null, null);
+                    else          n.reduce(r, r.pos-1,  n.phase(), holder, null);
                 } else {
                     Forest[] holder = new Forest[r.pos];
                     if (r.pos<=0) throw new Error("called wrong form of reduce()");
                     int pos = r.pos-1;
-                    n.reduce(r, pos, n.phase(), holder, n2, null);
+                    n.reduce(r, pos, n.phase(), holder, n2);
                 }
             }
 
-            /*
-            public void reduce(Position r, int pos, Phase target, Forest[] holder) {
-                reduce(r, pos, target, holder, null); }
             public void reduce(Position r, int pos, Phase target, Forest[] holder, Node only) {
-                reduce(r, pos, target, holder, only, this.pending());
-            }
-            */
-            public void reduce(Position r, int pos, Phase target, Forest[] holder, Node only, Forest pending) {
                 Forest old = holder[pos];
 
                 // FIXME: I'm unsure about this -- basically we want to deal with the case where
@@ -385,19 +375,13 @@ class GSS {
                 for(Forest result : results())
                     for(Node child : ((Forest.Ref<?>)result).parents) {
                         if (only != null && child!=only) continue;
-                        pending = holder[pos] = result;
+                        holder[pos] = result;
                         if (pos==0) {
                             System.arraycopy(holder, 0, r.holder, 0, holder.length);
                             for(int i=0; i<r.pos; i++) if (r.holder[i]==null) throw new Error("realbad");
-                            Forest rex = null;
-                            if (r.pos==1)  rex = singularReductions.get(pending, r);
-                            if (rex==null) {
-                                rex = r.rewrite(phase().getLocation());
-                                if (r.pos==1) singularReductions.put(pending, r, rex);
-                            }
-                            child.finish(r, rex, target, holder);
+                            child.finish(r, r.rewrite(phase().getLocation()), target, holder);
                         } else {
-                            child.reduce(r, pos-1, target, holder, null, null);
+                            child.reduce(r, pos-1, target, holder, null);
                         }
                     }