Hello, I have received this error from wasmtime 0.37.0:
Error: failed to run main module `../lib/std/zig-cache/o/e844be59deeadc476c0e3b7eecd89e75/test.wasm`
Caused by:
0: WebAssembly translation error
1: Invalid input WebAssembly code at offset 17178321: too many locals: locals exceed maximum
what can I do to find out what symbol is the one that has too many locals?
unfortunately it's not easy (and we should improve this error), but with the wasm-tools
CLI you can:
wasm-tools dump yourfile.wasm
thanks for the tip!
For context, 50000
is the maximum number of locals supported by the parser (that's a lot of locals...)
yep there is a good chance the generated code here is shall we say... less than ideal :)
first step to fixing the compiler is to find out where the bad code is!
I'm happy to help find the offending function if you run into trouble
hmm no wasm-tools in nixos yet it looks like. I'll grab a build from upstream
hmm I'm a bit stuck on trying to get wasm-tools installed: https://clbin.com/vygfV
ah that's a rustc-too-old issue
you may be able to check out an older release and get it to work
so that's git checkout <older tag>
in the wasm-tools repo, then cargo install
?
yeah that should work
you'd want the wasm-tools-*
tags I think
alright I was able to get wasm-tools-1.0.3 built with cargo 1.56.0
alright so I found the function that has a crap ton of locals but unfortunately no symbol name:
============== func 13896 ====================
0x105ae98 | d3 ef 27 | size of function
0x105ae9b | cb 73 | 14795 local blocks
0x105ae9d | 05 7f | 5 locals of type I32
0x105ae9f | 01 7e | 1 locals of type I64
is that something added to wasm-tools after 1.0.3?
for the symbol name info it'll be in the name
custom section, probably at the end of the file
you can try searching for 13896 in the output
and it'll hopefully show up down there
aha! 0x2a3edc1 | c8 6c 1e 63 | Naming { index: 13896, name: "crypto.25519.field.Fe.isSquare" }
thanks! now I'm hot on the trail
I opened https://github.com/bytecodealliance/wasmtime/pull/4340 to improve this
Andrew Kelley has marked this topic as resolved.
(deleted)
(deleted)
Last updated: Nov 22 2024 at 16:03 UTC