All Packages Class Hierarchy This Package Previous Next Index
Class de.fub.bytecode.generic.BranchInstruction
java.lang.Object
|
+----de.fub.bytecode.generic.Instruction
|
+----de.fub.bytecode.generic.BranchInstruction
- public abstract class BranchInstruction
- extends Instruction
- implements InstructionTargeter
Abstract super class for branching instructions like GOTO, IFEQ, etc..
Branch instructions may have a variable length, namely GOTO, JSR,
LOOKUPSWITCH and TABLESWITCH.
- Version:
- $Id: BranchInstruction.java,v 1.10 1999/09/09 07:42:46 dahm Exp $
- Author:
- M. Dahm
- See Also:
- InstructionList
-
index
-
-
position
-
-
target
-
-
BranchInstruction(short, InstructionHandle)
-
-
containsTarget(InstructionHandle)
-
-
dump(DataOutputStream)
- Dump instruction as byte code to stream out.
-
getTarget()
-
-
getTargetOffset()
-
-
getTargetOffset(InstructionHandle)
-
-
initFromFile(ByteSequence, boolean)
- Read needed data (e.g.
-
setTarget(InstructionHandle)
- Set branch target
-
toString(boolean)
- Long output format:
<position in byte code>
<name of opcode> "["<opcode number>"]"
"("<length of instruction>")"
"<"<target instruction>">" "
-
updatePosition(int, int)
- Called by InstructionList.setPositions when setting the position for every
instruction.
-
updateTarget(InstructionHandle, InstructionHandle)
-
index
protected int index
target
protected InstructionHandle target
position
protected int position
BranchInstruction
protected BranchInstruction(short tag,
InstructionHandle target)
- Parameters:
- instruction - Target instruction to branch to
dump
public void dump(DataOutputStream out) throws IOException
- Dump instruction as byte code to stream out.
- Parameters:
- out - Output stream
- Overrides:
- dump in class Instruction
getTargetOffset
protected int getTargetOffset(InstructionHandle target)
- Parameters:
- target - branch target
- Returns:
- the offset to `target' relative to this instruction
getTargetOffset
protected int getTargetOffset()
- Returns:
- the offset to this instruction's target
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.
- Parameters:
- offset - additional offset caused by preceding (variable length) instructions
- max_offset - the maximum offset that may be caused by these instructions
- Returns:
- additional offset caused by possible change of this instruction's length
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>
- Parameters:
- verbose - long/short format switch
- Returns:
- mnemonic for instruction
- Overrides:
- toString in class 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[]).
- Overrides:
- initFromFile in class Instruction
- See Also:
- InstructionList
getTarget
public InstructionHandle getTarget()
- Returns:
- target of branch instruction
setTarget
public void setTarget(InstructionHandle target)
- Set branch target
updateTarget
public void updateTarget(InstructionHandle old_ih,
InstructionHandle new_ih)
- Parameters:
- old_ih - old target
- new_ih - new target
containsTarget
public boolean containsTarget(InstructionHandle ih)
- Returns:
- true, if ih is target of this instruction
All Packages Class Hierarchy This Package Previous Next Index