|
SandMark version 3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--sandmark.obfuscate.boolsplitter.dcfg.Subroutine
Subroutine represents a subroutine (target of a jsr instruction) in java bytecode. Subroutines are used to implement the finally part of a try-catch-finally block.
Each Subroutine belongs in a control flow graph, has an entry and exit block, and has a local variable that contains its return address. Additionally, it maintains a list of paths from blocks in which the subroutine is called to block that is executed after the subroutine returns.
Note that it is assumed that each subroutine ends with a ret. While this is true for bytecode generated by javac, it is not required.
AddressStoreStmt
,
Block
Field Summary | |
(package private) Block |
entry
|
(package private) Block |
exit
|
(package private) FlowGraph |
graph
|
(package private) java.util.ArrayList |
paths
|
(package private) EDU.purdue.cs.bloat.editor.LocalVariable |
returnAddress
|
Constructor Summary | |
Subroutine(FlowGraph graph)
Constructor. |
Method Summary | |
void |
addPath(Block callerBlock,
Block returnBlock)
Adds a path from the block before a Subroutine is called to a block after the subroutine is called. |
Block |
entry()
Returns the first Block in the subroutine. |
Block |
exit()
Returns the last Block in the subroutine. |
FlowGraph |
graph()
Returns the CFG that contains this subroutine. |
int |
numPaths()
Returns the number of places that this subroutine is called. |
java.util.Collection |
paths()
Returns the paths (a Collection of two-element arrays of Blocks) that represent the Blocks that end in a call to this subroutine and the block that begin with the return address from this subroutine. |
Block |
pathSource(Block block)
Returns the "caller block" for a given "return block". |
Block |
pathTarget(Block block)
Returns the "return block" for a given "caller block". |
void |
print(java.io.PrintStream out)
Prints a textual representation of this Subroutine. |
void |
removeAllPaths()
Removes all caller-return paths. |
void |
removePath(Block callerBlock,
Block returnBlock)
Removes a path between a caller Block and a return Block. |
void |
removePathsContaining(Block block)
Removes all paths involving block regardless of whether it is a calling (source) block or a returning (target) block. |
EDU.purdue.cs.bloat.editor.LocalVariable |
returnAddress()
Returns the local variable containing the return address of this subroutine. |
void |
setEntry(Block entry)
Sets the entry Block for this Subroutine. |
void |
setExit(Block exit)
Sets the exit Block for this Subroutine. |
void |
setReturnAddress(EDU.purdue.cs.bloat.editor.LocalVariable returnAddress)
Sets the address (stored in a LocalVariable) to which this subroutine will return once it is finished. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
FlowGraph graph
Block entry
Block exit
java.util.ArrayList paths
EDU.purdue.cs.bloat.editor.LocalVariable returnAddress
Constructor Detail |
public Subroutine(FlowGraph graph)
graph
- The CFG containing the block.Method Detail |
public EDU.purdue.cs.bloat.editor.LocalVariable returnAddress()
public void setReturnAddress(EDU.purdue.cs.bloat.editor.LocalVariable returnAddress)
returnAddress
- Local variable that stores the address to which the
subroutine returns when it is completed.Tree.visit_astore(EDU.purdue.cs.bloat.editor.Instruction)
public int numPaths()
public java.util.Collection paths()
public FlowGraph graph()
public void removePathsContaining(Block block)
public void removePath(Block callerBlock, Block returnBlock)
public void removeAllPaths()
public void addPath(Block callerBlock, Block returnBlock)
callerBlock
- The block in which the subroutine is called. This Block
ends with a jsr to this subroutine.returnBlock
- The block to which the subroutine returns. This Block
begins at the return address of this subroutine.public Block pathTarget(Block block)
public Block pathSource(Block block)
public void setEntry(Block entry)
public void setExit(Block exit)
public Block entry()
public Block exit()
public void print(java.io.PrintStream out)
out
- The PrintStream to which to print.public java.lang.String toString()
toString
in class java.lang.Object
|
SandMark version 3.0 Wed Jan 29 10:30:05 MST 2003 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |