public abstract class Select extends BranchInstruction implements VariableLengthInstruction, StackProducer
We use our super's target
property as the default target.
LOOKUPSWITCH
,
TABLESWITCH
,
InstructionList
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected int |
fixed_length |
protected int[] |
indices |
protected int[] |
match |
protected int |
match_length |
protected int |
padding |
protected InstructionHandle[] |
targets |
index, position, target
length, opcode
Constructor and Description |
---|
Select()
Empty constructor needed for the Class.newInstance() statement in
Instruction.readInstruction().
|
Select(short opcode,
int[] match,
InstructionHandle[] targets,
InstructionHandle defaultTarget)
(Match, target) pairs for switch.
|
Modifier and Type | Method and Description |
---|---|
protected java.lang.Object |
clone() |
boolean |
containsTarget(InstructionHandle ih) |
(package private) void |
dispose()
Inform targets that they're not targeted anymore.
|
void |
dump(java.io.DataOutputStream out)
Dump instruction as byte code to stream out.
|
int[] |
getIndices() |
int[] |
getMatchs() |
InstructionHandle[] |
getTargets() |
protected void |
initFromFile(ByteSequence bytes,
boolean wide)
Read needed data (e.g.
|
void |
setTarget(int i,
InstructionHandle target)
Set branch target for `i'th case
|
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>
|
protected int |
updatePosition(int offset,
int max_offset)
Since this is a variable length instruction, it may shift the following
instructions which then need to update their position.
|
void |
updateTarget(InstructionHandle old_ih,
InstructionHandle new_ih) |
getIndex, getTarget, getTargetOffset, getTargetOffset, notifyTarget, setTarget
accept, consumeStack, copy, equals, getComparator, getLength, getName, getOpcode, produceStack, readInstruction, setComparator, toString, toString
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
produceStack
protected int[] match
protected int[] indices
protected InstructionHandle[] targets
protected int fixed_length
protected int match_length
protected int padding
Select()
Select(short opcode, int[] match, InstructionHandle[] targets, InstructionHandle defaultTarget)
match
- array of matching valuestargets
- instruction targetsdefaultTarget
- default instruction targetprotected int updatePosition(int offset, int max_offset)
updatePosition
in class BranchInstruction
offset
- additional offset caused by preceding (variable length) instructionsmax_offset
- the maximum offset that may be caused by these instructionspublic void dump(java.io.DataOutputStream out) throws java.io.IOException
dump
in class BranchInstruction
out
- Output streamjava.io.IOException
protected void initFromFile(ByteSequence bytes, boolean wide) throws java.io.IOException
initFromFile
in class BranchInstruction
bytes
- input streamwide
- wide prefix?java.io.IOException
InstructionList
public java.lang.String toString(boolean verbose)
BranchInstruction
toString
in class BranchInstruction
verbose
- long/short format switchpublic void setTarget(int i, InstructionHandle target)
public void updateTarget(InstructionHandle old_ih, InstructionHandle new_ih)
updateTarget
in interface InstructionTargeter
updateTarget
in class BranchInstruction
old_ih
- old targetnew_ih
- new targetpublic boolean containsTarget(InstructionHandle ih)
containsTarget
in interface InstructionTargeter
containsTarget
in class BranchInstruction
protected java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
void dispose()
dispose
in class BranchInstruction
public int[] getMatchs()
public int[] getIndices()
public InstructionHandle[] getTargets()