class

CrystalRobots::Compiler::WASM_Emitter

Inherits Reference < Object

Constants

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

new(ast : Program)
Source

Instance methods

codeFromAst(ast : Program)
Source
codeSection(ast : Program)

the code section contains vectors of functions https://webassembly.github.io/spec/core/binary/modules.html#binary-codesec

Source
createSection(type : Section, data : Bytes)
Source
encodeString(string : String) : Bytes

https://webassembly.github.io/spec/core/binary/values.html#names

Source
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

Source
exportSection

the export section is a vector of exported functions

Source
funcSection

the function section is a vector of type indices that indicate the type of each function in the code section

Source
importSection
Source
signedLEB128(n : Int32) : Bytes
Source
to_wasm

Helpful tool for exploring - https://webassembly.github.io/wabt/demo/wat2wasm/

Source
typeSection

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

Source
unsignedLEB128(n : UInt32 | Int32) : Bytes

https://en.wikipedia.org/wiki/LEB128

Source

Nested types