class CrystalRobots::Compiler::WASM_Emitter
- CrystalRobots::Compiler::WASM_Emitter
- Reference
- Object
Defined in:
compiler/wasm_emitter.crConstant Summary
-
FunctionType =
96
-
http://webassembly.github.io/spec/core/binary/types.html#function-types
-
MagicModuleHeader =
Bytes[0, 'a'.ord, 's'.ord, 'm'.ord]
-
https://webassembly.github.io/spec/core/binary/modules.html#binary-module
-
ModuleVersion =
Bytes[1, 0, 0, 0]
Constructors
Instance Method Summary
- #codeFromAst(ast : Program)
-
#codeSection(ast : Program)
the code section contains vectors of functions https://webassembly.github.io/spec/core/binary/modules.html#binary-codesec
- #createSection(type : Section, data : Bytes)
-
#encodeString(string : String) : Bytes
https://webassembly.github.io/spec/core/binary/values.html#names
-
#encodeVector(data : Bytes) : Bytes
https://webassembly.github.io/spec/core/binary/conventions.html#binary-vec Vectors are encoded with their length followed by their element sequence
-
#exportSection
the export section is a vector of exported functions
-
#funcSection
the function section is a vector of type indices that indicate the type of each function in the code section
- #importSection
- #signedLEB128(n : Int32) : Bytes
-
#to_wasm
Helpful tool for exploring - https://webassembly.github.io/wabt/demo/wat2wasm/
-
#typeSection
Function types are vectors of parameters and return types.
-
#unsignedLEB128(n : UInt32 | Int32) : Bytes
https://en.wikipedia.org/wiki/LEB128
Constructor Detail
Instance Method Detail
the code section contains vectors of functions https://webassembly.github.io/spec/core/binary/modules.html#binary-codesec
https://webassembly.github.io/spec/core/binary/values.html#names
https://webassembly.github.io/spec/core/binary/conventions.html#binary-vec Vectors are encoded with their length followed by their element sequence
the function section is a vector of type indices that indicate the type of each function in the code section
Function types are vectors of parameters and return types. Currently WebAssembly only supports single return values the type section is a vector of function types