Fuzz the compiler with a non-trivial code which is not overly complex
greenhat opened this issue · comments
Motivation
To fill the gap between manually written Wasm (too simple) and Rust programs using the malloc (too complex to debug) in our tests. We need something in the middle to cover a non-trivial control flow and memory ops (byte vs. word memory addressing), etc.
Implementation details
Generate the Wasm code with wasm-smith
, compile it to MASM and run them both, comparing the runtime state (stack, memory) afterward.
There is also Wasmlike
paper at https://news.ycombinator.com/item?id=36992222 to generate the semantically valid Wasm programs.
@bitwalker While working on #219, I discovered a few blockers of using the wasm-smith
to test Miden compiler.
The following is a list of the blockers that prevent using the wasm-smith
to test the Miden compiler:
- Introduce a notion of an "allowed" types to avoid using float types in the generated code (function arguments, return values, etc.).
- Split
InstructionKind::Numeric
into the integer and float variants to avoid using float types in the generated code. - Introduce a notion of an "allowed/forbidden" instructions to avoid using (yet) Miden unsupported Wasm instructions in the generated code.
We could implement them in the wasm-smith
and either push them upstream or maintain our fork.