Crate wasmer_compiler
source ·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 frame_info::FRAME_INFO;
pub use frame_info::FRAME_INFO;
pub use wasmparser;
Modules§
- Generic Artifact abstraction for Wasmer Engines.
- compiler 🔒This module mainly outputs the
Compiler
trait that custom compilers will need to implement. - engine 🔒The Wasmer Engine.
- lib 🔒
- Object creator for Wasm Compilations.
- traits 🔒Generic Artifact abstraction for Wasmer Engines.
- This module defines the parser and translator from wasmparser to a common structure
ModuleInfo
. - Types for compilation.
Macros§
- Return an
Err(WasmError::Unsupported(msg))
wheremsg
the string built by callingformat!
on the arguments to this macro.
Structs§
- A compiled wasm module, ready to be instantiated.
- A compiled wasm module, ready to be instantiated.
- A compiled wasm module that was loaded from a serialized archive.
- Tunable parameters for WebAssembly compilation. This is the reference implementation of the
Tunables
trait, used by default. - Memory manager for executable code.
- A WebAssembly
Universal
Engine. - The Builder contents of
Engine
- The inner contents of
Engine
- This is a global cache of backtrace frame information for all active
- Controls which experimental features will be enabled. Features usually have a corresponding WebAssembly proposal.
- Contains function data: bytecode and its offset in the module.
- Represents a continuous region of executable memory starting with a function entry point.
- An RAII structure used to unregister a module’s frame information when the module is destroyed.
- A Middleware binary reader of the WebAssembly structures and types.
- The state of the binary reader. Exposed to middlewares to push their outputs.
- 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 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. - Contains information decoded from the Wasm module that must be referenced during each Wasm function’s translation.
Enums§
- The variant of the compiled function frame info which can be an owned type
- The variant of the frame information which can be an owned type or the explicit framed map
- An error while instantiating a module.
- The WebAssembly.LinkError object indicates an error during module instantiation (besides traps from the start function).
Constants§
- Version number of this crate.
Traits§
- An
Artifact
is the product that theEngine
implementation produce and use. - An implementation of a Compiler from parsed WebAssembly module to Compiled native code.
- The compiler configuration options.
- Trait for iterating over the operators of a Wasm Function
- A function middleware specialized for a single function.
- A shared builder for function middlewares.
- Trait for generating middleware chains from “prototype” (generator) chains.
- An engine delegates the creation of memories, tables, and globals to a foreign implementor of this trait.
- Trait needed to get downcasting of
Engine
s to work.
Functions§
- Make a [
WasmError
] out of a [BinaryReaderError
]. - Returns the address of a trampoline in the libcall trampolines section.
- Given a
Trap
, this function returns the Wasm trace and the trap code. - Returns the length of a libcall trampoline.
- Links a module, patching the allocated functions with the required relocations and jump tables.
- Creates a custom section containing the libcall trampolines.
- Registers a new compiled module’s frame information.
- This function allows to match all imports of a
ModuleInfo
with concrete definitions provided by aResolver
. - Translate a sequence of bytes forming a valid Wasm binary into a parsed ModuleInfo
ModuleTranslationState
. - Converts a wasmparser heap type to a Wasm Type.
- Helper function translating wasmparser types to Wasm Type.
Type Aliases§
- Addend to add to the symbol value.
- Offset in bytes from the beginning of the function.