gwr/binary
Types
pub type Binary {
Binary(version: Int, length: Int, module: module.Module)
}
Constructors
-
Binary(version: Int, length: Int, module: module.Module)
pub type Code {
Code(size: Int, function_code: FunctionCode)
}
Constructors
-
Code(size: Int, function_code: FunctionCode)
pub type FunctionCode {
FunctionCode(
locals: convention.Vector(LocalsDeclaration),
body: instruction.Expression,
)
}
Constructors
-
FunctionCode( locals: convention.Vector(LocalsDeclaration), body: instruction.Expression, )
pub type LocalsDeclaration {
LocalsDeclaration(count: Int, type_: types.ValueType)
}
Constructors
-
LocalsDeclaration(count: Int, type_: types.ValueType)
Each section consists of - a one-byte section id, - the u32 size of the contents, in bytes, - the actual contents, whose structure is dependent on the section id. https://webassembly.github.io/spec/core/binary/module.html#sections
pub type Section {
Section(id: Int, length: Int, content: Option(SectionContent))
}
Constructors
-
Section(id: Int, length: Int, content: Option(SectionContent))
pub type SectionContent {
CustomSection(name: String, data: Option(BitArray))
TypeSection(
function_types: convention.Vector(types.FunctionType),
)
ImportSection
FunctionSection(type_indices: convention.Vector(Int))
TableSection
MemorySection(memories: convention.Vector(module.Memory))
GlobalSection(globals: convention.Vector(module.Global))
ExportSection(exports: convention.Vector(module.Export))
StartSection(start_function: module.StartFunction)
ElementSection
CodeSection(entries: List(Code))
DataSection
DataCountSection
}
Constructors
-
CustomSection(name: String, data: Option(BitArray))
Custom sections have the id 0. They are intended to be used for debugging information or third-party extensions, and are ignored by the WebAssembly semantics. Their contents consist of a name further identifying the custom section, followed by an uninterpreted sequence of bytes for custom use.
https://webassembly.github.io/spec/core/binary/module.html#custom-section
-
TypeSection( function_types: convention.Vector(types.FunctionType), )
The type section has the id 1. It decodes into a vector of function types that represent the component of a module.
https://webassembly.github.io/spec/core/binary/module.html#type-section
-
ImportSection
-
FunctionSection(type_indices: convention.Vector(Int))
The function section has the id 3. It decodes into a vector of type indices that represent the
fields of the respective functions are encoded separately in the code section.fields of the functions in the component of a module. The and https://webassembly.github.io/spec/core/binary/module.html#function-section
-
TableSection
The table section has the id 4. It decodes into a vector of tables that represent the
component of a module.
https://webassembly.github.io/spec/core/binary/modules.html#table-section
MemorySection(memories: convention.Vector(module.Memory))
The memory section has the id 5. It decodes into a vector of memories that represent the
component of a module. https://webassembly.github.io/spec/core/binary/modules.html#memory-section
GlobalSection(globals: convention.Vector(module.Global))
The global section has the id 6. It decodes into a vector of globals that represent the
component of a module. https://webassembly.github.io/spec/core/binary/modules.html#global-section
ExportSection(exports: convention.Vector(module.Export))
The export section has the id 7. It decodes into a vector of exports that represent the exports component of a module.
https://webassembly.github.io/spec/core/binary/module.html#export-section
StartSection(start_function: module.StartFunction)
The start section has the id 8. It decodes into an optional start function that represents the
component of a module. https://webassembly.github.io/spec/core/binary/modules.html#start-section
ElementSection
CodeSection(entries: List(Code))
DataSection
DataCountSection
Constants
pub const code_section_id: Int
pub const custom_section_id: Int
https://webassembly.github.io/spec/core/binary/module.html#sections
pub const data_count_section_id: Int
pub const data_section_id: Int
pub const element_section_id: Int
pub const export_section_id: Int
pub const function_section_id: Int
pub const global_section_id: Int
pub const import_section_id: Int
pub const memory_section_id: Int
pub const start_section_id: Int
pub const table_section_id: Int
pub const type_section_id: Int