jspi: migration phases 0-7 — build knob, scheduler shim, test successor suite
Toolchain: emsdk 6.0.6 (versions.sh; cache-hash keys on it). Build knob PCBJAM_ASYNC_BACKEND=jspi|asyncify: build-kicad-target.sh links editors with -sJSPI + -sJSPI_EXPORTS=@scripts/common/jspi-exports.txt + --pre-js jspi-scheduler.js (no DYNCALLS, no post-link asyncify pipeline); wx build stamps the backend and forces clean on flip or unknown provenance; docker/build.sh passes the knob, seeds the emscripten ports cache from the volume every launch, jspi postprocess = patch-env-shim only. scripts/common/shims/jspi-scheduler.js: the JSPI successor scheduler — token-wait registry, resume turnstile (one armed resume between engine re-entries, SP swaps only at microtask boundaries), green-region spill stacks (16-aligned tops), S1 embind mutator FIFO lane + parker wraps, S6 shutdown, libctx integration hooks (suspend/end/quarantine + g_current arm/clear), SuspendError attributor, lost-wake + stuck-window watchdogs, __wxWaitDump observability. Embind: PARKER registrations get emscripten::async() under PCBJAM_JSPI (wasm/bindings/pcbjam_async_policy.h). nanosleep yields route via the shim. Tests: tests/asyncify -> tests/jspi successor suite (jspi-stack red/green shadow-stack battery, jspi-coroutine MiniCoro harness, suspend-races semantic scenarios + __wxWaitDump books coherence); projects jspi-firefox/ jspi-chrome (asyncify-webkit retired — no JSPI in WebKit); unconditional Firefox JSPI pref; guard-beacons -> wait-beacons (+wxScheduler/libctxJspi families); Makefile.wasm links test apps against JSPI with the shim as a tracked link prerequisite. Web: WasmTool setRo await + __wxWaitDump forensics, open-flow contained promise, scheduler-shim.test.ts retargeted (8 green). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NDeBaKKhQztd8KiVtHuyXr
This commit is contained in:
parent
33e23e0a65
commit
3f09a46ff5
48 changed files with 2640 additions and 546 deletions
25
tests/apps/standalone/jspi-stack/build.sh
Executable file
25
tests/apps/standalone/jspi-stack/build.sh
Executable file
|
|
@ -0,0 +1,25 @@
|
|||
#!/bin/bash
|
||||
# Ad-hoc build for the jspi-stack harness (Makefile.wasm wiring lands in Phase 3).
|
||||
# Uses the worktree-local emsdk (tools/emsdk, 6.0.6). EH flags mirror production.
|
||||
set -eo pipefail
|
||||
cd "$(dirname "$0")"
|
||||
ROOT="$(cd ../../../.. && pwd)"
|
||||
EMCC="${EMCC:-$ROOT/tools/emsdk/upstream/emscripten/em++}"
|
||||
|
||||
COMMON=(
|
||||
-O1
|
||||
-fwasm-exceptions -sSUPPORT_LONGJMP=wasm -sWASM_LEGACY_EXCEPTIONS=1
|
||||
-sJSPI -sJSPI_EXPORTS=activation
|
||||
-sEXPORTED_RUNTIME_METHODS=stackSave,stackRestore,HEAPU8
|
||||
-sMODULARIZE=1 -sEXPORT_ES6=1 -sENVIRONMENT=node,web,worker
|
||||
-sALLOW_MEMORY_GROWTH=1
|
||||
)
|
||||
|
||||
"$EMCC" stack_test.cpp -o stack_test.mjs "${COMMON[@]}" \
|
||||
-sEXPORTED_FUNCTIONS=_activation,_stomp,_stack_current,_stack_base,_stack_end,_main,_malloc,_free
|
||||
|
||||
"$EMCC" stack_test.cpp -o stack_test_pt.mjs "${COMMON[@]}" \
|
||||
-pthread -sPTHREAD_POOL_SIZE=2 -sPTHREAD_POOL_SIZE_STRICT=0 \
|
||||
-sEXPORTED_FUNCTIONS=_activation,_stomp,_stack_current,_stack_base,_stack_end,_main,_malloc,_free,_start_churn,_stop_churn
|
||||
|
||||
echo "built: stack_test.mjs + stack_test_pt.mjs"
|
||||
Loading…
Reference in a new issue