|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--de.rwth.dfa.DataFlowSolver
Implements the text-book graph based data flow analysis algorithm. Given a data flow problem, it computes the maximum fixed point (MPF) solution.
Field Summary | |
protected boolean |
forward
Forward (along the edges) or backward (opposite the edges) data flow problem? |
protected Graph.NodeDyer |
functions
The transfer functions for the computation. |
protected RootedGraph |
g
The graph to operate on. |
protected Graph.NodeDyer |
inits
The initial values for the computation. |
protected boolean |
isAll
Universal (meet) or existential (join) data flow problem? |
protected long |
iterations
Number of iterations computed so far. |
protected long |
iterationsBound
Upper bound for the number of iterations. |
protected Lattice |
l
The lattice for the values and on which the functions operate. |
protected java.lang.Class |
worklistFactory
The class used to create a new work list. |
Constructor Summary | |
DataFlowSolver(RootedGraph g,
Graph.NodeDyer inits,
Graph.NodeDyer functions,
boolean isAll,
boolean forward)
Creates a new DataFlowSolver instance with default upper bound and
work list StackWorklist . |
|
DataFlowSolver(RootedGraph g,
Graph.NodeDyer inits,
Graph.NodeDyer functions,
boolean isAll,
boolean forward,
long iterationsBound,
java.lang.Class worklistFactory)
Creates a new DataFlowSolver instance. |
Method Summary | |
protected void |
addDepending(Worklist worklist,
Graph.Node node)
Adds all nodes which depend on a specific node in the graph of this solver to a work list. |
long |
getIterations()
Returns the number of iterations used in solve() . |
protected java.lang.Object |
recompute(Graph.Node node,
Graph.NodeDyer values)
Recomputes the value for node in the graph of this data flow solver. |
Graph.NodeDyer |
solve()
Solves this data flow problem. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected RootedGraph g
protected Graph.NodeDyer inits
g
protected Graph.NodeDyer functions
g
protected Lattice l
protected boolean isAll
protected boolean forward
protected long iterations
protected long iterationsBound
protected java.lang.Class worklistFactory
Constructor Detail |
public DataFlowSolver(RootedGraph g, Graph.NodeDyer inits, Graph.NodeDyer functions, boolean isAll, boolean forward, long iterationsBound, java.lang.Class worklistFactory) throws java.lang.IllegalArgumentException
DataFlowSolver
instance. The data flow problem is
described by a graph g
, colorings of the graph giving initial
values and transfer function, kind of problem, and direction of control flow in
the graph. The functions must be monotonic on the underlying
lattice! Otherwise, the computation may be complete nonsense and
terminate only when the upper bound of iterations is reached.g
- a RootedGraph
valueinits
- a Graph.NodeDyer
valuefunctions
- a Graph.NodeDyer
valueisAll
- a boolean
valueforward
- a boolean
valueiterationsBound
- a long
valueworklistFactory
- a Class
valuejava.lang.IllegalArgumentException
- if
functions
is not a Function
.functions
does not have identical
domain and range (endomorphism).functions
does not have a Lattice
as domain and range.functions
have the same domain and
range.inits
is not an element of the unique
Lattice
determined by functions
.public DataFlowSolver(RootedGraph g, Graph.NodeDyer inits, Graph.NodeDyer functions, boolean isAll, boolean forward) throws java.lang.IllegalArgumentException
DataFlowSolver
instance with default upper bound and
work list StackWorklist
.g
- a RootedGraph
valueinits
- a Graph.NodeDyer
valuefunctions
- a Graph.NodeDyer
valueisAll
- a boolean
valueforward
- a boolean
valuejava.lang.IllegalArgumentException
- if an error occursDataFlowSolver(RootedGraph, Graph.NodeDyer, Graph.NodeDyer, boolean , boolean, long, Class)
Method Detail |
public long getIterations()
solve()
.long
value: If solve was not called so for, -1
protected java.lang.Object recompute(Graph.Node node, Graph.NodeDyer values) throws FunctionException
node
in the graph of this data flow solver.node
- a Graph.Node
valuevalues
- a Graph.NodeDyer
valueObject
valueFunctionException
- if on the functions in the functions
of this data flow solver throws this exception.protected void addDepending(Worklist worklist, Graph.Node node)
worklist
- a Worklist
valuenode
- a Graph.Node
valuepublic Graph.NodeDyer solve() throws java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.ClassCastException, FunctionException, java.lang.IllegalArgumentException
Graph.NodeDyer
value: The results as coloring of the graph.java.lang.InstantiationException
- if this exception is caused by creating a new
instance of the work list factory.java.lang.IllegalAccessException
- if this exception is caused by creating a new
instance of the work list factory.java.lang.ClassCastException
- if the new instance created by the work list
factory is not a work list.FunctionException
- if one of the functions throws itjava.lang.IllegalArgumentException
- if the number of iterations reaches the
upper bound.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |