Conversation
…n, add wasm docs (issue #93) Phase 1+2 initial work for the CWIST WASM workstream: - Makefile: add src/core/db/db.c and lib/sqlite3/sqlite3.c to WASM_SRCS so the ROADMAP claim for cwist_db_open_memory/cwist_db_serialize under WASM is actually true. Builds clean with emcc. - tests/wasm_smoke.c: add a cwist_db round trip (create + insert, serialize to an image blob, reopen read-only via cwist_db_open_memory, query back). Also fix JS that the tree-wide clang-format pass had corrupted ('=>' rewritten to '= >'): EM_JS stringifies its raw argument, so brace-block bodies must be protected with clang-format off/on or make format silently breaks the WASM build - exactly the regression class issue #93 gap 2 warns about. - include/cwist/wasm/typedarray.h: same clang-format off/on protection for CWIST_WASM_INSTALL_VIEWS. - docs/api/wasm.md: initial documentation - build, in-scope/excluded subsystems, dispatch_memory pattern, TypedArray helpers, db round trip, session/cookie caveats. Verified: make wasm and make wasm-smoke pass under Emscripten 5.0.0 + node; format-check stable.
The WASM archive and smoke test were manual-only, so WASM-only regressions (like the EM_JS corruption from the tree-wide format) went unnoticed. Install emsdk 5.0.0 on the runner, build libcwist_wasm.a, and run wasm-smoke under node on every push/PR to main and dev.
actions/cache restores the emsdk cache without the executable bit on its bundled node binary, so 'node wasm_smoke.js' failed with Permission denied on cache hits.
The chmod -R on the cache folder did not cover the node binary that ends up on PATH. Parameterize NODE in the Makefile and have the workflow chmod the exact resolved node binary, falling back to the runner's system node.
|
@Bhumika-1432006 One structural request before this leaves draft: Scope the diff to the 5 WASM files. The branch currently carries a merge of #175 and a main-side benchmark report refresh, so the diff is 14 files and includes README/benchmark numbers from main. Please rebase onto current dev (or drop the merge commits) so the PR only touches the WASM work. Mergeable is CLEAN either way, but merging as-is would land main's benchmark numbers into dev's README. When you do, one thing to keep: the FIN=1 orphan CONTINUATION check from #175 that rides along in this branch is genuinely missing on dev (an orphan CONTINUATION with FIN=1 falls through both branches in And a few follow-ups we would appreciate, roughly in priority order. Items 1 and 2 are small enough to fold into this PR; 3 and 4 can be separate issues if you prefer:
Happy to re-review quickly once the branch is rebased. |
Tags already exist for v3.4 (2026-09-12), v3.4.1 (2026-09-14), and v3.5 (2026-09-15), but the milestone sections still read as plans. Convert them to released, reference the unprofiled full-GC overhead follow-up (#65), and add the v3.6 milestone (WASM client-side support, issue #93) with the Phase 1-4 structure from PR #176 and its review follow-ups. Also fix the stale v3.2 pin reference; the contract app tracks v3.3.
Part of #93 (Phase 1 + start of Phase 2). Draft.
What's here
src/core/db/db.c+lib/sqlite3/sqlite3.cadded toWASM_SRCS- the ROADMAP claim thatcwist_db_open_memory()/cwist_db_serialize()work under WASM is now actually true (gap 1). Compiles clean with emcc.cwist_dbround trip - create + insert, serialize to an image blob, reopen read-only viacwist_db_open_memory(), query the row back. Also fixes JS that the tree-wide clang-format pass corrupted (=>rewritten to= >):EM_JSstringifies its raw argument, so brace-block bodies are now wrapped inclang-format off/onormake formatsilently breaks the WASM build.CWIST_WASM_INSTALL_VIEWS.dispatch_memorypattern, TypedArray helpers, db round trip, session caveats.wasm-smokeon every push/PR to main/dev (gap 2). Includes a workaround for the actions/cache emsdk exec-bit loss;NODEis now overridable in the Makefile.Verified
make wasm+make wasm-smokelocally (Emscripten 5.0.0 + node),make formatidempotent wrt EM_JS bodies.Still open (later PRs)