Package com.tonic.analysis.instruction
Class TableSwitchInstruction
- java.lang.Object
-
- com.tonic.analysis.instruction.Instruction
-
- com.tonic.analysis.instruction.TableSwitchInstruction
-
public class TableSwitchInstruction extends Instruction
Represents the TABLESWITCH instruction (0xAA).
-
-
Constructor Summary
Constructors Constructor Description TableSwitchInstruction(int opcode, int offset, int padding, int defaultOffset, int low, int high, Map<Integer,Integer> jumpOffsets)Constructs a TableSwitchInstruction.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(AbstractBytecodeVisitor visitor)Accepts a visitor for bytecode analysis.intgetDefaultOffset()intgetHigh()Map<Integer,Integer>getJumpOffsets()intgetLocalChange()Returns the change in local variables caused by this instruction.intgetLow()intgetPadding()intgetStackChange()Returns the change in stack size caused by this instruction.StringtoString()Returns a string representation of the instruction.voidwrite(DataOutputStream dos)Writes the TABLESWITCH opcode and its operands to the DataOutputStream.-
Methods inherited from class com.tonic.analysis.instruction.Instruction
getLength, getOffset, getOpcode, setOffset
-
-
-
-
Constructor Detail
-
TableSwitchInstruction
public TableSwitchInstruction(int opcode, int offset, int padding, int defaultOffset, int low, int high, Map<Integer,Integer> jumpOffsets)Constructs a TableSwitchInstruction.- Parameters:
opcode- The opcode of the instruction.offset- The bytecode offset of the instruction.padding- The number of padding bytes to align to 4-byte boundary.defaultOffset- The branch target offset if no key matches.low- The lowest key value.high- The highest key value.jumpOffsets- The map of key to branch target offsets.
-
-
Method Detail
-
getPadding
public int getPadding()
- Returns:
- the padding
-
getDefaultOffset
public int getDefaultOffset()
- Returns:
- the default offset
-
getLow
public int getLow()
- Returns:
- the low
-
getHigh
public int getHigh()
- Returns:
- the high
-
accept
public void accept(AbstractBytecodeVisitor visitor)
Description copied from class:InstructionAccepts a visitor for bytecode analysis.- Specified by:
acceptin classInstruction- Parameters:
visitor- The visitor to accept.
-
write
public void write(DataOutputStream dos) throws IOException
Writes the TABLESWITCH opcode and its operands to the DataOutputStream.- Specified by:
writein classInstruction- Parameters:
dos- The DataOutputStream to write to.- Throws:
IOException- If an I/O error occurs.
-
getStackChange
public int getStackChange()
Returns the change in stack size caused by this instruction.- Specified by:
getStackChangein classInstruction- Returns:
- The stack size change (pops one int).
-
getLocalChange
public int getLocalChange()
Returns the change in local variables caused by this instruction.- Specified by:
getLocalChangein classInstruction- Returns:
- The local variables size change (none).
-
toString
public String toString()
Returns a string representation of the instruction.- Overrides:
toStringin classInstruction- Returns:
- The mnemonic, default offset, low, high, and jump offsets.
-
-