Description
Details
wasi
requires calling initialize()
or start()
after instantiating wasm and requires that memory is exported from wasm, but this doesn't work in multithreaded scenario (wasm32-wasi-threads
target).
With wasi threads, we need to provide wasm memory created in JavaScript (new WebAssembly.Memory({ shared: true })
) in main thread, and send the memory to child thread to instantiate wasm again in child thread, and it is unnecessary (and will cause error) to call initialize()
or start()
in child thread. So normal usage of WASI
doesn't work in child thread. But we still need an "initialized" WASI
instance in child thread.
Currently I'm using cloned instance object and Proxy to workaround this problem. Is there any possibility to handle this in future Node.js API change?
Node.js version
18.14.0
Example code
loadNapiModuleImpl
Operating system
macOS 13.2
Scope
code? or runtime?
Module and version
require('node:wasi').WASI