de.rwth.dfa.jvm
Class GraphSolver
java.lang.Object
|
+--de.rwth.dfa.jvm.Solver
|
+--de.rwth.dfa.jvm.GraphSolver
- Direct Known Subclasses:
- FactorisedFlowGraphSolver
- public abstract class GraphSolver
- extends Solver
An abstract class for a graph based JVM abstraction solver. The solution is
computed using the classical iterative algorithm provided by the class DataFlowSolver.
To get a working implementation, the methods createGraph(),
getInit(Graph.Node,boolean), getFunction(Graph.Node),
and
transferSolution(FlowGraph,Graph.NodeDyer,boolean,boolean,Object[]))must
be provided.
- Version:
- $Id: GraphSolver.java,v 1.3 2002/09/17 06:53:53 mohnen Exp $
- Author:
- Markus Mohnen
|
Constructor Summary |
GraphSolver(Abstraction abstraction,
java.lang.String methodName,
de.fub.bytecode.generic.InstructionList methodInstrs,
de.fub.bytecode.classfile.CodeException[] methodExceptions)
Creates a new GraphSolver instance with out stop watch. |
GraphSolver(Abstraction abstraction,
java.lang.String methodName,
de.fub.bytecode.generic.InstructionList methodInstrs,
de.fub.bytecode.classfile.CodeException[] methodExceptions,
Stopwatch stopwatch)
Creates a new GraphSolver instance with stop watch. |
|
Method Summary |
protected void |
compute(java.lang.Object[] solution,
boolean isForward,
boolean isAll)
Implements the graph based solution:
A graph is created using createGraph(). |
protected abstract RootedGraph |
createGraph()
Supposed to compute the graph from the method to be analyzed. |
protected abstract java.lang.Object |
getFunction(RootedGraph.Node n)
Supposed to compute the transfer function value of a node. |
protected abstract java.lang.Object |
getInit(RootedGraph.Node n,
boolean isForward)
Supposed to compute the initial value of a node. |
protected abstract void |
transferSolution(RootedGraph graph,
Graph.NodeDyer gsolution,
boolean isForward,
boolean isAll,
java.lang.Object[] solution)
Supposed to transfer a graph based solution to an array. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
GraphSolver
public GraphSolver(Abstraction abstraction,
java.lang.String methodName,
de.fub.bytecode.generic.InstructionList methodInstrs,
de.fub.bytecode.classfile.CodeException[] methodExceptions,
Stopwatch stopwatch)
- Creates a new
GraphSolver instance with stop watch.
- Parameters:
abstraction - an Abstraction valuemethodName - a String valuemethodInstrs - an InstructionList valuemethodExceptions - a CodeException[] valuestopwatch - a Stopwatch value
GraphSolver
public GraphSolver(Abstraction abstraction,
java.lang.String methodName,
de.fub.bytecode.generic.InstructionList methodInstrs,
de.fub.bytecode.classfile.CodeException[] methodExceptions)
- Creates a new
GraphSolver instance with out stop watch.
- Parameters:
abstraction - an Abstraction valuemethodName - a String valuemethodInstrs - an InstructionList valuemethodExceptions - a CodeException[] valuestopwatch - a Stopwatch value
compute
protected void compute(java.lang.Object[] solution,
boolean isForward,
boolean isAll)
throws java.lang.IllegalArgumentException
- Implements the graph based solution:
- A graph is created using
createGraph().
- If there is a stop watch,
stopwatch.split("graph creation") is
executed.
- An initial coloring of the graph is done using
getInit(Node).
- The transfer functions of the nodes are computed using
getFunction(Node).
- If there is a stop watch,
stopwatch.split("solver init") is
executed.
- The solution and the number of iterations are computed using
DataFlowSolver.
- If there is a stop watch,
stopwatch.split("solving") is
executed.
- The solution is transfered from graph level to instruction level using
transferSolution(FlowGraph,Graph.NodeDyer,boolean,boolean,Object[])).
- If there is a stop watch,
stopwatch.split("transfer") is
executed.
- Overrides:
compute in class Solver
- Parameters:
solution - an Object[] valueisForward - a boolean valueisAll - a boolean value- Throws:
java.lang.IllegalArgumentException - if an error occurs
createGraph
protected abstract RootedGraph createGraph()
- Supposed to compute the graph from the method to be analyzed.
- Returns:
- a
RootedGraph value
getInit
protected abstract java.lang.Object getInit(RootedGraph.Node n,
boolean isForward)
- Supposed to compute the initial value of a node. It must be an element of the
lattice of the abstraction.
- Parameters:
n - a Graph.Node valueisForward - a boolean value- Returns:
- an
Object value
getFunction
protected abstract java.lang.Object getFunction(RootedGraph.Node n)
- Supposed to compute the transfer function value of a node. It must be an
monotonic endomorphism on the lattice of the abstraction.
- Parameters:
n - a Graph.Node value- Returns:
- an
Object value
transferSolution
protected abstract void transferSolution(RootedGraph graph,
Graph.NodeDyer gsolution,
boolean isForward,
boolean isAll,
java.lang.Object[] solution)
- Supposed to transfer a graph based solution to an array.
- Parameters:
graph - a RootedGraph valuegsolution - a Graph.NodeDyer valueisForward - a boolean valueisAll - a boolean valuesolution - an Object[] value