To obtain the control flow graph, do the following:
CtMethod m = ... ControlFlow cf = new ControlFlow(m); Block[] blocks = cf.basicBlocks();
blocks is an array of basic blocks in
that method body.
javassist.CtMethod , Block, Frame, Analyzer
| Modifier and Type | Class and Description |
|---|---|
| pack-priv abstract static class | |
| public static class | ControlFlow.
Basic block. |
| public static class | ControlFlow.
Represents a catch clause. |
| public static class | ControlFlow.
A node of (post) dominator trees. |
| Modifier and Type | Field and Description |
|---|---|
| private ControlFlow. | |
| private CtClass | |
| private Frame[] | |
| private MethodInfo |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public ControlFlow. | Returns: an array of basic blocks, the array has length 0 if the method doesn't have code.Returns all the basic blocks in the method body. |
| public ControlFlow. | Returns: an array of the tree nodes, or null if the method doesn't have code.Constructs a dominator tree. |
| public Frame | frameAt(int
the position. pos)Returns the types of the local variables and stack frame entries available at the given position. |
| public ControlFlow. | Returns: an array of the tree nodes, or null if the method doesn't have code.Constructs a post dominator tree. |
| basicBlocks | back to summary |
|---|---|
| private ControlFlow. | |
| clazz | back to summary |
|---|---|
| private CtClass clazz | |
| frames | back to summary |
|---|---|
| private Frame[] frames | |
| methodInfo | back to summary |
|---|---|
| private MethodInfo methodInfo | |
| ControlFlow | back to summary |
|---|---|
| public ControlFlow(CtMethod method) throws BadBytecode Constructs a control-flow analyzer for the given method. | |
| ControlFlow | back to summary |
|---|---|
| public ControlFlow(CtClass ctclazz, MethodInfo minfo) throws BadBytecode Constructs a control-flow analyzer. | |
| basicBlocks | back to summary |
|---|---|
| public ControlFlow. Returns all the basic blocks in the method body.
| |
| dominatorTree | back to summary |
|---|---|
| public ControlFlow. Constructs a dominator tree. This method returns an array of the tree nodes. The first element of the array is the root of the tree. The order of the elements is the same as that
of the elements in the
| |
| frameAt | back to summary |
|---|---|
| public Frame frameAt(int pos) throws BadBytecode Returns the types of the local variables and stack frame entries available at the given position. If the byte at the position is not the first byte of an instruction, then this method returns null.
| |
| postDominatorTree | back to summary |
|---|---|
| public ControlFlow. Constructs a post dominator tree. This method returns an array of the tree nodes. Note that the tree has multiple roots. The parent of the root nodes is null. The order of the elements is the same as that
of the elements in the
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv ControlFlow. |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv abstract BasicBlock[] | |
| pack-priv abstract BasicBlock[] | |
| pack-priv ControlFlow. |
| all | back to summary |
|---|---|
| pack-priv ControlFlow. | |
| Access | back to summary |
|---|---|
| pack-priv Access(ControlFlow. | |
| entrances | back to summary |
|---|---|
| pack-priv abstract BasicBlock[] entrances(ControlFlow. | |
| exits | back to summary |
|---|---|
| pack-priv abstract BasicBlock[] exits(ControlFlow. | |
| node | back to summary |
|---|---|
| pack-priv ControlFlow. | |
JSR,
we deal with JSR as a non-branch instruction.
| Modifier and Type | Field and Description |
|---|---|
| public Object | clientData
A field that can be freely used for storing extra data. |
| pack-priv ControlFlow. | |
| pack-priv int | |
| pack-priv MethodInfo |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public ControlFlow. | |
| public ControlFlow. | exit(int
an index in the array of exit blocks. n)Returns the n-th block that may be executed after this block. |
| public int | |
| pack-priv BasicBlock[] | |
| public ControlFlow. | |
| public int | |
| public int | index()
Returns the position of this block in the array of
basic blocks that the |
| public int | |
| public int | |
| protected void |
| clientData | back to summary |
|---|---|
| public Object clientData A field that can be freely used for storing extra data.
A client program of this control-flow analyzer can append
an additional attribute to a | |
| entrances | back to summary |
|---|---|
| pack-priv ControlFlow. | |
| index | back to summary |
|---|---|
| pack-priv int index | |
| method | back to summary |
|---|---|
| pack-priv MethodInfo method | |
| Block | back to summary |
|---|---|
| pack-priv Block(int pos, MethodInfo minfo) | |
| catchers | back to summary |
|---|---|
| public ControlFlow. Returns catch clauses that will catch an exception thrown in this block. | |
| exit | back to summary |
|---|---|
| public ControlFlow. Returns the n-th block that may be executed after this block.
| |
| exits | back to summary |
|---|---|
| public int exits() Return the number of the blocks that may be executed after this block. | |
| getExit | back to summary |
|---|---|
| pack-priv BasicBlock[] getExit() | |
| incoming | back to summary |
|---|---|
| public ControlFlow. Returns the block that the control may jump into this block from. | |
| incomings | back to summary |
|---|---|
| public int incomings() Returns the number of the control paths entering this block. | |
| index | back to summary |
|---|---|
| public int index() Returns the position of this block in the array of
basic blocks that the
| |
| length | back to summary |
|---|---|
| public int length() Returns the length of this block. | |
| position | back to summary |
|---|---|
| public int position() Returns the position of the first instruction in this block. | |
| toString2 | back to summary |
|---|---|
| protected void toString2(StringBuilder sbuf) Overrides javassist.
| |
| Modifier and Type | Field and Description |
|---|---|
| private ControlFlow. | |
| private int |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public ControlFlow. | |
| public String |
| node | back to summary |
|---|---|
| private ControlFlow. | |
| typeIndex | back to summary |
|---|---|
| private int typeIndex | |
| Catcher | back to summary |
|---|---|
| pack-priv Catcher(BasicBlock. | |
| block | back to summary |
|---|---|
| public ControlFlow. Returns the first block of the catch clause. | |
| type | back to summary |
|---|---|
| public String type() Returns the name of the exception type that this catch clause catches. | |
| Modifier and Type | Field and Description |
|---|---|
| private ControlFlow. | |
| private ControlFlow. | |
| private ControlFlow. |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public ControlFlow. | |
| public ControlFlow. | |
| public int | |
| private static ControlFlow. | |
| pack-priv int | makeDepth1stTree(ControlFlow.
|
| pack-priv boolean | |
| public ControlFlow. | |
| private static void | |
| public String |
| block | back to summary |
|---|---|
| private ControlFlow. | |
| children | back to summary |
|---|---|
| private ControlFlow. | |
| parent | back to summary |
|---|---|
| private ControlFlow. | |
| Node | back to summary |
|---|---|
| pack-priv Node(ControlFlow. | |
| block | back to summary |
|---|---|
| public ControlFlow. Returns the basic block indicated by this node. | |
| child | back to summary |
|---|---|
| public ControlFlow. Returns the n-th child of this node.
| |
| children | back to summary |
|---|---|
| public int children() Returns the number of the children of this node. | |
| getAncestor | back to summary |
|---|---|
| private static ControlFlow. | |
| makeDepth1stTree | back to summary |
|---|---|
| pack-priv int makeDepth1stTree(ControlFlow. | |
| makeDominatorTree | back to summary |
|---|---|
| pack-priv boolean makeDominatorTree(boolean[] visited, int[] distance, ControlFlow. | |
| parent | back to summary |
|---|---|
| public ControlFlow. Returns the parent of this node. | |
| setChildren | back to summary |
|---|---|
| private static void setChildren(ControlFlow. | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Returns a
| |