Class DE.fub.inf.JVM.ClassGen.BranchInstruction
java.lang.Object
|
+--DE.fub.inf.JVM.ClassGen.Instruction
|
+--DE.fub.inf.JVM.ClassGen.BranchInstruction
- Subclasses:
- GOTO_W, GOTO, IfInstruction, JSR_W, JSR, Select
- public abstract class BranchInstruction
- extends Instruction
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.3 1998/08/14 16:56:09 dahm Exp $
- Author:
- M. Dahm
- See Also:
- InstructionList, Serialized Form
Methods inherited from class DE.fub.inf.JVM.ClassGen.Instruction |
consumeStack, dump, getInstructionList, getLength, getPosition, getTag, initFromFile, produceStack, readInstruction, setPosition, toString, toString, toString, updatePosition |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait |
index
protected int index
target
protected InstructionHandle target
BranchInstruction
protected BranchInstruction(short tag,
InstructionHandle target)
- Parameters:
instruction
- Target instruction to branch to
dump
public void dump(java.io.DataOutputStream out)
throws java.io.IOException
- Dump instruction as byte code to stream out.
- Parameters:
out
- Output stream- Overrides:
- dump in class Instruction
getTarget
public InstructionHandle getTarget()
- Returns:
- target of branch instruction
setTarget
public void setTarget(InstructionHandle target)
- Set branch target
getTargetOffset
protected int getTargetOffset(Instruction target)
- Parameters:
target
- branch target- Returns:
- the offset to `target' relative to this 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
toString
public java.lang.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 java.io.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