Package com.tonic.analysis.instruction
Class InstructionFactory
- java.lang.Object
-
- com.tonic.analysis.instruction.InstructionFactory
-
public final class InstructionFactory extends Object
Decodes raw bytecode intoInstructionobjects.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static InstructioncreateInstruction(int opcode, int offset, byte[] bytecode, ConstPool constPool)Decodes the single instruction starting at an offset, reading its operands from the bytecode.static List<Instruction>parse(byte[] code, ConstPool constPool)Parses a method body into its instructions, in offset order.
-
-
-
Method Detail
-
parse
public static List<Instruction> parse(byte[] code, ConstPool constPool)
Parses a method body into its instructions, in offset order.- Parameters:
code- the method bytecodeconstPool- the class's constant pool for operand resolution- Returns:
- the decoded instructions in offset order
-
createInstruction
public static Instruction createInstruction(int opcode, int offset, byte[] bytecode, ConstPool constPool)
Decodes the single instruction starting at an offset, reading its operands from the bytecode.- Parameters:
opcode- the opcode byte at the offsetoffset- the bytecode offset of the instructionbytecode- the full method bytecodeconstPool- the class's constant pool for operand resolution- Returns:
- the decoded instruction
-
-