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 java.lang.ObjectBase class of all WasmInstruction.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classWasmInstruction.TypeType of instruction to faster differ as with instanceof.
-
Field Summary
Fields Modifier and Type Field Description private intjavaCodePosprivate intlineNumber
-
Constructor Summary
Constructors Constructor Description WasmInstruction(int javaCodePos, int lineNumber)Create a new instance of an instruction
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (package private) intgetCodePosition()Get current code position in Java method.(package private) intgetLineNumber()Get the line number in the Java source file(package private) abstract intgetPopCount()Get the count of values that are removed from the stack.(package private) abstract AnyType[]getPopValueTypes()(package private) abstract AnyTypegetPushValueType()Get the ValueType if this instruction push a value on the stack.(package private) abstract WasmInstruction.TypegetType()Get the type of instruction(package private) voidsetCodePosition(int newPos)Set a new code position after reorganize the order(package private) abstract voidwriteTo(ModuleWriter writer)Write this instruction to the WASM module.
-
-
-
Method Detail
-
getType
@Nonnull abstract WasmInstruction.Type getType()
Get the type of instruction- Returns:
- the type
-
writeTo
abstract void writeTo(@Nonnull ModuleWriter writer) throws java.io.IOExceptionWrite this instruction to the WASM module.- Parameters:
writer- the target writer- Throws:
java.io.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()
-
-