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.Object
Base class of all WasmInstruction.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
WasmInstruction.Type
Type of instruction to faster differ as with instanceof.
-
Field Summary
Fields Modifier and Type Field Description private int
javaCodePos
private int
lineNumber
-
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) int
getCodePosition()
Get current code position in Java method.(package private) int
getLineNumber()
Get the line number in the Java source file(package private) abstract int
getPopCount()
Get the count of values that are removed from the stack.(package private) abstract AnyType[]
getPopValueTypes()
(package private) abstract AnyType
getPushValueType()
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.
-
-
-
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.IOException
Write 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()
-
-