|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectpolyglot.visit.CFGBuilder
public class CFGBuilder
Class used to construct a CFG.
| Nested Class Summary | |
|---|---|
protected static class |
CFGBuilder.EdgeKeyTermPair
|
| Field Summary | |
|---|---|
protected DataFlow |
df
The data flow analysis for which we are constructing the graph. |
protected boolean |
errorEdgesToExitNode
True if we should add edges for uncaught Errors to the exit node of the graph. |
protected FlowGraph |
graph
The flowgraph under construction. |
protected Stmt |
innermostTarget
The innermost loop or try-block in lexical scope. |
protected CFGBuilder |
outer
The outer CFGBuilder. |
protected java.util.List |
path_to_finally
List of terms on the path to the innermost finally block. |
protected boolean |
skipInnermostCatches
True if we should skip the catch blocks for the innermost try when building edges for an exception throw. |
protected TypeSystem |
ts
The type system. |
| Constructor Summary | |
|---|---|
CFGBuilder(TypeSystem ts,
FlowGraph graph,
DataFlow df)
|
|
| Method Summary | |
|---|---|
java.lang.Object |
copy()
Copy the CFGBuilder. |
void |
edge(CFGBuilder p_visitor,
Term p,
Term q,
FlowGraph.EdgeKey edgeKey)
|
void |
edge(Term p,
Term q)
Add an edge to the CFG from p to q. |
void |
edge(Term p,
Term q,
FlowGraph.EdgeKey edgeKey)
Add an edge to the CFG from p to q. |
protected CFGBuilder |
enterFinally(Term from)
Enter a finally block. |
CFGBuilder |
push(Stmt n)
Construct a new CFGBuilder with the a new innermost loop or try-block n. |
CFGBuilder |
push(Stmt n,
boolean skipInnermostCatches)
Construct a new CFGBuilder with the a new innermost loop or try-block n, optionally skipping innermost catch blocks. |
protected static CFGBuilder |
tryFinally(CFGBuilder v,
Term last,
CFGBuilder last_visitor,
Block finallyBlock)
Create edges for the finally block of a try-finally construct. |
TypeSystem |
typeSystem()
Get the type system. |
void |
visitBranchTarget(Branch b)
Visit edges from a branch. |
void |
visitCFG(Term a,
FlowGraph.EdgeKey edgeKey,
java.util.List succ)
Create edges from node a to all successors succ
with the EdgeKey edgeKey for all edges created. |
void |
visitCFG(Term a,
FlowGraph.EdgeKey edgeKey,
Term succ)
Create an edge for a node a with a single successor
succ, and EdgeKey edgeKey |
void |
visitCFG(Term a,
FlowGraph.EdgeKey edgeKey1,
Term succ1,
FlowGraph.EdgeKey edgeKey2,
Term succ2)
Create edges from node a to successors succ1
and succ2 with EdgeKeys edgeKey1 and
edgeKey2 respecitvely. |
protected void |
visitCFG(Term a,
java.util.List succs)
Create edges for a node a with successors
succs. |
void |
visitCFG(Term a,
Term succ)
Create an edge for a node a with a single successor
succ. |
void |
visitCFGList(java.util.List elements,
Term after)
Utility function to visit all edges in a list. |
void |
visitGraph()
Visit the AST, constructing the CFG. |
void |
visitReturn(Return r)
Visit edges for a return statement. |
void |
visitThrow(Term a)
|
void |
visitThrow(Term t,
Type type)
Create edges for an exception thrown from term t. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected FlowGraph graph
protected TypeSystem ts
protected CFGBuilder outer
protected Stmt innermostTarget
protected java.util.List path_to_finally
protected DataFlow df
protected boolean skipInnermostCatches
protected boolean errorEdgesToExitNode
| Constructor Detail |
|---|
public CFGBuilder(TypeSystem ts,
FlowGraph graph,
DataFlow df)
| Method Detail |
|---|
public TypeSystem typeSystem()
public java.lang.Object copy()
copy in interface Copypublic CFGBuilder push(Stmt n)
n.
public CFGBuilder push(Stmt n,
boolean skipInnermostCatches)
n, optionally skipping innermost catch blocks.
public void visitBranchTarget(Branch b)
public void visitReturn(Return r)
public void visitGraph()
public void visitCFGList(java.util.List elements,
Term after)
public void visitCFG(Term a,
Term succ)
a with a single successor
succ.
The EdgeKey used for the edge from a to succ
will be FlowGraph.EDGE_KEY_OTHER
public void visitCFG(Term a,
FlowGraph.EdgeKey edgeKey,
Term succ)
a with a single successor
succ, and EdgeKey edgeKey
public void visitCFG(Term a,
FlowGraph.EdgeKey edgeKey1,
Term succ1,
FlowGraph.EdgeKey edgeKey2,
Term succ2)
a to successors succ1
and succ2 with EdgeKeys edgeKey1 and
edgeKey2 respecitvely.
public void visitCFG(Term a,
FlowGraph.EdgeKey edgeKey,
java.util.List succ)
a to all successors succ
with the EdgeKey edgeKey for all edges created.
protected void visitCFG(Term a,
java.util.List succs)
a with successors
succs.
a - the source node for the edges.succs - a list of EdgeKeyTermPairspublic void visitThrow(Term a)
public void visitThrow(Term t,
Type type)
t.
protected static CFGBuilder tryFinally(CFGBuilder v,
Term last,
CFGBuilder last_visitor,
Block finallyBlock)
v - v.innermostTarget is the Try term that the finallyBlock is assoicated with. @@@XXXlast - the last term visited before the finally block is entered.last_visitor - @@@XXXfinallyBlock - the finally block associated with a try finally block.protected CFGBuilder enterFinally(Term from)
from appended.
public void edge(Term p,
Term q)
p to q.
public void edge(Term p,
Term q,
FlowGraph.EdgeKey edgeKey)
p to q.
public void edge(CFGBuilder p_visitor,
Term p,
Term q,
FlowGraph.EdgeKey edgeKey)
p_visitor - The visitor used to create p ("this" is the visitor
that created q)p - The predecessor node in the forward graphq - The successor node in the forward graph
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||