Package org.eolang.opeo.decompilation
Class DecompilerState
- java.lang.Object
-
- org.eolang.opeo.decompilation.DecompilerState
-
public final class DecompilerState extends Object
Internal state of decompiler. This state changes all the time between instruction handlers.- Since:
- 0.2
-
-
Constructor Summary
Constructors Constructor Description DecompilerState()
Constructor.DecompilerState(Deque<Opcode> opcodes, OperandStack stack, LocalVariables vars)
Constructor.DecompilerState(LocalVariables vars)
Constructor.DecompilerState(OperandStack ostack)
Constructor.DecompilerState(OperandStack operands, LocalVariables vars)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Opcode
current()
Retrieve current bytecode instruction.boolean
hasInstructions()
Check if there are any instructions left.Object
operand(int index)
Instruction operand.void
popInstruction()
Remove current instruction from the list.String
prettyOpcodes()
Print opcodes in a pretty way.OperandStack
stack()
Retrieve current stack.AstNode
variable(int index, org.objectweb.asm.Type type)
Retrieve variable by index and type.
-
-
-
Constructor Detail
-
DecompilerState
public DecompilerState()
Constructor.
-
DecompilerState
public DecompilerState(LocalVariables vars)
Constructor.- Parameters:
vars
- Method local variables.
-
DecompilerState
public DecompilerState(OperandStack ostack)
Constructor.- Parameters:
ostack
- Operand stack.
-
DecompilerState
public DecompilerState(OperandStack operands, LocalVariables vars)
Constructor.- Parameters:
operands
- Operand stack.vars
- Method local variables.
-
DecompilerState
public DecompilerState(Deque<Opcode> opcodes, OperandStack stack, LocalVariables vars)
Constructor.- Parameters:
opcodes
- Remaining opcodes.stack
- Operand stack.vars
- Method local variables.
-
-
Method Detail
-
current
public Opcode 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
public Object operand(int index)
Instruction operand.- Parameters:
index
- Operand index.- Returns:
- Instruction operand.
-
variable
public AstNode variable(int index, org.objectweb.asm.Type type)
Retrieve variable by index and type.- Parameters:
index
- Variable index.type
- Varaiable type.- Returns:
- Variable node.
-
stack
public OperandStack stack()
Retrieve current stack.- Returns:
- Operand stack.
-
prettyOpcodes
public String prettyOpcodes()
Print opcodes in a pretty way.- Returns:
- Pretty opcodes string
-
-