ITADN

Reuse inserted locals for stack value duplication

#42Opendanleh 创建于 2023-11-06
enhancement
D
danlehcommented
Currently, Wasabi inserts a fresh local (quite primitively) for every stack value it needs to duplicate. This causes some binaries with large functions to contain tons of locals after instrumentation. E.g., binary `9b3a05f8927a35b011f23eae30c9f11f8dcae299f3f400d7960a8aa20cec7a27.wasm` from WasmBench contains a function with >50k locals after instrumentation, which trips `wasm-validate` from WABT with the error ``` error: function local count exceeds maximum value ``` A workaround is to optimize the instrumented files with `wasm-opt` from Binaryen, i.e. run `wasm-opt -Os <instrumented.wasm> -o <instrumented-smaller.wasm>`
3 条评论