Class WasmInstruction

java.lang.Object
de.inetsoftware.jwebassembly.module.WasmInstruction
Direct Known Subclasses:
DupThis, JumpInstruction, WasmArrayInstruction, WasmBlockInstruction, WasmCallInstruction, WasmConstInstruction, WasmConvertInstruction, WasmGlobalInstruction, WasmLocalInstruction, WasmMemoryInstruction, WasmNopInstruction, WasmNumericInstruction, WasmStructInstruction, WasmTableInstruction

abstract class WasmInstruction extends Object
Base class of all WasmInstruction.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    (package private) static enum 
    Type of instruction to faster differ as with instanceof.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private int
     
    private final int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    WasmInstruction(int javaCodePos, int lineNumber)
    Create a new instance of an instruction
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) int
    Get current code position in Java method.
    (package private) int
    Get the line number in the Java source file
    (package private) abstract int
    Get the count of values that are removed from the stack.
    (package private) abstract AnyType[]
     
    (package private) abstract AnyType
    Get the ValueType if this instruction push a value on the stack.
    (package private) abstract WasmInstruction.Type
    Get the type of instruction
    (package private) void
    setCodePosition(int newPos)
    Set a new code position after reorganize the order
    (package private) abstract void
    Write this instruction to the WASM module.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • javaCodePos

      private int javaCodePos
    • lineNumber

      private final int lineNumber
  • Constructor Details

    • WasmInstruction

      WasmInstruction(int javaCodePos, int lineNumber)
      Create a new instance of an instruction
      Parameters:
      javaCodePos - the code position/offset in the Java method
      lineNumber - the line number in the Java source code
  • Method Details

    • getType

      @Nonnull abstract WasmInstruction.Type getType()
      Get the type of instruction
      Returns:
      the type
    • writeTo

      abstract void writeTo(@Nonnull ModuleWriter writer) throws IOException
      Write this instruction to the WASM module.
      Parameters:
      writer - the target writer
      Throws:
      IOException - if any I/O error occur
    • getCodePosition

      int getCodePosition()
      Get current code position in Java method.
      Returns:
      the position
    • getLineNumber

      int getLineNumber()
      Get the line number in the Java source file
      Returns:
      the line number
    • setCodePosition

      void setCodePosition(int newPos)
      Set a new code position after reorganize the order
      Parameters:
      newPos - new position
    • getPushValueType

      @Nullable abstract AnyType getPushValueType()
      Get the ValueType if this instruction push a value on the stack.
      Returns:
      the ValueType or null if no value is push
    • getPopCount

      abstract int getPopCount()
      Get the count of values that are removed from the stack.
      Returns:
      the count
    • getPopValueTypes

      abstract AnyType[] getPopValueTypes()