Crate unc_vm_compiler

source ·
Expand description

The unc_vm-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.



  • Return an Err(WasmError::Unsupported(msg)) where msg the string built by calling format! on the arguments to this macro.



  • The “architecture” field, which in some cases also specifies a specific subarchitecture.
  • The “binary format” field, which is usually omitted, and the binary format is implied by the other fields.
  • The calling convention, which specifies things like which registers are used for passing arguments, which registers are callee-saved, and so on.
  • The WebAssembly.CompileError object indicates an error during WebAssembly decoding or validation.
  • The nomenclature is inspired by the cpuid crate. The list of supported features was initially retrieved from cranelift-native.
  • Custom section Protection.
  • The target memory endianness.
  • The “operating system” field, which sometimes implies an environment, and sometimes isn’t an actual operating system.
  • The error that can happen while parsing a str to retrieve a CpuFeature.
  • The width of a pointer (in the default address space).
  • Relocation kinds for every ISA.
  • Destination function. Can be either user function or some special one, like memory.grow.
  • The kinds of unc_vm_types objects that might be found in a native object file.
  • A WebAssembly translation error.


  • Version number of this crate.


  • An implementation of a Compiler from parsed WebAssembly module to Compiled native code.
  • The compiler configuration options.
  • This trait facilitates symbol name lookups in a native object file.


  • Translate a sequence of bytes forming a valid Wasm binary into a parsed ModuleInfo ModuleTranslationState.
  • 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.
  • The custom sections for a Compilation.
  • The compiled functions map (index in the Wasm -> function)
  • Code offsets for Jump Tables.
  • Relocations to apply to function bodies.
  • A convenient alias for a Result that uses WasmError as the error type.