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>
This commit is contained in:
119
shared/static/wasm/sx/harness-reactive.sxbc
Normal file
119
shared/static/wasm/sx/harness-reactive.sxbc
Normal file
@@ -0,0 +1,119 @@
|
||||
(sxbc 1 "57726b5b82c1a3cb"
|
||||
(code
|
||||
:bytecode (51 1 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 5 51 19 0 128 18 0 5 51 21 0 128 20 0 50)
|
||||
:constants (
|
||||
"assert-signal-value"
|
||||
(code :arity 2
|
||||
:bytecode (20 0 0 16 0 48 1 17 2 20 1 0 16 2 16 1 1 3 0 16 1 1 4 0 16 2 52 2 0 4 49 3 50)
|
||||
:constants (
|
||||
"deref"
|
||||
"assert="
|
||||
"str"
|
||||
"Expected signal value "
|
||||
", got "))
|
||||
"assert-signal-has-subscribers"
|
||||
(code :arity 1
|
||||
:bytecode (20 0 0 20 3 0 16 0 48 1 52 2 0 1 1 4 0 52 1 0 2 1 5 0 49 2 50)
|
||||
:constants (
|
||||
"assert"
|
||||
">"
|
||||
"len"
|
||||
"signal-subscribers"
|
||||
0
|
||||
"Expected signal to have subscribers"))
|
||||
"assert-signal-no-subscribers"
|
||||
(code :arity 1
|
||||
:bytecode (20 0 0 20 3 0 16 0 48 1 52 2 0 1 1 4 0 52 1 0 2 1 5 0 49 2 50)
|
||||
:constants (
|
||||
"assert"
|
||||
"="
|
||||
"len"
|
||||
"signal-subscribers"
|
||||
0
|
||||
"Expected signal to have no subscribers"))
|
||||
"assert-signal-subscriber-count"
|
||||
(code :arity 2
|
||||
:bytecode (20 1 0 16 0 48 1 52 0 0 1 17 2 20 2 0 16 2 16 1 1 4 0 16 1 1 5 0 16 2 52 3 0 4 49 3 50)
|
||||
:constants (
|
||||
"len"
|
||||
"signal-subscribers"
|
||||
"assert="
|
||||
"str"
|
||||
"Expected "
|
||||
" subscribers, got "))
|
||||
"simulate-signal-set!"
|
||||
(code :arity 2
|
||||
:bytecode (20 0 0 16 0 16 1 49 2 50)
|
||||
:constants (
|
||||
"reset!"))
|
||||
"simulate-signal-swap!"
|
||||
(code :arity 2
|
||||
:bytecode (20 0 0 16 0 16 1 49 2 50)
|
||||
:constants (
|
||||
"swap!"))
|
||||
"assert-computed-dep-count"
|
||||
(code :arity 2
|
||||
:bytecode (20 1 0 16 0 48 1 52 0 0 1 17 2 20 2 0 16 2 16 1 1 4 0 16 1 1 5 0 16 2 52 3 0 4 49 3 50)
|
||||
:constants (
|
||||
"len"
|
||||
"signal-deps"
|
||||
"assert="
|
||||
"str"
|
||||
"Expected "
|
||||
" deps, got "))
|
||||
"assert-computed-depends-on"
|
||||
(code :arity 2
|
||||
:bytecode (20 0 0 20 2 0 16 0 48 1 16 1 52 1 0 2 1 3 0 49 2 50)
|
||||
:constants (
|
||||
"assert"
|
||||
"contains?"
|
||||
"signal-deps"
|
||||
"Expected computed to depend on the given signal"))
|
||||
"count-effect-runs"
|
||||
(code :arity 1
|
||||
:bytecode (20 0 0 1 1 0 48 1 17 1 20 2 0 51 3 0 1 1 48 1 5 1 1 0 17 2 20 2 0 51 4 0 1 2 1 0 48 1 17 3 16 2 50)
|
||||
:constants (
|
||||
"signal"
|
||||
0
|
||||
"effect"
|
||||
(code :upvalue-count 1
|
||||
:bytecode (20 0 0 18 0 49 1 50)
|
||||
:constants (
|
||||
"deref"))
|
||||
(code :upvalue-count 2
|
||||
:bytecode (18 0 1 1 0 52 0 0 2 19 0 5 20 2 0 18 1 2 49 2 50)
|
||||
:constants (
|
||||
"+"
|
||||
1
|
||||
"cek-call"))))
|
||||
"make-test-signal"
|
||||
(code :arity 1
|
||||
:bytecode (20 0 0 16 0 48 1 17 1 52 1 0 0 17 2 20 2 0 51 3 0 1 2 1 1 48 1 5 1 0 0 16 1 1 4 0 16 2 65 2 0 50)
|
||||
:constants (
|
||||
"signal"
|
||||
"list"
|
||||
"effect"
|
||||
(code :upvalue-count 2
|
||||
:bytecode (20 0 0 18 0 20 1 0 18 1 48 1 49 2 50)
|
||||
:constants (
|
||||
"append!"
|
||||
"deref"))
|
||||
"history"))
|
||||
"assert-batch-coalesces"
|
||||
(code :arity 2
|
||||
:bytecode (1 0 0 17 2 20 1 0 1 0 0 48 1 17 3 20 2 0 51 3 0 1 3 1 2 48 1 5 1 0 0 17 2 5 20 4 0 16 0 48 1 5 20 5 0 16 2 16 1 1 7 0 16 1 1 8 0 16 2 52 6 0 4 49 3 50)
|
||||
:constants (
|
||||
0
|
||||
"signal"
|
||||
"effect"
|
||||
(code :upvalue-count 2
|
||||
:bytecode (20 0 0 18 0 48 1 5 18 1 1 2 0 52 1 0 2 19 1 50)
|
||||
:constants (
|
||||
"deref"
|
||||
"+"
|
||||
1))
|
||||
"batch"
|
||||
"assert="
|
||||
"str"
|
||||
"Expected "
|
||||
" notifications, got ")))))
|
||||
Reference in New Issue
Block a user