Files
rose-ash/shared/static/wasm/sx/freeze.sxbc
giles e0070041d6 Add .sxbc s-expression bytecode format
Bytecode modules are now serialized as s-expressions (.sxbc) in addition
to JSON (.sxbc.json). The .sxbc format is the canonical representation —
content-addressable, parseable by the SX parser, and suitable for CID
referencing. Annotation layers (source maps, variable names, tests, docs)
can reference the bytecode CID without polluting the bytecode itself.

Format: (sxbc version hash (code :arity N :bytecode (...) :constants (...)))

The browser loader tries .sxbc first (via load-sxbc kernel primitive),
falls back to .sxbc.json. Caddy needs .sxbc MIME type to serve the new
format (currently 404s, JSON fallback works).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 14:16:22 +00:00

108 lines
3.4 KiB
Plaintext

(sxbc 1 "19bca721c37b25b6"
(code
:bytecode (52 1 0 0 128 0 0 5 51 3 0 128 2 0 5 51 5 0 128 4 0 5 51 7 0 128 6 0 5 51 9 0 128 8 0 5 51 11 0 128 10 0 5 51 13 0 128 12 0 5 51 15 0 128 14 0 5 51 17 0 128 16 0 50)
:constants (
"freeze-registry"
"dict"
"freeze-signal"
(code :arity 2
:bytecode (1 1 0 2 52 0 0 2 17 2 16 2 33 56 0 20 3 0 16 2 52 2 0 2 6 34 5 0 5 52 4 0 0 17 3 20 5 0 16 3 1 7 0 16 0 1 8 0 16 1 52 6 0 4 48 2 5 20 3 0 16 2 16 3 52 9 0 3 32 1 0 2 50)
:constants (
"context"
"sx-freeze-scope"
"get"
"freeze-registry"
"list"
"append!"
"dict"
"name"
"signal"
"dict-set!"))
"freeze-scope"
(code :arity 2
:bytecode (1 1 0 16 0 52 0 0 2 5 20 3 0 16 0 52 4 0 0 52 2 0 3 5 20 5 0 16 1 2 48 2 5 1 1 0 52 6 0 1 5 2 50)
:constants (
"scope-push!"
"sx-freeze-scope"
"dict-set!"
"freeze-registry"
"list"
"cek-call"
"scope-pop!"))
"cek-freeze-scope"
(code :arity 1
:bytecode (20 1 0 16 0 52 0 0 2 6 34 5 0 5 52 2 0 0 17 1 52 3 0 0 17 2 51 5 0 1 2 16 1 52 4 0 2 5 1 6 0 16 0 1 7 0 16 2 52 3 0 4 50)
:constants (
"get"
"freeze-registry"
"list"
"dict"
"for-each"
(code :arity 1 :upvalue-count 1
:bytecode (18 0 16 0 1 2 0 52 1 0 2 20 3 0 16 0 1 4 0 52 1 0 2 48 1 52 0 0 3 50)
:constants (
"dict-set!"
"get"
"name"
"signal-value"
"signal"))
"name"
"signals"))
"cek-freeze-all"
(code
:bytecode (51 1 0 20 3 0 52 2 0 1 52 0 0 2 50)
:constants (
"map"
(code :arity 1
:bytecode (20 0 0 16 0 49 1 50)
:constants (
"cek-freeze-scope"))
"keys"
"freeze-registry"))
"cek-thaw-scope"
(code :arity 2
:bytecode (20 1 0 16 0 52 0 0 2 6 34 5 0 5 52 2 0 0 17 2 16 1 1 3 0 52 0 0 2 17 3 16 3 33 14 0 51 5 0 1 3 16 2 52 4 0 2 32 1 0 2 50)
:constants (
"get"
"freeze-registry"
"list"
"signals"
"for-each"
(code :arity 1 :upvalue-count 1
:bytecode (16 0 1 1 0 52 0 0 2 17 1 16 0 1 2 0 52 0 0 2 17 2 18 0 16 1 52 0 0 2 17 3 16 3 52 4 0 1 52 3 0 1 33 12 0 20 5 0 16 2 16 3 49 2 32 1 0 2 50)
:constants (
"get"
"name"
"signal"
"not"
"nil?"
"reset!"))))
"cek-thaw-all"
(code :arity 1
:bytecode (51 1 0 16 0 52 0 0 2 50)
:constants (
"for-each"
(code :arity 1
:bytecode (20 0 0 16 0 1 2 0 52 1 0 2 16 0 49 2 50)
:constants (
"cek-thaw-scope"
"get"
"name"))))
"freeze-to-sx"
(code :arity 1
:bytecode (20 0 0 20 1 0 16 0 48 1 49 1 50)
:constants (
"sx-serialize"
"cek-freeze-scope"))
"thaw-from-sx"
(code :arity 1
:bytecode (20 0 0 16 0 48 1 17 1 16 1 52 2 0 1 52 1 0 1 33 27 0 16 1 52 3 0 1 17 2 20 4 0 16 2 1 6 0 52 5 0 2 16 2 49 2 32 1 0 2 50)
:constants (
"sx-parse"
"not"
"empty?"
"first"
"cek-thaw-scope"
"get"
"name")))))