public abstract class DF_System extends Object
Implementation Note: The set of equations is internally represented as a graph (actually a SpaceEffGraph). Each dataflow equation is a node in the graph. If a dataflow equation produces a lattice cell value that is used by another equation, the graph has a directed edge from the producer to the consumer. Fixed-point iteration proceeds in a topological order according to these edges.
Modifier and Type | Field and Description |
---|---|
protected DF_Solution |
cells
The lattice cells of the system: Mapping from Object to DF_LatticeCell
|
private static boolean |
DEBUG |
private static Comparator<DF_Equation> |
dfComparator |
private boolean |
EAGER |
private Graph |
equations
The equations that comprise this dataflow system.
|
private HashSet<DF_Equation> |
newEquations
Set of equations considered "new"
|
protected TreeSet<DF_Equation> |
workList
Set of equations pending evaluation
|
Modifier and Type | Method and Description |
---|---|
void |
addAllEquationsToWorkList()
Add all equations to the work list.
|
void |
addCellAppearancesToWorkList(DF_LatticeCell cell)
Add all equations which contain a given cell to the work list.
|
(package private) void |
addEquation(DF_Equation eq)
Add an existing equation to the system
|
void |
addNewEquationsToWorkList()
Add all new equations to the work list.
|
void |
addToWorkList(DF_Equation eq)
Add an equation to the work list.
|
void |
changedCell(DF_LatticeCell cell)
Call this method when the contents of a lattice cell
changes.
|
protected DF_LatticeCell |
findOrCreateCell(Object key)
Finds the cell matching this key.
|
DF_LatticeCell |
getCell(Object key)
Return the DF_LatticeCell corresponding to a key.
|
Enumeration<DF_Equation> |
getEquations()
Return an Enumeration over the equations in this system.
|
int |
getNumberOfEquations()
Get the number of equations in this system
|
DF_Solution |
getSolution()
Return the solution of the dataflow equation system.
|
protected abstract void |
initializeLatticeCells()
Initialize all lattice cells in the system.
|
protected abstract void |
initializeWorkList()
Initialize the work list for iteration.j
|
protected abstract DF_LatticeCell |
makeCell(Object key)
Create a new lattice cell, referenced by a given key
|
protected void |
newEquation(DF_LatticeCell lhs,
DF_Operator operator,
DF_LatticeCell op1)
Add an equation with one operand on the right-hand side.
|
protected void |
newEquation(DF_LatticeCell lhs,
DF_Operator operator,
DF_LatticeCell[] rhs)
Add an equation to the system with an arbitrary number of operands on
the right-hand side.
|
(package private) void |
newEquation(DF_LatticeCell lhs,
DF_Operator operator,
DF_LatticeCell op1,
DF_LatticeCell op2)
Add an equation with two operands on the right-hand side.
|
(package private) void |
newEquation(DF_LatticeCell lhs,
DF_Operator operator,
DF_LatticeCell op1,
DF_LatticeCell op2,
DF_LatticeCell op3)
Add an equation with three operands on the right-hand side.
|
private void |
numberEquationsTopological()
Number the equations in topological order.
|
(package private) void |
showGraphStats()
Debugging aid: print statistics about the dataflow system.
|
void |
solve()
Solve the set of dataflow equations.
|
String |
toString()
Return a string representation of the system
|
protected void |
updateWorkList(DF_Equation eq)
Update the worklist, assuming that a particular equation
has been re-evaluated
|
private static final boolean DEBUG
private final boolean EAGER
protected final TreeSet<DF_Equation> workList
private final HashSet<DF_Equation> newEquations
protected final DF_Solution cells
private static final Comparator<DF_Equation> dfComparator
public void solve()
PRECONDITION: equations are set up
public DF_Solution getSolution()
public Enumeration<DF_Equation> getEquations()
public int getNumberOfEquations()
public void addToWorkList(DF_Equation eq)
eq
- the equation to addpublic void addNewEquationsToWorkList()
public void addAllEquationsToWorkList()
public void changedCell(DF_LatticeCell cell)
cell
- the lattice cell that has changedprotected DF_LatticeCell findOrCreateCell(Object key)
key
- the key for the lattice cellprotected void newEquation(DF_LatticeCell lhs, DF_Operator operator, DF_LatticeCell op1)
lhs
- the lattice cell set by this equationoperator
- the equation operatorop1
- first operand on the rhsvoid newEquation(DF_LatticeCell lhs, DF_Operator operator, DF_LatticeCell op1, DF_LatticeCell op2)
lhs
- the lattice cell set by this equationoperator
- the equation operatorop1
- first operand on the rhsop2
- second operand on the rhsvoid newEquation(DF_LatticeCell lhs, DF_Operator operator, DF_LatticeCell op1, DF_LatticeCell op2, DF_LatticeCell op3)
lhs
- the lattice cell set by this equationoperator
- the equation operatorop1
- first operand on the rhsop2
- second operand on the rhsop3
- third operand on the rhsprotected void newEquation(DF_LatticeCell lhs, DF_Operator operator, DF_LatticeCell[] rhs)
lhs
- lattice cell set by this equationoperator
- the equation operatorrhs
- the operands on the rhsvoid addEquation(DF_Equation eq)
eq
- the equationpublic DF_LatticeCell getCell(Object key)
key
- the keypublic void addCellAppearancesToWorkList(DF_LatticeCell cell)
cell
- the cell in questionprotected abstract void initializeLatticeCells()
protected abstract void initializeWorkList()
protected abstract DF_LatticeCell makeCell(Object key)
key
- key to look up the new cell withprotected void updateWorkList(DF_Equation eq)
eq
- the equation that has been re-evaluated.private void numberEquationsTopological()
PRECONDITION: Already called addGraphEdges()
Algorithm:
void showGraphStats()