Details
-
Sub-task
-
Resolution: Fixed
-
P2: Important
-
None
-
None
-
-
140701c0e (dev), 48859317a (dev)
Description
Background
Emscripten provides two "modes" for features like asyncify, exceptions, and stjmp/longjmp: Emscripten emulated and native wasm. The two modes are incompatible, and applications must select feature implementations from at most one of them, e.g. mixing asyncify JSPI with Emscripten emulated exceptions does not work.
Mode | Exceptions flag | Exceptions Performance | Suported Asyncify | Supported longjmp | Requires Browser Support |
Emscripten Emulated | -fexceptions | Slow (JS roundtrip) | Asyncify 1 | Emscripten | No |
Native Wasm | -fwasm-exceptions | Fast | Asyncify 2 (JSPI) | wasm | Yes |
Tasks
Make sure it's possible to create a working JSPI-enabled build using the existing configure options:
configure [...] -device-option QT_EMSCRIPTEN_ASYNCIFY=2 -feature-wasm-exceptions
- Select correct exceptions type
- modules which enables exceptions must enable the correct type
- Enable correct setjmp/longjmp type
- Emscripten defaults to emscripten emulated longjmp, which is not compatible with JSPI
- https://emscripten.org/docs/porting/setjmp-longjmp.html
- Causes run-timer error undefined symbol: emscripten_longjmp
- Disable 4GB memory (Emscripten compatibility issue)
- Causes run-time error TypeError: WebAssembly.promising(): Argument 0 must be a WebAssembly exported function
- Mark EMSCRIPTEN_BINDINGS exported functions with emscripten::async
- Functions which suspend must have emscripten::async.
- Also transitively: e.g event handlers do not suspend themselves, but may call code which does.
- emscripten::async is not allowed for non-jspi builds
Attachments
For Gerrit Dashboard: QTBUG-129747 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
596734,2 | wasm: set correct exceptions flag | dev | qt/qtbase | Status: MERGED | +2 | 0 |
596735,3 | wasm: set longjmp type | dev | qt/qtbase | Status: MERGED | +2 | 0 |