Files
rose-ash/shared/static/wasm/sx/signals.sxbc.json
giles c923a34fa8 Fix WASM browser click handlers: 8 bugs, 50 new VM tests
The sx-get links were doing full page refreshes because click handlers
never attached. Root causes: VM frame management bug, missing primitives,
CEK/VM type dispatch mismatch, and silent error swallowing.

Fixes:
- VM frame exhaustion: frames <- [] now properly pops to rest_frames
- length primitive: add alias for len in OCaml primitives
- call_sx_fn: use sx_call directly instead of eval_expr (CEK checks
  for type "lambda" but VmClosure reports "function")
- Boot error surfacing: Sx.init() now has try/catch + failure summary
- Callback error surfacing: catch-all handler for non-Eval_error exceptions
- Silent JIT failures: log before CEK fallback instead of swallowing
- vm→env sync: loadModule now calls sync_vm_to_env()
- sx_build_bytecode MCP tool added for bytecode compilation

Tests: 50 new tests across test-vm.sx and test-vm-primitives.sx covering
nested VM calls, frame integrity, CEK bridge, primitive availability,
cross-module symbol resolution, and callback dispatch.

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

1 line
3.6 KiB
JSON

{"magic":"SXBC","version":1,"hash":"1e908c466d2b8c22","module":{"bytecode":[51,1,0,128,0,0,5,51,3,0,128,2,0,5,52,5,0,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,50],"constants":[{"t":"s","v":"with-marsh-scope"},{"t":"code","v":{"bytecode":[52,0,0,0,17,2,20,1,0,51,2,0,1,2,16,1,48,2,5,20,3,0,16,0,1,4,0,16,2,49,3,50],"constants":[{"t":"s","v":"list"},{"t":"s","v":"with-island-scope"},{"t":"code","v":{"bytecode":[20,0,0,18,0,16,0,49,2,50],"constants":[{"t":"s","v":"append!"}],"arity":1,"upvalue-count":1}},{"t":"s","v":"dom-set-data"},{"t":"s","v":"sx-marsh-disposers"}],"arity":2}},{"t":"s","v":"dispose-marsh-scope"},{"t":"code","v":{"bytecode":[20,0,0,16,0,1,1,0,48,2,17,1,16,1,33,24,0,51,3,0,16,1,52,2,0,2,5,20,4,0,16,0,1,1,0,2,49,3,32,1,0,2,50],"constants":[{"t":"s","v":"dom-get-data"},{"t":"s","v":"sx-marsh-disposers"},{"t":"s","v":"for-each"},{"t":"code","v":{"bytecode":[20,0,0,16,0,2,49,2,50],"constants":[{"t":"s","v":"cek-call"}],"arity":1}},{"t":"s","v":"dom-set-data"}],"arity":1}},{"t":"s","v":"*store-registry*"},{"t":"s","v":"dict"},{"t":"s","v":"def-store"},{"t":"code","v":{"bytecode":[20,0,0,17,2,16,2,16,0,52,2,0,2,52,1,0,1,33,22,0,16,2,16,0,20,4,0,16,1,2,48,2,52,3,0,3,21,0,0,32,1,0,2,5,20,0,0,16,0,52,5,0,2,50],"constants":[{"t":"s","v":"*store-registry*"},{"t":"s","v":"not"},{"t":"s","v":"has-key?"},{"t":"s","v":"assoc"},{"t":"s","v":"cek-call"},{"t":"s","v":"get"}],"arity":2}},{"t":"s","v":"use-store"},{"t":"code","v":{"bytecode":[20,1,0,16,0,52,0,0,2,33,12,0,20,1,0,16,0,52,2,0,2,32,16,0,1,5,0,16,0,1,6,0,52,4,0,3,52,3,0,1,50],"constants":[{"t":"s","v":"has-key?"},{"t":"s","v":"*store-registry*"},{"t":"s","v":"get"},{"t":"s","v":"error"},{"t":"s","v":"str"},{"t":"s","v":"Store not found: "},{"t":"s","v":". Call (def-store ...) before (use-store ...)."}],"arity":1}},{"t":"s","v":"clear-stores"},{"t":"code","v":{"bytecode":[52,0,0,0,21,1,0,50],"constants":[{"t":"s","v":"dict"},{"t":"s","v":"*store-registry*"}]}},{"t":"s","v":"emit-event"},{"t":"code","v":{"bytecode":[20,0,0,16,0,16,1,16,2,49,3,50],"constants":[{"t":"s","v":"dom-dispatch"}],"arity":3}},{"t":"s","v":"on-event"},{"t":"code","v":{"bytecode":[20,0,0,16,0,16,1,16,2,49,3,50],"constants":[{"t":"s","v":"dom-on"}],"arity":3}},{"t":"s","v":"bridge-event"},{"t":"code","v":{"bytecode":[20,0,0,51,1,0,1,0,1,1,1,3,1,2,49,1,50],"constants":[{"t":"s","v":"effect"},{"t":"code","v":{"bytecode":[20,0,0,18,0,18,1,51,1,0,0,2,0,3,48,3,17,0,16,0,50],"constants":[{"t":"s","v":"dom-on"},{"t":"code","v":{"bytecode":[20,0,0,16,0,48,1,17,1,18,0,33,16,0,20,1,0,18,0,16,1,52,2,0,1,48,2,32,2,0,16,1,17,2,20,3,0,18,1,16,2,49,2,50],"constants":[{"t":"s","v":"event-detail"},{"t":"s","v":"cek-call"},{"t":"s","v":"list"},{"t":"s","v":"reset!"}],"arity":1,"upvalue-count":2}}],"upvalue-count":4}}],"arity":4}},{"t":"s","v":"resource"},{"t":"code","v":{"bytecode":[20,0,0,1,2,0,3,1,3,0,2,1,4,0,2,52,1,0,6,48,1,17,1,20,5,0,20,6,0,16,0,2,48,2,51,7,0,1,1,51,8,0,1,1,48,3,5,16,1,50],"constants":[{"t":"s","v":"signal"},{"t":"s","v":"dict"},{"t":"s","v":"loading"},{"t":"s","v":"data"},{"t":"s","v":"error"},{"t":"s","v":"promise-then"},{"t":"s","v":"cek-call"},{"t":"code","v":{"bytecode":[20,0,0,18,0,1,2,0,4,1,3,0,16,0,1,4,0,2,52,1,0,6,49,2,50],"constants":[{"t":"s","v":"reset!"},{"t":"s","v":"dict"},{"t":"s","v":"loading"},{"t":"s","v":"data"},{"t":"s","v":"error"}],"arity":1,"upvalue-count":1}},{"t":"code","v":{"bytecode":[20,0,0,18,0,1,2,0,4,1,3,0,2,1,4,0,16,0,52,1,0,6,49,2,50],"constants":[{"t":"s","v":"reset!"},{"t":"s","v":"dict"},{"t":"s","v":"loading"},{"t":"s","v":"data"},{"t":"s","v":"error"}],"arity":1,"upvalue-count":1}}],"arity":1}}]}}