Crate waffle

source ·
Expand description

WAFFLE Wasm analysis framework.

waffle is a decompiler and compiler library for WebAssembly: it defines an SSA-based IR (intermediate representation), with a frontend that translates Wasm to this IR, and a backend that compiles this IR back to Wasm. It can be used by programs that need to transform/modify or add new code to Wasm modules.

A good starting point is the Module: it can be constructed from Wasm bytecode in memory with Module::from_wasm_bytes() and recompiled to Wasm with Module::to_wasm_bytes(), after modifications are performed or new code is added. A new module can also be built from scratch with Module::empty().

Re-exports§

Modules§

  • Lightweight CFG analyses.
  • Type-safe indices and indexed containers.
  • Passes.
  • Pooled list data structure.

Macros§

Structs§

Enums§

  • A constant concrete value during interpretation.
  • The kind of a Wasm export, including the specific entity index that this export directive exports.
  • An error that occurs when translating Wasm to IR.
  • A declaration of a function: there is one FuncDecl per Func index.
  • The kind of of a Wasm import, including the specific entity index that the import corresponds to.
  • The result of an interpreter session.
  • An operator in the IR, consuming arguments and producing results when executed.
  • Side-effects that an operator may have.
  • Types in waffle’s IR.
  • A definition of an SSA value.

Constants§

  • The size of a single Wasm page, used in memory definitions.

Functions§

  • Constant-evaluate the given operator with the given arguments, returning a constant result if possible to know.