
Contributing support for a Wasm instruction to Winch - Shopify
7/18/2023
This post details the technical process of contributing support for new WebAssembly instructions to Winch, Wasmtime's baseline compiler. It explains the steps involved: modifying the visitor to handle new instructions, implementing methods in the MacroAssembler and CodeGenContext for instruction emission and operand management, emitting x86_64 machine instructions via the assembler, and testing through filetests and differential fuzzing. Specific examples of adding support for `i32.clz` and `i32.and` instructions are provided, along with explanations of how to use Cranelift's ISLE definitions and the challenges of testing on different architectures.
















