web-devkits/Wasmnizer-ts

Error running mandelbrot.wasm using nodejs

louisvangeldrop opened this issue · 5 comments

Under Windows:

  • cd wasmnizer-ts\build

  • node .\cli\ts2wasm.js ..\tests\benchmark\mandelbrot.ts -o mandelbrot.wasm --opt=3 => success

  • cd tools\validate\run_module_on_node

  • node --experimental-wasm-gc --experimental-wasm-stringref --experimental-wasm-modules --experimental-repl-await run_module.js -f main ......\build\mandelbrot.wasm

Error:
node:internal/process/promises:289
triggerUncaughtException(err, true /* fromPromise */);
^

[CompileError: WebAssembly.instantiate(): invalid value type 0x78 @+12]

Node.js v20.10.0

Hi @louisvangeldrop , thanks for your report, recently V8 have updated GC opcodes, https://docs.google.com/document/d/1DklC3qVuOdLHSXB5UXghM_syCh-4cMinQ50ICiXnK3Q/edit#heading=h.9dwoku9340md, now it use 0x78 to represent i8, but node uses old V8 version now without the newest update, so it will report error, Your can use latest V8 or WAMR to run it.

Which node version supports the right V8?

Hi, the latest WasmGC opcode requires V8 version v11.9+, but unfortunately, the latest node release (v21.5.0) is using V8 11.8.172.17, so currently no nodejs release support the latest WasmGC opcodes, we need to wait for the future node release, or reset to previous commit of Wasmnizer-ts

> Note: Wasmnizer-ts follows the latest WasmGC spec, which requires `V8 v11.9+`, but the latest nodejs (v21.5.0) is using `V8 11.8.172.17`, so currently the generated WASM module can't execute on any nodejs releases.
> If you do want to try on nodejs, you can reset to commit `94cf9929421d47a9976fa6edf74b25ef2a00ee12` to build the compiler, which is compatible to older V8 versions.

Nodejs version 22.0.0 is out with V8 version 12.4.254.14-node.10. Also WAMR 2.0.0 is out. So I better wait with some tests until the WAMR 2.0.0 has been integrated into this wasmnizer-ts project.

Hi, Thanks for the information. We've already target the WAMR reference to latest version, so current CI is already based on WAMR 2.0.0

For the latest node release, it's exciting to know that 22.0 uses V8 v12, we'll test Wasmnizer-ts on node-22.0.0