Expand description
The wasmer-compiler
crate provides the necessary abstractions
to create a compiler.
It provides an universal way of parsing a module via wasmparser
,
while giving the responsibility of compiling specific function
WebAssembly bodies to the Compiler
implementation.
Re-exports§
pub use wasmparser;
translator
Modules§
Macros§
- wasm_
unsupported translator
- Return an
Err(WasmError::Unsupported(msg))
wheremsg
the string built by callingformat!
on the arguments to this macro.
Structs§
- Artifact
Non-WebAssembly - A compiled wasm module, ready to be instantiated.
- Artifact
Build - A compiled wasm module, ready to be instantiated.
- Artifact
Build From Archive - A compiled wasm module that was loaded from a serialized archive.
- Base
Tunables Non-WebAssembly - Tunable parameters for WebAssembly compilation.
This is the reference implementation of the
Tunables
trait, used by default. - Code
Memory Non-WebAssembly - Memory manager for executable code.
- Engine
- A WebAssembly
Universal
Engine. - Engine
Builder - The Builder contents of
Engine
- Engine
Inner - The inner contents of
Engine
- Features
- Controls which experimental features will be enabled. Features usually have a corresponding WebAssembly proposal.
- Function
Body Data translator
- Contains function data: bytecode and its offset in the module.
- Function
Extent Non-WebAssembly - Represents a continuous region of executable memory starting with a function entry point.
- Global
Frame Info Registration Non-WebAssembly - An RAII structure used to unregister a module’s frame information when the module is destroyed.
- Middleware
Binary Reader translator
- A Middleware binary reader of the WebAssembly structures and types.
- Middleware
Reader State translator
- The state of the binary reader. Exposed to middlewares to push their outputs.
- Module
Environment translator
- The result of translating via
ModuleEnvironment
. Function bodies are not yet translated, and data initializers have not yet been copied out of the original buffer. The function bodies will be translated by a specific compiler backend. - Module
From Archive - Module loaded from an archive. Since
CompileModuleInfo
is part of the public interface of this crate and has to be mutable, it has to be deserialized completely. - Module
Translation State translator
- Contains information decoded from the Wasm module that must be referenced during each Wasm function’s translation.
Enums§
- Compiled
Function Frame Info Variant Non-WebAssembly - The variant of the compiled function frame info which can be an owned type
- Frame
Infos Variant Non-WebAssembly - The variant of the frame information which can be an owned type or the explicit framed map
- Instantiation
Error - An error while instantiating a module.
- Link
Error - The WebAssembly.LinkError object indicates an error during module instantiation (besides traps from the start function).
Constants§
- VERSION
- Version number of this crate.
Statics§
- FRAME_
INFO Non-WebAssembly - This is a global cache of backtrace frame information for all active
Traits§
- Artifact
Create - An
Artifact
is the product that theEngine
implementation produce and use. - Compiler
compiler
- An implementation of a Compiler from parsed WebAssembly module to Compiled native code.
- Compiler
Config compiler
- The compiler configuration options.
- Function
Binary Reader translator
- Trait for iterating over the operators of a Wasm Function
- Function
Middleware translator
- A function middleware specialized for a single function.
- Module
Middleware translator
- A shared builder for function middlewares.
- Module
Middleware Chain translator
- Trait for generating middleware chains from “prototype” (generator) chains.
- Tunables
Non-WebAssembly - An engine delegates the creation of memories, tables, and globals to a foreign implementor of this trait.
- Upcastable
- Trait needed to get downcasting of
Engine
s to work.
Functions§
- from_
binaryreadererror_ wasmerror translator
- Make a
WasmError
out of aBinaryReaderError
. - get_
libcall_ trampoline - Returns the address of a trampoline in the libcall trampolines section.
- get_
trace_ and_ trapcode Non-WebAssembly - Given a
Trap
, this function returns the Wasm trace and the trap code. - libcall_
trampoline_ len compiler
- Returns the length of a libcall trampoline.
- link_
module Non-WebAssembly - Links a module, patching the allocated functions with the required relocations and jump tables.
- make_
libcall_ trampolines compiler
- Creates a custom section containing the libcall trampolines.
- register_
frame_ info Non-WebAssembly - Registers a new compiled module’s frame information.
- resolve_
imports Non-WebAssembly - This function allows to match all imports of a
ModuleInfo
with concrete definitions provided by aResolver
. - translate_
module translator
- Translate a sequence of bytes forming a valid Wasm binary into a
parsed ModuleInfo
ModuleTranslationState
. - wpheaptype_
to_ type translator
- Converts a wasmparser heap type to a Wasm Type.
- wptype_
to_ type translator
- Helper function translating wasmparser types to Wasm Type.
Type Aliases§
- Addend
- Addend to add to the symbol value.
- Code
Offset - Offset in bytes from the beginning of the function.