2

I'm using tinygo to compile my go project into a WebAssembly module, compile succeeds, but the browser shows below error:

Instantiate wasm failed, error: CompileError: WebAssembly.instantiate(): param count of 1055 exceeds internal limit of 1000 @+219

I know that WebAssembly module has its limitation, as referenced by https://webassembly.github.io/spec/js-api/index.html#limits.

But how can I find which function exceeds this limitation, or is there any workaround to adjust this limitation?

  • Have you tried decompile to wast and counting? Other way would be to parse the function defintion modul in the binary and count the parameters. – Lee Jun 09 '22 at 07:17
  • Finally, someone replied! How do I decompile to wast or parse the function definition for go wasm module? all I found is a github project https://github.com/akupila/go-wasm, but it gave me a error like this: ` [0x000954] parse section: data corrupted; section id 0x73656374696f6e494428323129 not valid ` and the author seems not active for years. do u have any ideas? – markey yuan Jun 09 '22 at 13:54
  • 1
    To decompile use the https://github.com/WebAssembly/wabt toolkit. There is an programm called wasm2wat and also wasm-objdump. wabt the in included in many operating system repositories so you could use rpm or apt to install. – Lee Jun 10 '22 at 06:22
  • 1
    I finally get it done, with help of wasm2wat, I figured out which function's parameter has exceeds the limitation, and I did some tricky work to solve it. It really saved me, thanks a lot. – markey yuan Jun 10 '22 at 23:09

0 Answers0