public abstract class BranchInstruction extends Instruction implements InstructionTargeter
InstructionList,
Serialized Form| Modifier and Type | Field and Description |
|---|---|
protected int |
index |
protected int |
position |
protected InstructionHandle |
target |
length, opcode| Modifier | Constructor and Description |
|---|---|
protected |
BranchInstruction(short opcode,
InstructionHandle target)
Common super constructor
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsTarget(InstructionHandle ih) |
void |
dump(DataOutputStream out)
Dump instruction as byte code to stream out.
|
int |
getIndex() |
InstructionHandle |
getTarget() |
protected int |
getTargetOffset() |
protected int |
getTargetOffset(InstructionHandle target) |
protected void |
initFromFile(ByteSequence bytes,
boolean wide)
Read needed data (e.g. index) from file.
|
void |
setTarget(InstructionHandle target)
Set branch target
|
String |
toString(boolean verbose)
Long output format:
<position in byte code>
<name of opcode> "["<opcode number>"]"
"("<length of instruction>")"
"<"<target instruction>">" "@"<branch target offset>
|
protected int |
updatePosition(int offset,
int max_offset)
Called by InstructionList.setPositions when setting the position for every
instruction.
|
void |
updateTarget(InstructionHandle old_ih,
InstructionHandle new_ih) |
accept, consumeStack, copy, equals, getComparator, getLength, getName, getOpcode, produceStack, readInstruction, setComparator, toString, toStringprotected int index
protected InstructionHandle target
protected int position
protected BranchInstruction(short opcode,
InstructionHandle target)
opcodee - Instruction opcodetarget - instruction to branch topublic void dump(DataOutputStream out) throws IOException
dump in class Instructionout - Output streamIOExceptionprotected int getTargetOffset(InstructionHandle target)
target - branch targetprotected int getTargetOffset()
protected int updatePosition(int offset,
int max_offset)
offset - additional offset caused by preceding (variable length) instructionsmax_offset - the maximum offset that may be caused by these instructionspublic String toString(boolean verbose)
toString in class Instructionverbose - long/short format switchprotected void initFromFile(ByteSequence bytes, boolean wide) throws IOException
initFromFile in class Instructionbytes - input streamwide - wide prefix?IOExceptionInstructionListpublic final int getIndex()
public InstructionHandle getTarget()
public final void setTarget(InstructionHandle target)
target - branch targetpublic void updateTarget(InstructionHandle old_ih, InstructionHandle new_ih)
updateTarget in interface InstructionTargeterold_ih - old targetnew_ih - new targetpublic boolean containsTarget(InstructionHandle ih)
containsTarget in interface InstructionTargeterCopyright © 2018–2021 mhoffrogge. All rights reserved.