I am trying to introduce multithreading to my codebase where I already use SPLIT_MODULE flag with wasm-split tool. I am using PROXY_TO_PTHREAD flag to call my main function in a pthread. When createWasm is called, it instantiates wasm module in a pthread, which calls getWasmImports(here). When building with SPLIT_MODULE, getWasmImports is defined in terms of splitModuleProxyHandler, which uses wasmBinaryFile(here). But wasmBinaryFile is undefined at this time, hence getting the issue.
I saw that wasmBinaryFile is used as is, if already defined (here), so I have added
self.wasmBinaryFile = self.findWasmBinary();
in my postjs and things worked. I am wondering if it is expected for someone to define wasmBinaryFile this way if integrating both SPLIT_MODULE and pthread together. If yes, this should be documented.
I am trying to introduce multithreading to my codebase where I already use
SPLIT_MODULEflag withwasm-splittool. I am usingPROXY_TO_PTHREADflag to call my main function in a pthread. When createWasm is called, it instantiates wasm module in a pthread, which callsgetWasmImports(here). When building withSPLIT_MODULE,getWasmImportsis defined in terms of splitModuleProxyHandler, which useswasmBinaryFile(here). ButwasmBinaryFileis undefined at this time, hence getting the issue.I saw that
wasmBinaryFileis used as is, if already defined (here), so I have addedin my postjs and things worked. I am wondering if it is expected for someone to define
wasmBinaryFilethis way if integrating bothSPLIT_MODULEand pthread together. If yes, this should be documented.