Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

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

Field Summary
int index
           
InstructionHandle target
           
 
Fields inherited from class DE.fub.inf.JVM.ClassGen.Instruction
length, position, tag
 
Constructor Summary
BranchInstruction(short tag, InstructionHandle target)
           
 
Method Summary
void dump(java.io.DataOutputStream out)
          Dump instruction as byte code to stream out.
InstructionHandle getTarget()
           
int getTargetOffset(Instruction target)
           
int getTargetOffset(InstructionHandle target)
           
int getTargetOffset()
           
void initFromFile(ByteSequence bytes, boolean wide)
          Read needed data (e.g. index) from file.
void setTarget(InstructionHandle target)
          Set branch target
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>
 
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
 

Field Detail

index

protected int index

target

protected InstructionHandle target
Constructor Detail

BranchInstruction

protected BranchInstruction(short tag,
                            InstructionHandle target)
Parameters:
instruction - Target instruction to branch to
Method Detail

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

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD