X-Git-Url: http://git.megacz.com/?p=sbp.git;a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fsbp%2FGSS.java;h=8c7b2dbe8698dcb404636c91ba253dac5f5e7fbf;hp=d2b040d42fa475eae6bba5d4a3d1e32ca5c9790f;hb=4519f5ec820b1e704dba2df8727bd41b3384c49d;hpb=ddf7ffb485e6b3dd0fe6b1b39b47a21a1e4b8973 diff --git a/src/edu/berkeley/sbp/GSS.java b/src/edu/berkeley/sbp/GSS.java index d2b040d..8c7b2db 100644 --- a/src/edu/berkeley/sbp/GSS.java +++ b/src/edu/berkeley/sbp/GSS.java @@ -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 implements Invokable { - 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 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() {