Kwasm.format.binary.type
package kwasm.format.binary.type
Fields
| Name | Description |
|---|---|
const FUNCTION_TYPE_MAGIC: Byte
|
Methods
readFunctionType
fun BinaryParser.readFunctionType(): FunctionType
Receiver
| Name | Description |
|---|---|
BinaryParser
|
ReturnValue
| Name | Description |
|---|---|
FunctionType
|
readGlobalType
fun BinaryParser.readGlobalType(): GlobalType
From the docs:
Global types are encoded by their value type and a flag for their mutability.
globaltype ::= t:valtype m:mut => m
tmut ::= 0x00 => const
0x01 => var
Receiver
| Name | Description |
|---|---|
BinaryParser
|
ReturnValue
| Name | Description |
|---|---|
GlobalType
|
readLimits
fun BinaryParser.readLimits(): Limits
From the docs:
Limits are encoded with a preceding flag indicating whether a maximum is present.
limits ::= 0x00 n:u32 => {min n, max ϵ}
0x01 n:u32 m:u32 => {min n, max m}
Receiver
| Name | Description |
|---|---|
BinaryParser
|
ReturnValue
| Name | Description |
|---|---|
Limits
|
readMemoryType
fun BinaryParser.readMemoryType(): MemoryType
Receiver
| Name | Description |
|---|---|
BinaryParser
|
ReturnValue
| Name | Description |
|---|---|
MemoryType
|
readResultType
fun BinaryParser.readResultType(): ResultType
From the docs:
Result types are encoded by the respective vectors of value types `.
resulttype ::= t*:vec(valtype) => [t*]
Receiver
| Name | Description |
|---|---|
BinaryParser
|
ReturnValue
| Name | Description |
|---|---|
ResultType
|
readTableType
fun BinaryParser.readTableType(): TableType
From the docs:
Table types are encoded with their limits and a constant byte indicating their element type.
tabletype ::= et:elemtype lim:limits => lim et
elemtype ::= 0x70 => funcref
Receiver
| Name | Description |
|---|---|
BinaryParser
|
ReturnValue
| Name | Description |
|---|---|
TableType
|
readValueType
fun BinaryParser.readValueType(): ValueType
From the docs:
Value types are encoded by a single byte.
valtype ::= 0x7F => i32
0x7E => i64
0x7D => f32
0x7C => f64
Note
Value types can occur in contexts where type indices are also allowed, such as in the case of
block types. Thus, the binary format for types corresponds to the signed LEB128 encoding of
small negative sN values, so that they can coexist with (positive) type indices in the future.
Receiver
| Name | Description |
|---|---|
BinaryParser
|
ReturnValue
| Name | Description |
|---|---|
ValueType
|
From the docs:
Function types are encoded by the byte
0x60followed by the respective vectors of parameter and result types.