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
Base class of all WasmInstruction.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static enum
Type of instruction to faster differ as with instanceof. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionWasmInstruction
(int javaCodePos, int lineNumber) Create a new instance of an instruction -
Method Summary
Modifier and TypeMethodDescription(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
getType()
Get the type of instruction(package private) void
setCodePosition
(int newPos) Set a new code position after reorganize the order(package private) abstract void
writeTo
(ModuleWriter writer) Write this instruction to the WASM module.
-
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 methodlineNumber
- the line number in the Java source code
-
-
Method Details
-
getType
Get the type of instruction- Returns:
- the type
-
writeTo
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
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
-