public class CFGBuilder
extends java.lang.Object
The translation of the AST to the CFG is split into three phases:
CFGBuilder.ExtendedNode
s. An extended node can either be
a Node
, or one of several meta elements such as a conditional or unconditional jump
or a node with additional information about exceptions. Some of the extended nodes contain
labels (e.g., for the jump target), and phase one additionally creates a mapping from
labels to extended nodes. Finally, the list of leaders is computed: A leader is an extended
node which will give rise to a basic block in phase two.
Modifier and Type | Class and Description |
---|---|
protected static class |
CFGBuilder.CFGTranslationPhaseOne
Class that performs phase one of the translation process.
|
protected static class |
CFGBuilder.CFGTranslationPhaseThree
Class that performs phase three of the translation process.
|
protected static class |
CFGBuilder.CFGTranslationPhaseTwo
Class that performs phase two of the translation process.
|
protected static class |
CFGBuilder.ConditionalJump
An extended node of type
CFGBuilder.ExtendedNode.ExtendedNodeType.CONDITIONAL_JUMP . |
protected static class |
CFGBuilder.ExtendedNode
An extended node can be one of several things (depending on its
type ):
NODE. |
protected static class |
CFGBuilder.Label
A label is used to refer to other extended nodes using a mapping from labels to extended
nodes.
|
protected static class |
CFGBuilder.NodeHolder
An extended node of type
NODE . |
protected static class |
CFGBuilder.NodeWithExceptionsHolder
An extended node of type
EXCEPTION_NODE . |
protected static class |
CFGBuilder.PhaseOneResult
A wrapper object to pass around the result of phase one.
|
protected static class |
CFGBuilder.TryCatchFrame
A TryCatchFrame contains an ordered list of catch labels that apply to exceptions with
specific types.
|
protected static class |
CFGBuilder.TryFinallyFrame
A TryFinallyFrame applies to exceptions of any type.
|
protected static class |
CFGBuilder.TryFinallyScopeCell
Storage cell for a single Label, with tracking whether it was accessed.
|
protected static class |
CFGBuilder.TryFinallyScopeMap
A map that keeps track of new labels added within a try block.
|
protected static interface |
CFGBuilder.TryFrame
A TryFrame takes a thrown exception type and maps it to a set of possible control-flow
successors.
|
protected static class |
CFGBuilder.TryStack
An exception stack represents the set of all try-catch blocks in effect at a given point in a
program.
|
protected static class |
CFGBuilder.Tuple<A,B,C>
Tuple class with up to three members.
|
protected static class |
CFGBuilder.UnconditionalJump
An extended node of type
CFGBuilder.ExtendedNode.ExtendedNodeType.UNCONDITIONAL_JUMP . |
Modifier | Constructor and Description |
---|---|
protected |
CFGBuilder() |
Modifier and Type | Method and Description |
---|---|
static ControlFlowGraph |
build(com.sun.source.tree.CompilationUnitTree root,
com.sun.source.tree.MethodTree tree,
com.sun.source.tree.ClassTree classTree,
javax.annotation.processing.ProcessingEnvironment env)
Build the control flow graph of a method.
|
static ControlFlowGraph |
build(com.sun.source.tree.CompilationUnitTree root,
UnderlyingAST underlyingAST,
boolean assumeAssertionsEnabled,
boolean assumeAssertionsDisabled,
javax.annotation.processing.ProcessingEnvironment env)
Build the control flow graph of some code.
|
static ControlFlowGraph |
build(com.sun.source.tree.CompilationUnitTree root,
UnderlyingAST underlyingAST,
javax.annotation.processing.ProcessingEnvironment env)
Build the control flow graph of some code.
|
static ControlFlowGraph |
build(com.sun.source.util.TreePath bodyPath,
UnderlyingAST underlyingAST,
boolean assumeAssertionsEnabled,
boolean assumeAssertionsDisabled,
javax.annotation.processing.ProcessingEnvironment env)
Build the control flow graph of some code (method, initializer block, ...).
|
protected static void |
printBlocks(java.util.Set<Block> blocks)
Print a set of
Block s and the edges between them. |
public static ControlFlowGraph build(com.sun.source.tree.CompilationUnitTree root, UnderlyingAST underlyingAST, boolean assumeAssertionsEnabled, boolean assumeAssertionsDisabled, javax.annotation.processing.ProcessingEnvironment env)
public static ControlFlowGraph build(com.sun.source.util.TreePath bodyPath, UnderlyingAST underlyingAST, boolean assumeAssertionsEnabled, boolean assumeAssertionsDisabled, javax.annotation.processing.ProcessingEnvironment env)
public static ControlFlowGraph build(com.sun.source.tree.CompilationUnitTree root, UnderlyingAST underlyingAST, javax.annotation.processing.ProcessingEnvironment env)
public static ControlFlowGraph build(com.sun.source.tree.CompilationUnitTree root, com.sun.source.tree.MethodTree tree, com.sun.source.tree.ClassTree classTree, javax.annotation.processing.ProcessingEnvironment env)