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 Details

    • 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 Details

    • 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