projects
/
fleet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ae51f25
)
more cleanup
author
megacz
<adam@megacz.com>
Sun, 15 Mar 2009 01:25:10 +0000
(18:25 -0700)
committer
megacz
<adam@megacz.com>
Sun, 15 Mar 2009 01:25:10 +0000
(18:25 -0700)
src/edu/berkeley/fleet/dataflow/DataFlowGraph.java
patch
|
blob
|
history
src/edu/berkeley/fleet/dataflow/ForeverNode.java
patch
|
blob
|
history
src/edu/berkeley/fleet/dataflow/MemoryNode.java
patch
|
blob
|
history
src/edu/berkeley/fleet/dataflow/MergeSort.java
patch
|
blob
|
history
src/edu/berkeley/fleet/dataflow/Node.java
patch
|
blob
|
history
src/edu/berkeley/fleet/dataflow/OnceNode.java
patch
|
blob
|
history
diff --git
a/src/edu/berkeley/fleet/dataflow/DataFlowGraph.java
b/src/edu/berkeley/fleet/dataflow/DataFlowGraph.java
index
1510a7b
..
7131e87
100644
(file)
--- a/
src/edu/berkeley/fleet/dataflow/DataFlowGraph.java
+++ b/
src/edu/berkeley/fleet/dataflow/DataFlowGraph.java
@@
-27,7
+27,6
@@
public class DataFlowGraph {
public final ShipPool pool;
private HashSet<Node> nodes = new HashSet<Node>();
public final ShipPool pool;
private HashSet<Node> nodes = new HashSet<Node>();
- public static int reset_count = 0;
public static HashSet<Dock> torpedoes = new HashSet<Dock>();
public DataFlowGraph(Fleet fleet) {
public static HashSet<Dock> torpedoes = new HashSet<Dock>();
public DataFlowGraph(Fleet fleet) {
@@
-44,11
+43,12
@@
public class DataFlowGraph {
for(Node mod : nodes)
mod.build(ctx);
}
for(Node mod : nodes)
mod.build(ctx);
}
- public void reset(Context ctx, int phase, Destination ackDestination) {
- reset_count = 0;
+ public int reset(Context ctx, int phase, Destination ackDestination) {
+ int ret = 0;
torpedoes.clear();
for(Node mod : nodes)
torpedoes.clear();
for(Node mod : nodes)
- mod.reset(ctx, phase, ackDestination);
+ ret += mod.reset(ctx, phase, ackDestination);
+ return ret;
}
}
}
}
diff --git
a/src/edu/berkeley/fleet/dataflow/ForeverNode.java
b/src/edu/berkeley/fleet/dataflow/ForeverNode.java
index
3119f39
..
6f66ad0
100644
(file)
--- a/
src/edu/berkeley/fleet/dataflow/ForeverNode.java
+++ b/
src/edu/berkeley/fleet/dataflow/ForeverNode.java
@@
-14,7
+14,7
@@
public class ForeverNode extends Node {
public void sendToken(LoopFactory lf) { }
public void recvWord(LoopFactory lf) { }
public void build(Context ctx) { }
public void sendToken(LoopFactory lf) { }
public void recvWord(LoopFactory lf) { }
public void build(Context ctx) { }
- public void reset(Context ctx, int phase, Destination ackDestination) { }
+ public int reset(Context ctx, int phase, Destination ackDestination) { return 0; }
public void setPeer(InPort peer) {
this.peer = peer;
DockInPort pip = ((DockInPort)peer);
public void setPeer(InPort peer) {
this.peer = peer;
DockInPort pip = ((DockInPort)peer);
diff --git
a/src/edu/berkeley/fleet/dataflow/MemoryNode.java
b/src/edu/berkeley/fleet/dataflow/MemoryNode.java
index
e606803
..
cac6391
100644
(file)
--- a/
src/edu/berkeley/fleet/dataflow/MemoryNode.java
+++ b/
src/edu/berkeley/fleet/dataflow/MemoryNode.java
@@
-28,8
+28,8
@@
public class MemoryNode extends Node {
public void sendWord(LoopFactory lf) { lf.sendWord(ship.getDock("inAddrRead").getDataDestination(), new BitVector(1).set(0)); }
public void build(Context ctx) { }
public int getTokensToAbsorb() { return outRead1.peer.getTokensToAbsorb(); }
public void sendWord(LoopFactory lf) { lf.sendWord(ship.getDock("inAddrRead").getDataDestination(), new BitVector(1).set(0)); }
public void build(Context ctx) { }
public int getTokensToAbsorb() { return outRead1.peer.getTokensToAbsorb(); }
- public void reset(Context ctx, int phase, Destination ackDestination) {
- doReset(ctx, phase, ship.getDock("inAddrRead"), null, ackDestination, false);
+ public int reset(Context ctx, int phase, Destination ackDestination) {
+ return doReset(ctx, phase, ship.getDock("inAddrRead"), null, ackDestination, false);
}
};
this.inAddrRead2 = new InPort("inAddrRead2") {
}
};
this.inAddrRead2 = new InPort("inAddrRead2") {
@@
-37,19
+37,19
@@
public class MemoryNode extends Node {
public void sendWord(LoopFactory lf) { lf.sendWord(ship.getDock("inAddrRead").getDataDestination(), new BitVector(1).set(1)); }
public void build(Context ctx) { }
public int getTokensToAbsorb() { return outRead2.peer.getTokensToAbsorb(); }
public void sendWord(LoopFactory lf) { lf.sendWord(ship.getDock("inAddrRead").getDataDestination(), new BitVector(1).set(1)); }
public void build(Context ctx) { }
public int getTokensToAbsorb() { return outRead2.peer.getTokensToAbsorb(); }
- public void reset(Context ctx, int phase, Destination ackDestination) { }
+ public int reset(Context ctx, int phase, Destination ackDestination) { return 0; }
};
this.outRead1 = new OutPort("outRead1") {
public void sendToken(LoopFactory lf) { inAddrRead1.peer.sendToken(lf); }
public void recvWord(LoopFactory lf) { lf.recvWord(); }
public void build(Context ctx) { }
};
this.outRead1 = new OutPort("outRead1") {
public void sendToken(LoopFactory lf) { inAddrRead1.peer.sendToken(lf); }
public void recvWord(LoopFactory lf) { lf.recvWord(); }
public void build(Context ctx) { }
- public void reset(Context ctx, int phase, Destination ackDestination) { }
+ public int reset(Context ctx, int phase, Destination ackDestination) { return 0; }
};
this.outRead2 = new OutPort("outRead2") {
public void sendToken(LoopFactory lf) { inAddrRead2.peer.sendToken(lf); }
public void recvWord(LoopFactory lf) { lf.recvWord(); }
public void build(Context ctx) { }
};
this.outRead2 = new OutPort("outRead2") {
public void sendToken(LoopFactory lf) { inAddrRead2.peer.sendToken(lf); }
public void recvWord(LoopFactory lf) { lf.recvWord(); }
public void build(Context ctx) { }
- public void reset(Context ctx, int phase, Destination ackDestination) { }
+ public int reset(Context ctx, int phase, Destination ackDestination) { return 0; }
};
this.outWrite = new DockOutPort("out", ship.getDock("out")) {
protected void build(Context ctx, LoopFactory lf) {
};
this.outWrite = new DockOutPort("out", ship.getDock("out")) {
protected void build(Context ctx, LoopFactory lf) {
diff --git
a/src/edu/berkeley/fleet/dataflow/MergeSort.java
b/src/edu/berkeley/fleet/dataflow/MergeSort.java
index
36cd08f
..
e39e1b7
100644
(file)
--- a/
src/edu/berkeley/fleet/dataflow/MergeSort.java
+++ b/
src/edu/berkeley/fleet/dataflow/MergeSort.java
@@
-114,7
+114,7
@@
public class MergeSort {
ctx2 = new Context(fp.getFleet());
Destination ackDestination = counter.getDock("in2").getDataDestination();
ctx2 = new Context(fp.getFleet());
Destination ackDestination = counter.getDock("in2").getDataDestination();
- proc.reset(ctx2, phase, ackDestination);
+ int expected_tokens = proc.reset(ctx2, phase, ackDestination);
Context ctx3 = new Context(fp.getFleet());
lf = new LoopFactory(ctx3, counter.getDock("inOp"), 1);
Context ctx3 = new Context(fp.getFleet());
lf = new LoopFactory(ctx3, counter.getDock("inOp"), 1);
@@
-123,7
+123,7
@@
public class MergeSort {
lf.literal(5);
lf.deliver();
lf = new LoopFactory(ctx3, counter.getDock("in1"), 1);
lf.literal(5);
lf.deliver();
lf = new LoopFactory(ctx3, counter.getDock("in1"), 1);
- lf.literal(DataFlowGraph.reset_count-1);
+ lf.literal(expected_tokens-1);
lf.deliver();
lf.literal(1);
lf.deliver();
lf.deliver();
lf.literal(1);
lf.deliver();
diff --git
a/src/edu/berkeley/fleet/dataflow/Node.java
b/src/edu/berkeley/fleet/dataflow/Node.java
index
5684e84
..
383121e
100644
(file)
--- a/
src/edu/berkeley/fleet/dataflow/Node.java
+++ b/
src/edu/berkeley/fleet/dataflow/Node.java
@@
-14,8
+14,9
@@
import static edu.berkeley.fleet.util.BitManipulations.*;
public class Node {
public class Node {
- void doReset(Context ctx, int phase, Dock dock, Port peer, Destination ackDestination, boolean peerUsed) {
- if (dock.getShip().getType().equals("Debug")) return;
+ int doReset(Context ctx, int phase, Dock dock, Port peer, Destination ackDestination, boolean peerUsed) {
+ int ret = 0;
+ if (dock.getShip().getType().equals("Debug")) return ret;
switch(phase) {
switch(phase) {
@@
-34,7
+35,7
@@
public class Node {
lf = lf.makeNext(0);
lf.abortLoopIfTorpedoPresent();
lf.collectWord();
lf = lf.makeNext(0);
lf.abortLoopIfTorpedoPresent();
lf.collectWord();
- DataFlowGraph.reset_count++;
+ ret++;
}
break;
}
}
break;
}
@@
-56,7
+57,7
@@
public class Node {
((OutPort)peer).recvWord(lf);
((OutPort)peer).sendToken(lf);
}
((OutPort)peer).recvWord(lf);
((OutPort)peer).sendToken(lf);
}
- DataFlowGraph.reset_count++;
+ ret++;
}
break;
}
}
break;
}
@@
-70,7
+71,7
@@
public class Node {
for(int i=0; i<((InPort)peer).getTokensToAbsorb(); i++)
lf.recvToken();
lf.sendToken(ackDestination);
for(int i=0; i<((InPort)peer).getTokensToAbsorb(); i++)
lf.recvToken();
lf.sendToken(ackDestination);
- DataFlowGraph.reset_count++;
+ ret++;
}
break;
}
}
break;
}
@@
-83,13
+84,12
@@
public class Node {
}
LoopFactory lf = new LoopFactory(ctx, dock, 1);
lf.sendToken(ackDestination);
}
LoopFactory lf = new LoopFactory(ctx, dock, 1);
lf.sendToken(ackDestination);
- DataFlowGraph.reset_count++;
+ ret++;
}
break;
}
}
break;
}
-
-
}
}
+ return ret;
}
public final DataFlowGraph dfg;
}
public final DataFlowGraph dfg;
@@
-104,8
+104,10
@@
public class Node {
public OutPort getOutPort(String name) { return (OutPort)ports.get(name); }
public void build(Context ctx) { for(Port p : ports.values()) p.build(ctx); }
public OutPort getOutPort(String name) { return (OutPort)ports.get(name); }
public void build(Context ctx) { for(Port p : ports.values()) p.build(ctx); }
- public void reset(Context ctx, int phase, Destination ackDestination) {
- for(Port p : ports.values()) p.reset(ctx, phase, ackDestination);
+ public int reset(Context ctx, int phase, Destination ackDestination) {
+ int ret = 0;
+ for(Port p : ports.values()) ret += p.reset(ctx, phase, ackDestination);
+ return ret;
}
public abstract class Port {
}
public abstract class Port {
@@
-116,7
+118,7
@@
public class Node {
Node.this.ports.put(name,this);
}
public abstract void build(Context ctx);
Node.this.ports.put(name,this);
}
public abstract void build(Context ctx);
- public abstract void reset(Context ctx, int phase, Destination ackDestination);
+ public abstract int reset(Context ctx, int phase, Destination ackDestination);
}
public abstract class InPort extends Port {
}
public abstract class InPort extends Port {
@@
-181,8
+183,8
@@
public class Node {
for(int i=0; i<pattern.length; i++) if (pattern[i]==null) return true;
return false;
}
for(int i=0; i<pattern.length; i++) if (pattern[i]==null) return true;
return false;
}
- public void reset(Context ctx, int phase, Destination ackDestination) {
- doReset(ctx, phase, dock, peer, ackDestination, peerUsed());
+ public int reset(Context ctx, int phase, Destination ackDestination) {
+ return doReset(ctx, phase, dock, peer, ackDestination, peerUsed());
}
protected void build(Context ctx, LoopFactory lf) {
int inflight = (count != 0 && count < getInflight()) ? count : getInflight();
}
protected void build(Context ctx, LoopFactory lf) {
int inflight = (count != 0 && count < getInflight()) ? count : getInflight();
@@
-235,8
+237,8
@@
public class Node {
lf.collectWord();
peer.sendWord(lf);
}
lf.collectWord();
peer.sendWord(lf);
}
- public void reset(Context ctx, int phase, Destination ackDestination) {
- doReset(ctx, phase, dock, peer, ackDestination, true);
+ public int reset(Context ctx, int phase, Destination ackDestination) {
+ return doReset(ctx, phase, dock, peer, ackDestination, true);
}
}
}
}
diff --git
a/src/edu/berkeley/fleet/dataflow/OnceNode.java
b/src/edu/berkeley/fleet/dataflow/OnceNode.java
index
a096095
..
0476804
100644
(file)
--- a/
src/edu/berkeley/fleet/dataflow/OnceNode.java
+++ b/
src/edu/berkeley/fleet/dataflow/OnceNode.java
@@
-8,7
+8,7
@@
public class OnceNode extends Node {
public void sendToken(LoopFactory lf) { }
public void recvWord(LoopFactory lf) { }
public void build(Context ctx) { }
public void sendToken(LoopFactory lf) { }
public void recvWord(LoopFactory lf) { }
public void build(Context ctx) { }
- public void reset(Context ctx, int phase, Destination ackDestination) { }
+ public int reset(Context ctx, int phase, Destination ackDestination) { return 0; }
public void setPeer(InPort peer) {
this.peer = peer;
DockInPort pip = ((DockInPort)peer);
public void setPeer(InPort peer) {
this.peer = peer;
DockInPort pip = ((DockInPort)peer);