Repository navigation
Forkwake: branching a live SQLite WebAssembly continuation with Asyncify #9250
nazeeh111
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Forkwake captures a compiled WebAssembly execution at one owned pending import, then restores that continuation into independent instances with different responses. The example pauses inside SQLite's VDBE, while a registered SQL callback is executing. An open transaction, two busy statements, nested C locals and allocated guest memory remain live at the cut.
The executable example resumes the same captured past three ways:
The query rows are read from each guest's final memory. They are not hardcoded outcome labels. The saved SQLite continuation has 484 frame bytes and 4 MiB of complete guest memory; actual SQLite allocation and the separate 64 KiB heap canary are reported separately. Resumed branches match uninterrupted original-module controls in return value, callback traces, all 22 result words and complete database JSON rows. The live SQL callback enters once, and a sealed prefix callback rejects replay.
Binaryen Asyncify provides the established stack transformation. Forkwake adds a closed guest contract, captured memory/globals/history, authenticated cuts and reusable transform caches, independently checked portable import, worker deadlines, and a state-inspection interface. It claims no invention of Asyncify or execution forking.
Repository and setup: https://github.com/nazeeh111/Forkwake
Release: https://github.com/nazeeh111/Forkwake/releases/tag/v0.1.0
Engine contract: https://github.com/nazeeh111/Forkwake/blob/v0.1.0/README_engine.md
Actual control tests: https://github.com/nazeeh111/Forkwake/blob/v0.1.0/tests/runtime.test.mjs
Runnable C/SQLite sources: https://github.com/nazeeh111/Forkwake/tree/v0.1.0/examples
Node 20+ is sufficient to run the shipped guests.
node cli.mjs demo --out ./sqlite-futuresgenerates current outcome evidence and a portable workspace;npm startopens the local inspector.The boundary is explicit: one closed wasm32 guest and one pending effect; owned unshared memory, mutable integer globals and fixed private function tables. No native process, files, sockets, threads or external service is cloned. Unsafe module shapes and impure storage accessors reject before guest execution. Forks resume without re-executing the prefix. Importing a portable cut intentionally runs the original prefix once again and demands identical state before issuing the new session's authentication seal. Runtime tests on these workloads do not prove arbitrary Asyncify equivalence.
Built, tested and this initial showcase prepared with Codex. No outside adoption is claimed. A useful next test is a public closed guest whose restored continuation disagrees with its uninterrupted original control; reproducible counterexamples would help improve the closure boundary.
All reactions