Package org.eolang.opeo.decompilation
Class DecompilerState
java.lang.Object
org.eolang.opeo.decompilation.DecompilerState
Internal state of decompiler.
This state changes all the time between instruction handlers.
- Since:
- 0.2
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor.DecompilerState
(Deque<Opcode> opcodes, OperandStack stack, LocalVariables vars) Constructor.Constructor.DecompilerState
(OperandStack ostack) Constructor.DecompilerState
(OperandStack operands, LocalVariables vars) Constructor. -
Method Summary
Modifier and TypeMethodDescriptioncurrent()
Retrieve current bytecode instruction.boolean
Check if there are any instructions left.operand
(int index) Instruction operand.void
Remove current instruction from the list.Print opcodes in a pretty way.stack()
Retrieve current stack.variable
(int index, org.objectweb.asm.Type type) Retrieve variable by index and type.
-
Constructor Details
-
DecompilerState
public DecompilerState()Constructor. -
DecompilerState
Constructor.- Parameters:
vars
- Method local variables.
-
DecompilerState
Constructor.- Parameters:
ostack
- Operand stack.
-
DecompilerState
Constructor.- Parameters:
operands
- Operand stack.vars
- Method local variables.
-
DecompilerState
Constructor.- Parameters:
opcodes
- Remaining opcodes.stack
- Operand stack.vars
- Method local variables.
-
-
Method Details
-
current
Retrieve current bytecode instruction.- Returns:
- Current bytecode instruction.
-
hasInstructions
public boolean hasInstructions()Check if there are any instructions left.- Returns:
- True if there are instructions left.
-
popInstruction
public void popInstruction()Remove current instruction from the list. This is used when we decompile an instruction. -
operand
Instruction operand.- Parameters:
index
- Operand index.- Returns:
- Instruction operand.
-
variable
Retrieve variable by index and type.- Parameters:
index
- Variable index.type
- Varaiable type.- Returns:
- Variable node.
-
stack
Retrieve current stack.- Returns:
- Operand stack.
-
prettyOpcodes
Print opcodes in a pretty way.- Returns:
- Pretty opcodes string
-