It looks like the wasm entry function is missing it's JSPI wrapper. You 
should add `SHELL_Init` (or whatever the main entry point function is) to 
`-sJSPI_EXPORTS`.

https://emscripten.org/docs/tools_reference/settings_reference.html#jspi-exports

On Tuesday, December 2, 2025 at 7:24:34 AM UTC-8 caiiiycuk wrote:

> Hi everyone, I’m trying to run js-dos (dosbox) using JSPI instead of 
> Asyncify.
> Currently the project uses Asyncify, and throughout all of js-dos there is 
> a single entry point for sleeping called asyncify_sleep. Simplified, it’s 
> just a smart wrapper around emscripten_sleep.
>
> I compile the WebAssembly with these flags:
>
> -sASYNCIFY=1 
> -sASYNCIFY_WHITELIST=@${TARGETS_DIR}/dosbox-asyncify.txt
>
> With these flags everything works correctly.
>
> To switch to JSPI, I replace them with:
>
> -sJSPI=1
> -fwasm-exceptions
>
> For debugging I also add:
> --profiling-funcs
> -sASSERTIONS=2
>
> The build succeeds, but execution fails with the following error:
>
> SuspendError: trying to suspend without WebAssembly.promising
>     at wdosbox.wasm.asyncify_sleep (wdosbox.wasm-0070883a:0xaa96)
>     at wdosbox.wasm.Normal_Loop() (wasm://wasm/wdosbox.wasm-0070883a)
>     at wdosbox.wasm.DOSBOX_RunMachine() (wasm://wasm/wdosbox.wasm-0070883a)
>     at wdosbox.wasm.CALLBACK_RunRealInt(unsigned char) 
> (wasm://wasm/wdosbox.wasm-0070883a)
>     at wdosbox.wasm.device_CON::Read(unsigned char*, unsigned short*) 
> (wasm://wasm/wdosbox.wasm-0070883a)
>     at wdosbox.wasm.DOS_Device::Read(unsigned char*, unsigned short*) 
> (wasm://wasm/wdosbox.wasm-0070883a)
>     at wdosbox.wasm.DOS_ReadFile(unsigned short, unsigned char*, unsigned 
> short*, bool) (wasm://wasm/wdosbox.wasm-0070883a)
>     at wdosbox.wasm.DOS_Shell::InputCommand(char*) 
> (wasm://wasm/wdosbox.wasm-0070883a)
>     at wdosbox.wasm.DOS_Shell::Run() (wasm://wasm/wdosbox.wasm-0070883a)
>     at wdosbox.wasm.SHELL_Init() (wasm://wasm/wdosbox.wasm-0070883a)
>
> *Emscripten version:*
> emcc 4.0.21-git (7f262d85168927a47c014f2e5f636482d54c9199)
>
> *I also verified that the browser supports JSPI:*
> Chrome 142.0.7444.162 / Ubuntu 25.10
> typeof WebAssembly.promising → 'function'
>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/emscripten-discuss/bb987bb9-66c5-4691-bdd1-2c02e4e7f4d7n%40googlegroups.com.

Reply via email to