Skip to content

docs: JSPI and wasm exceptions across the browser stack (JX1-JX4 plan) - #1308

Merged
transfix merged 2 commits into
masterfrom
docs/wasm-jspi-plan
Nov 17, 2026
Merged

transfix merged 2 commits into
masterfrom
docs/wasm-jspi-plan

Conversation

@transfix

Copy link
Copy Markdown
Owner

The plan for moving the browser stack to JSPI and wasm exceptions. Joe decided it on 2026-11-16: "we should use JSPI and also add -fwasm-exceptions to packages on cvcpkg". Docs only.

New file: docs/roadmap/WASM_JSPI_EXCEPTIONS.md. In ARIADNE_SCRIPTING_HOSTS.md, §8.5 and §9 item 13 now record the decision.

What decides the plan

  • There's no Asyncify fallback. emsdk 5.0.7 warns that Asyncify and -fwasm-exceptions don't compose. All three engines ship JSPI: Chrome 137, Firefox 153 (21 July 2026) and Safari 27 (September 2026). A browser without it gets a page that says what it needs.

  • The break runs both ways. I linked small programs in every mix under emsdk 5.0.7:

    • A wasm-exceptions link fails with a C object that uses JS longjmp (emscripten_longjmp undefined).
    • It also fails with a C++ object built with JS exceptions (__resumeException undefined).
    • Today's JS-exceptions libcvc fails against a rebuilt wasm-longjmp package (__wasm_longjmp and __c_longjmp undefined).
    • C++ built with emcc's default (no exceptions) links either way.

    So the packages that use JS longjmp or JS exceptions switch on the same day as libcvc.

  • Few packages force that. Of the 301 archives ariglx-web links, 12 do, from about eight recipes: libpng, freetype, libtiff, libjpeg-turbo, VTK, ImageMagick, and boost's test libraries. CPython and numpy don't.

  • The rebuild is cheap in storage. The latest wasm and wasm-mt bundles total about 1 GiB, against the org's 30 GiB.

Phases

What
JX1 cvcpkg: -fwasm-exceptions in _common/env-wasm.sh, a pack gate against JS longjmp and JS exceptions, and every wasm recipe rebuilt to the dev catalog
JX2 libcvc: -fwasm-exceptions, -sJSPI on every host, the audit of where it suspends, and tests on a node with JSPI
JX3 Guests on JSPI: the gas pass without Asyncify, and a suspending ari.gas
JX4 The switch: JX1 to prod, JX2 and JX3 merged, consumers moved the same day, and the browser gate

Not covered

Joe decided on 2026-11-16 to move every wasm host from Asyncify to JSPI, and
libcvc and every cvcpkg wasm package from JS exceptions and longjmp to wasm's
own. That settles ARIADNE_SCRIPTING_HOSTS.md section 9, item 13.

WASM_JSPI_EXCEPTIONS.md is the plan. It covers:
- why (#1272's numbers);
- a mixed-link table from emsdk 5.0.7, which shows the break runs both ways;
- which archives in ariglx-web's closure use JS longjmp or JS exceptions;
- the four phases: JX1 cvcpkg, JX2 libcvc, JX3 guests, JX4 the switch.

Section 8.5 now gives the current browser support (Firefox 153 and Safari 27
have shipped JSPI). It also says there is no Asyncify fallback, since Asyncify
and wasm exceptions don't compose.
…he PR open until JX4

JX1 started in cy-pca/cvcpkg (feat/wasm-exceptions):
- The flag goes through EMCC_CFLAGS, which only emcc reads, not CFLAGS, since several recipes
  build native host tools beside it.
- The pack gate reads wasm import sections itself and checks LTO bitcode's personality.
- A scan of all 126 latest wasm and wasm-mt bundles on cvcpkg.org found 13 cvcpkg recipes with
  JS-exception or JS-longjmp objects, plus libcvc's own three. Only those 13 are bumped.
- The cvcpkg PR stays open until JX4: on master, the flag would put bundles today's libcvc can't
  link onto prod.
@transfix
transfix merged commit d87ff97 into master Nov 17, 2026
29 checks passed
@transfix
transfix deleted the docs/wasm-jspi-plan branch November 17, 2026 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant