Description
Followup to: #121698. WebAssembly in the browser is soon gaining stack switching support, but we're not allowed to stack switch through JS frames. The stack switching support used to require the wasm-js-type-reflection proposal, so in #121698 I updated the call trampoline to use js type reflection if it's present to avoid the JS frame and so the problem was fixed. However, the stack switching proposal has since been updated not to depend on type reflection, and it is going to be shipped while type reflection is still waiting for further refinement. This change means I need a different solution. Fortunately, wasm-gc is in stage 4 (shipped everywhere) and adds a webassembly instruction to query the type of a function. Unfortunately, toolchain support for wasm-gc is poor. Not even my favored assembler supports it.
Another problem is that the existing code is incompatible with memory snapshots since it calls JS initialization code that needs to happen even if restoring a memory snapshot from C code that is skipped when restoring a memory snapshot. I'll fix this at the same time.
Linked PRs
- gh-128627: Emscripten: Use wasm-gc based call adaptor if available #128628
- gh-128627: Emscripten: Fix address calculation for wasm-gc trampoline #128782
- gh-128627: Skip wasm-gc on iOS Safari where it's broken #130418
- gh-128627: Fix iPad detection in wasm-gc #135388
- [3.14] gh-128627: Fix iPad detection in wasm-gc (GH-135388) #135419
- gh-128627: Emscripten: Add missing semicolon in ios detection code #135590
- [3.14] gh-128627: Emscripten: Add missing semicolon in ios detection code (GH-135590) #135592