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 152690 2001-10-29 19:59:54Z jvanzyl $
accept, consumeStack, copy, dump, equals, getComparator, getLength, getName, getOpcode, initFromFile, produceStack, readInstruction, setComparator, toString, toString, toString |
position
protected int position
BranchInstruction
protected BranchInstruction(short opcode,
InstructionHandle target)Common super constructor
target - instruction to branch to
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