Expand description
The walrus WebAssembly transformations library.
§GC Proposal Support
Walrus supports the WebAssembly GC proposal, including struct types, array types, subtyping, recursive type groups, and the full set of GC instructions.
§Creating GC types
Use ModuleTypes::add_struct, ModuleTypes::add_array, and
ModuleTypes::add_composite to create GC types programmatically. For
mutually-recursive types, use ModuleTypes::add_rec_group which
pre-allocates type IDs for forward references.
§GC instructions
All GC instructions (struct.new, array.get, ref.cast, etc.) are
available as builder methods on InstrSeqBuilder. See the ir module
for the full list of instruction variants.
Re-exports§
pub use crate::ir::Local;pub use crate::ir::LocalId;pub use crate::ir::InstrLocId;
Modules§
- dot
- Utilities for emitting GraphViz dot files.
- ir
- Intermediate representation for instructions.
- passes
- Passes over whole modules or individual functions.
Structs§
- Array
Type - An array type, consisting of a single field type for all elements.
- Code
Transform - Code transformation records, which is used to transform DWARF debug entries.
- Data
- A data segment.
- Element
- A passive segment which contains a list of functions
- Export
- A named item exported from the wasm.
- Field
Type - A field type for struct and array fields.
- Function
- A wasm function.
- Function
Builder - Build instances of
LocalFunction. - Function
Type - A function type, consisting of parameter and result types.
- Global
- A wasm global.
- IdsTo
Indices - Maps our high-level identifiers to the raw indices they end up emitted at.
- Import
- A named item imported into the wasm.
- Imported
Function - An externally defined, imported function.
- Indices
ToIds - Maps from old indices in the original Wasm binary to
walrusIDs. - Instr
SeqBuilder - A builder returned by instruction sequence-construction methods to build up instructions within a block/loop/if-else over time.
- Local
Function - A function defined locally within the wasm module.
- Memory
- A memory in the wasm.
- Module
- A wasm module.
- Module
Config - Configuration for a
Modulewhich currently affects parsing. - Module
Custom Sections - A collection of custom sections inside a Wasm module.
- Module
Data - All passive data sections of a wasm module, used to initialize memories via various instructions.
- Module
Debug Data - The DWARF debug section in input WebAssembly binary.
- Module
Elements - All element segments of a wasm module, used to initialize
anyfunctables, used as function pointers. - Module
Exports - The set of exports in a module.
- Module
Functions - The set of functions within a module.
- Module
Globals - The set of globals in each function in this module.
- Module
Imports - The set of imports in a module.
- Module
Locals - The set of locals in each function in this module.
- Module
Memories - The set of memories in this module.
- Module
Producers - Representation of the wasm custom section
producers - Module
Tables - The set of tables in this module.
- Module
Tags - All tags in a WebAssembly module.
- Module
Types - The set of de-duplicated types within a module.
- RawCustom
Section - A raw, unparsed custom section.
- RecGroup
- A recursive type group.
- RefType
- A reference type.
- Struct
Type - A struct type, consisting of a sequence of field types.
- Table
- A table in the wasm.
- Tag
- A tag in a WebAssembly module, used for exception handling.
- Type
- A WebAssembly type definition.
- Typed
Custom Section Id - The id of a
CustomSectioninstance with a statically-known type in aModuleCustomSections. - Untyped
Custom Section Id - The id of some
CustomSectioninstance in aModuleCustomSections.
Enums§
- Abstract
Heap Type - Abstract heap types for GC reference types.
- Composite
Type - A composite type that can be a function, struct, or array.
- Const
Expr - A constant which is produced in WebAssembly, typically used in global initializers or element/data offsets.
- ConstOp
- Operations allowed in extended constant expressions
- Data
Kind - The kind of data segment: passive or active.
- Element
Items - Represents the items of an element segment.
- Element
Kind - The kind of element segment.
- Error
Kind - A leaf wasm error type.
- Export
Item - An exported item.
- Function
Kind - The local- or external-specific bits of a function.
- Global
Kind - The different kinds of globals a wasm module can have
- Heap
Type - A heap type for GC reference types.
- Import
Kind - An imported item.
- Storage
Type - A packed storage type for struct and array fields.
- TagKind
- The kind of tag.
- ValType
- A value type.
Traits§
- Custom
Section - A trait for implementing custom sections.
- Custom
Section Id - A common trait for custom section identifiers.
Type Aliases§
- DataId
- A passive element segment identifier
- Element
Id - A passive element segment identifier
- Export
Id - The id of an export.
- Func
Params - Parameter(s) to a function
- Func
Results - Result(s) of a given function
- Function
Id - A function identifier.
- Global
Id - The id of a global.
- Import
Id - The id of an import.
- Memory
Id - The id of a memory.
- RecGroup
Id - An identifier for recursive type groups.
- Result
- Either
Ok(T)orErr(failure::Error).Result<T, Error> - TableId
- The id of a table.
- TagId
- The id of a tag.
- TypeId
- An identifier for types.