Class Select
java.lang.Object
org.apache.bcel.generic.Instruction
org.apache.bcel.generic.BranchInstruction
org.apache.bcel.generic.Select
- All Implemented Interfaces:
Serializable, Cloneable, InstructionTargeter, StackConsumer, VariableLengthInstruction
- Direct Known Subclasses:
LOOKUPSWITCH, TABLESWITCH
public abstract class Select
extends BranchInstruction
implements VariableLengthInstruction, StackConsumer
Select - Abstract super class for LOOKUPSWITCH and TABLESWITCH instructions.
We use our super's target property as the default target.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected int[]protected int[]protected intprotected intprotected InstructionHandle[]Fields inherited from class BranchInstruction
index, position, targetFields inherited from class Instruction
length, opcode -
Method Summary
Modifier and TypeMethodDescriptionprotected Objectclone()booleanvoiddump(DataOutputStream out) Dump instruction as byte code to stream out.int[]int[]protected voidinitFromFile(ByteSequence bytes, boolean wide) Read needed data (e.g.voidsetTarget(int i, InstructionHandle target) Set branch target for `i'th casetoString(boolean verbose) Long output format: <position in byte code> <name of opcode> "["<opcode number>"]" "("<length of instruction>")" "<"<target instruction>">" "@"<branch target offset>protected intupdatePosition(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.voidupdateTarget(InstructionHandle old_ih, InstructionHandle new_ih) Methods inherited from class BranchInstruction
getIndex, getTarget, getTargetOffset, getTargetOffset, setTargetMethods inherited from class Instruction
accept, consumeStack, copy, equals, getComparator, getLength, getName, getOpcode, hashCode, produceStack, readInstruction, setComparator, toString, toStringMethods inherited from interface StackConsumer
consumeStack
-
Field Details
-
match
protected int[] match -
indices
protected int[] indices -
targets
-
fixed_length
protected int fixed_length -
match_length
protected int match_length -
padding
protected int padding
-
-
Method Details
-
updatePosition
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. 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.- Overrides:
updatePositionin classBranchInstruction- Parameters:
offset- additional offset caused by preceding (variable length) instructionsmax_offset- the maximum offset that may be caused by these instructions- Returns:
- additional offset caused by possible change of this instruction's length
-
dump
Dump instruction as byte code to stream out.- Overrides:
dumpin classBranchInstruction- Parameters:
out- Output stream- Throws:
IOException
-
initFromFile
Read needed data (e.g. index) from file.- Overrides:
initFromFilein classBranchInstruction- Parameters:
bytes- input streamwide- wide prefix?- Throws:
IOException- may be thrown if the implementation needs to read data from the file- See Also:
-
toString
Description copied from class:BranchInstructionLong output format: <position in byte code> <name of opcode> "["<opcode number>"]" "("<length of instruction>")" "<"<target instruction>">" "@"<branch target offset>- Overrides:
toStringin classBranchInstruction- Parameters:
verbose- long/short format switch- Returns:
- mnemonic for instruction
-
setTarget
Set branch target for `i'th case -
updateTarget
- Specified by:
updateTargetin interfaceInstructionTargeter- Overrides:
updateTargetin classBranchInstruction- Parameters:
old_ih- old targetnew_ih- new target
-
containsTarget
- Specified by:
containsTargetin interfaceInstructionTargeter- Overrides:
containsTargetin classBranchInstruction- Returns:
- true, if ih is target of this instruction
-
clone
- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-
getMatchs
public int[] getMatchs()- Returns:
- array of match indices
-
getIndices
public int[] getIndices()- Returns:
- array of match target offsets
-
getTargets
- Returns:
- array of match targets
-