|
Jode 1.90-CVS Build Aug 6, 2004 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.jode.bytecode.Block
Represents a single basic block. It contains a list of instructions and the successor blocks.
All jump instructions must be at the end of the block. These
jump instructions are opc_lookupswitch
,
opc_if
xxx, opc_jsr
, opc_ret
,
opc_
xreturn
and opc_return
.
An opc_goto
is implicit if the basic block doesn't end
with a jump instructions, or if it ends with an conditional jump or
jsr.
The jump instructions don't remember their destinations, instead the Block does it. This are the successor block. There are several cases:
opc_lookupswitch
with
n
values. Then there must be n+1
successors where the first n
successors correspond to
the values and the last successor is the default successor.opc_if
xxx, then there must be two
successors: The first one is the successor if the condition evaluates
to true, the second one is for the false branch. opc_jsr
, then there must be two
successors: The first one is the subroutine, the second is the next
block after the subroutine. opc_
xreturn or
opc_ret
, then there must no successor at all. If any successor is null
it represents end of
method, i.e. a return instruction. You can also use
null
successors for conditional jumps and switch
instruction. You normally shouldn't use opc_return
instructions. They are only necessary, if you want to return with
a non-empty stack.
BasicBlocks
,
Instruction
Constructor Summary | |
Block()
Creates a new block uninitialized block. |
Method Summary | |
void |
dumpCode(java.io.PrintWriter output)
|
int |
getBlockNr()
Gets the block number. |
Handler[] |
getHandlers()
Gets the exception handlers whose try region contains this block. |
Instruction[] |
getInstructions()
Gets the list of instructions. |
int |
getStackHeight()
Returns the stack height at the beginning of the block. |
void |
getStackPopPush(int[] poppush)
|
Block[] |
getSuccs()
Gets the successor array. |
void |
setCode(Instruction[] instrs,
Block[] succs)
Set the code, i.e. instructions and successor blocks. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Block()
Method Detail |
public Instruction[] getInstructions()
public Block[] getSuccs()
public Handler[] getHandlers()
BasicBlocks.setBlocks(net.sf.jode.bytecode.Block[], net.sf.jode.bytecode.Block, net.sf.jode.bytecode.Handler[])
public int getBlockNr()
BasicBlocks.getBlock()[i].getBlockNr() == ialways holds (as long as you don't do something dirty, like adding the same block to different BasicBlocks, or to the same but more than once).
public int getStackHeight()
public void getStackPopPush(int[] poppush)
public void setCode(Instruction[] instrs, Block[] succs)
public void dumpCode(java.io.PrintWriter output)
public java.lang.String toString()
|
Jode 1.90-CVS Build Aug 6, 2004 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |