web-devkits / Wasmnizer-ts

Toolchain for compiling TypeScript to WasmGC
Apache License 2.0
291 stars 23 forks source link

Error running mandelbrot.wasm using nodejs #120

Open louisvangeldrop opened 6 months ago

louisvangeldrop commented 6 months ago

Under Windows:

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

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

Node.js v20.10.0

kylo5aby commented 6 months ago

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.

louisvangeldrop commented 6 months ago

Which node version supports the right V8?

xujuntwt95329 commented 6 months ago

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

https://github.com/web-devkits/Wasmnizer-ts/blob/5f7a52a85b4232a43d93cd0529581ef5222d3b21/tools/validate/run_module_on_node/run_module_on_node.md?plain=1#L5-L7

louisvangeldrop commented 2 months ago

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.

xujuntwt95329 commented 2 months ago

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