WOMIR is a compiler pipeline from WebAssembly to machines with a very particular execution model: write-once memory (WOM) machines.
Instead of a fixed register bank or a stack, these machines provide as many registers as needed, but each register can only be written once. To differentiate between multiple calls of the same function, or multiple iterations of the same loop, references to registers are relative to a frame pointer managed by loops and function calls. This execution model fits naturally with zkVMs, where the execution trace is immutable anyway.
WOMIR transforms a WebAssembly program into an intermediate representation (IR). In this IR, WASM local variables and the operand stack are represented as edges of a directed acyclic graph (DAG). From this structure, WOMIR can generate a user-defined, assembly-like representation of the WOM program.
WOMIR was initially designed for PetraVM, developed through a collaboration between powdr and Irreducible.
WOMIR can target ISAs for WOM machines that have arbitrarily many general-purpose registers, a special frame pointer (FP) register, and instructions that operate on registers relative to the frame pointer. It also enforces that no register is written more than once in the same frame.
In addition to WOM-specific operations, the IR preserves most WebAssembly operations. Therefore, the target ISA must also allow for implementing them.
These targets are currently under development:
WOMIR has its own ISA and a corresponding interpreter that are used for testing.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as below, without any additional terms or conditions.
To run the tests, you need to install wabt.
This project is licensed under either of
at your option.