org.apache.bcel.generic
Class BranchInstruction
- Cloneable, InstructionTargeter, Serializable
public abstract class BranchInstruction
Abstract super class for branching instructions like GOTO, IFEQ, etc..
Branch instructions may have a variable length, namely GOTO, JSR,
LOOKUPSWITCH and TABLESWITCH.
$Id: BranchInstruction.java 386056 2006-03-15 11:31:56Z tcurdt $
accept , className , consumeStack , copy , dispose , dump , equals , getComparator , getLength , getName , getOpcode , initFromFile , produceStack , readInstruction , setComparator , setOpcode , toString , toString , toString |
position
protected int position
BranchInstruction
(package private) BranchInstruction()
Empty constructor needed for the Class.newInstance() statement in
Instruction.readInstruction(). Not to be used otherwise.
BranchInstruction
protected BranchInstruction(short opcode,
InstructionHandle target)
Common super constructor
opcode
- Instruction opcodetarget
- instruction to branch to
dispose
(package private) void dispose()
Inform target that it's not targeted anymore.
- dispose in interface Instruction
dump
public void dump(DataOutputStream out)
throws IOException
Dump instruction as byte code to stream out.
- dump in interface Instruction
getIndex
public final int getIndex()
- target offset in byte code
getTargetOffset
protected int getTargetOffset()
- the offset to this instruction's target
getTargetOffset
protected int getTargetOffset(InstructionHandle _target)
- the offset to `target' relative to this instruction
initFromFile
protected void initFromFile(ByteSequence bytes,
boolean wide)
throws IOException
Read needed data (e.g. index) from file. Conversion to a InstructionHandle
is done in InstructionList(byte[]).
- initFromFile in interface Instruction
bytes
- input streamwide
- wide prefix?
toString
public String toString(boolean verbose)
Long output format:
<position in byte code>
<name of opcode> "["<opcode number>"]"
"("<length of instruction>")"
"<"<target instruction>">" "@"<branch target offset>
- toString in interface Instruction
verbose
- long/short format switch
updatePosition
protected int updatePosition(int offset,
int max_offset)
Called by InstructionList.setPositions when setting the position for every
instruction. In the presence of variable length instructions `setPositions'
performs multiple passes over the instruction list to calculate the
correct (byte) positions and offsets by calling this function.
offset
- additional offset caused by preceding (variable length) instructionsmax_offset
- the maximum offset that may be caused by these instructions
- additional offset caused by possible change of this instruction's length