java.lang.Object
Compil3r.BytecodeAnalysis.Bytecodes.Instruction
Compil3r.BytecodeAnalysis.Bytecodes.BranchInstruction
- All Implemented Interfaces:
- Bytecodes.InstructionTargeter, java.lang.Cloneable, java.io.Serializable
- Direct Known Subclasses:
- Bytecodes.GotoInstruction, Bytecodes.IfInstruction, Bytecodes.JsrInstruction, Bytecodes.Select
- Enclosing class:
- Bytecodes
- public abstract static class Bytecodes.BranchInstruction
- extends Bytecodes.Instruction
- implements Bytecodes.InstructionTargeter
index
protected int index
target
protected Bytecodes.InstructionHandle target
position
protected int position
Bytecodes.BranchInstruction
Bytecodes.BranchInstruction()
- Empty constructor needed for the Class.newInstance() statement in
Instruction.readInstruction(). Not to be used otherwise.
Bytecodes.BranchInstruction
protected Bytecodes.BranchInstruction(short opcode,
Bytecodes.InstructionHandle target)
- Common super constructor
dump
public void dump(java.io.DataOutputStream out)
throws java.io.IOException
- Dump instruction as byte code to stream out.
- Overrides:
dump in class Bytecodes.Instruction
getTargetOffset
protected int getTargetOffset(Bytecodes.InstructionHandle target)
getTargetOffset
protected int getTargetOffset()
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.
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>
- Overrides:
toString in class Bytecodes.Instruction
initFromFile
protected void initFromFile(Clazz.jq_ConstantPool cp,
Util.IO.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 Bytecodes.Instruction
getIndex
public final int getIndex()
getTarget
public Bytecodes.InstructionHandle getTarget()
setTarget
public void setTarget(Bytecodes.InstructionHandle target)
- Set branch target
notifyTarget
static final void notifyTarget(Bytecodes.InstructionHandle old_ih,
Bytecodes.InstructionHandle new_ih,
Bytecodes.InstructionTargeter t)
- Used by BranchInstruction, LocalVariable, CodeException
updateTarget
public void updateTarget(Bytecodes.InstructionHandle old_ih,
Bytecodes.InstructionHandle new_ih)
- Specified by:
updateTarget in interface Bytecodes.InstructionTargeter
containsTarget
public boolean containsTarget(Bytecodes.InstructionHandle ih)
- Specified by:
containsTarget in interface Bytecodes.InstructionTargeter
dispose
void dispose()
- Inform target that it's not targeted anymore.
- Overrides:
dispose in class Bytecodes.Instruction