wasm: use MVar as JSFFI import blocking mechanism
Previously, when blocking on a JSFFI import, we push a custom stg_jsffi_block stack frame and arrange the `promise.then` callback to write to that stack frame. It turns out we can simply use the good old MVar to implement the blocking logic, with a few benefits: - Less maintenance burden. We can drop the stg_jsffi_block related Cmm code without loss of functionality. - It interacts better with existing async exception mechanism. throwTo would properly block the caller if the target thread is masking async exceptions. (cherry picked from commit 9cd9f347) (cherry picked from commit f8a96987)
Showing
- docs/users_guide/wasm.rst 5 additions, 12 deletionsdocs/users_guide/wasm.rst
- libraries/ghc-internal/src/GHC/Internal/Wasm/Prim/Imports.hs 8 additions, 16 deletionslibraries/ghc-internal/src/GHC/Internal/Wasm/Prim/Imports.hs
- libraries/ghc-internal/src/GHC/Internal/Wasm/Prim/Types.hs 1 addition, 8 deletionslibraries/ghc-internal/src/GHC/Internal/Wasm/Prim/Types.hs
- rts/wasm/JSFFI.c 1 addition, 14 deletionsrts/wasm/JSFFI.c
- rts/wasm/blocker.cmm 0 additions, 30 deletionsrts/wasm/blocker.cmm
- rts/wasm/scheduler.cmm 7 additions, 7 deletionsrts/wasm/scheduler.cmm
Loading
Please register or sign in to comment