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>
1 line
13 KiB
JSON
1 line
13 KiB
JSON
{"magic":"SXBC","version":1,"hash":"96c150ad4f0a6342","module":{"bytecode":[1,2,0,1,3,0,1,4,0,1,5,0,1,6,0,1,7,0,1,8,0,1,9,0,1,10,0,1,11,0,1,12,0,1,13,0,1,14,0,1,15,0,1,16,0,1,17,0,1,18,0,1,19,0,1,20,0,1,21,0,1,22,0,1,23,0,1,24,0,1,25,0,1,26,0,1,27,0,1,28,0,1,29,0,1,30,0,1,31,0,1,32,0,1,33,0,1,34,0,1,35,0,1,36,0,1,37,0,1,38,0,1,39,0,1,40,0,1,41,0,1,42,0,1,43,0,1,44,0,1,45,0,1,46,0,1,47,0,1,48,0,1,49,0,1,50,0,1,51,0,1,52,0,1,53,0,1,54,0,1,55,0,1,56,0,1,57,0,1,58,0,1,59,0,1,60,0,1,61,0,1,62,0,1,63,0,1,64,0,1,65,0,1,66,0,1,67,0,1,68,0,1,69,0,1,70,0,1,71,0,1,72,0,1,73,0,1,74,0,1,75,0,1,76,0,1,77,0,1,78,0,1,79,0,1,80,0,1,81,0,1,82,0,1,83,0,1,84,0,1,85,0,1,86,0,1,87,0,1,88,0,1,89,0,1,90,0,1,91,0,1,92,0,1,93,0,1,94,0,1,95,0,1,96,0,1,97,0,1,98,0,1,99,0,1,100,0,1,101,0,1,102,0,1,103,0,1,104,0,1,105,0,1,106,0,1,107,0,1,108,0,1,109,0,1,110,0,1,111,0,1,112,0,1,113,0,1,114,0,1,115,0,1,116,0,1,117,0,1,118,0,1,119,0,1,120,0,1,121,0,1,122,0,1,123,0,1,124,0,1,125,0,1,126,0,1,127,0,1,128,0,1,129,0,1,130,0,1,131,0,1,132,0,1,133,0,1,134,0,1,135,0,1,136,0,1,137,0,1,138,0,1,139,0,1,140,0,52,1,0,139,128,0,0,5,1,142,0,1,143,0,1,53,0,1,71,0,1,144,0,1,55,0,1,84,0,1,73,0,1,7,0,1,6,0,1,145,0,1,87,0,1,146,0,1,54,0,52,1,0,14,128,141,0,5,1,148,0,1,149,0,1,150,0,1,151,0,1,152,0,1,153,0,1,154,0,1,155,0,1,156,0,1,157,0,1,158,0,1,159,0,1,160,0,1,161,0,1,162,0,1,163,0,1,164,0,1,165,0,1,166,0,1,167,0,1,168,0,1,169,0,1,170,0,52,1,0,23,128,147,0,5,52,1,0,0,128,171,0,5,51,173,0,128,172,0,5,51,175,0,128,174,0,5,51,177,0,128,176,0,5,51,179,0,128,178,0,5,51,181,0,128,180,0,5,51,183,0,128,182,0,5,51,185,0,128,184,0,5,51,187,0,128,186,0,5,51,189,0,128,188,0,5,51,191,0,128,190,0,5,51,193,0,128,192,0,50],"constants":[{"t":"s","v":"HTML_TAGS"},{"t":"s","v":"list"},{"t":"s","v":"html"},{"t":"s","v":"head"},{"t":"s","v":"body"},{"t":"s","v":"title"},{"t":"s","v":"meta"},{"t":"s","v":"link"},{"t":"s","v":"script"},{"t":"s","v":"style"},{"t":"s","v":"noscript"},{"t":"s","v":"header"},{"t":"s","v":"nav"},{"t":"s","v":"main"},{"t":"s","v":"section"},{"t":"s","v":"article"},{"t":"s","v":"aside"},{"t":"s","v":"footer"},{"t":"s","v":"h1"},{"t":"s","v":"h2"},{"t":"s","v":"h3"},{"t":"s","v":"h4"},{"t":"s","v":"h5"},{"t":"s","v":"h6"},{"t":"s","v":"hgroup"},{"t":"s","v":"div"},{"t":"s","v":"p"},{"t":"s","v":"blockquote"},{"t":"s","v":"pre"},{"t":"s","v":"figure"},{"t":"s","v":"figcaption"},{"t":"s","v":"address"},{"t":"s","v":"details"},{"t":"s","v":"summary"},{"t":"s","v":"a"},{"t":"s","v":"span"},{"t":"s","v":"em"},{"t":"s","v":"strong"},{"t":"s","v":"small"},{"t":"s","v":"b"},{"t":"s","v":"i"},{"t":"s","v":"u"},{"t":"s","v":"s"},{"t":"s","v":"mark"},{"t":"s","v":"sub"},{"t":"s","v":"sup"},{"t":"s","v":"abbr"},{"t":"s","v":"cite"},{"t":"s","v":"code"},{"t":"s","v":"kbd"},{"t":"s","v":"samp"},{"t":"s","v":"var"},{"t":"s","v":"time"},{"t":"s","v":"br"},{"t":"s","v":"wbr"},{"t":"s","v":"hr"},{"t":"s","v":"ul"},{"t":"s","v":"ol"},{"t":"s","v":"li"},{"t":"s","v":"dl"},{"t":"s","v":"dt"},{"t":"s","v":"dd"},{"t":"s","v":"table"},{"t":"s","v":"thead"},{"t":"s","v":"tbody"},{"t":"s","v":"tfoot"},{"t":"s","v":"tr"},{"t":"s","v":"th"},{"t":"s","v":"td"},{"t":"s","v":"caption"},{"t":"s","v":"colgroup"},{"t":"s","v":"col"},{"t":"s","v":"form"},{"t":"s","v":"input"},{"t":"s","v":"textarea"},{"t":"s","v":"select"},{"t":"s","v":"option"},{"t":"s","v":"optgroup"},{"t":"s","v":"button"},{"t":"s","v":"label"},{"t":"s","v":"fieldset"},{"t":"s","v":"legend"},{"t":"s","v":"output"},{"t":"s","v":"datalist"},{"t":"s","v":"img"},{"t":"s","v":"video"},{"t":"s","v":"audio"},{"t":"s","v":"source"},{"t":"s","v":"picture"},{"t":"s","v":"canvas"},{"t":"s","v":"iframe"},{"t":"s","v":"svg"},{"t":"s","v":"math"},{"t":"s","v":"path"},{"t":"s","v":"circle"},{"t":"s","v":"ellipse"},{"t":"s","v":"rect"},{"t":"s","v":"line"},{"t":"s","v":"polyline"},{"t":"s","v":"polygon"},{"t":"s","v":"text"},{"t":"s","v":"tspan"},{"t":"s","v":"g"},{"t":"s","v":"defs"},{"t":"s","v":"use"},{"t":"s","v":"clipPath"},{"t":"s","v":"mask"},{"t":"s","v":"pattern"},{"t":"s","v":"linearGradient"},{"t":"s","v":"radialGradient"},{"t":"s","v":"stop"},{"t":"s","v":"filter"},{"t":"s","v":"feGaussianBlur"},{"t":"s","v":"feOffset"},{"t":"s","v":"feBlend"},{"t":"s","v":"feColorMatrix"},{"t":"s","v":"feComposite"},{"t":"s","v":"feMerge"},{"t":"s","v":"feMergeNode"},{"t":"s","v":"feTurbulence"},{"t":"s","v":"feComponentTransfer"},{"t":"s","v":"feFuncR"},{"t":"s","v":"feFuncG"},{"t":"s","v":"feFuncB"},{"t":"s","v":"feFuncA"},{"t":"s","v":"feDisplacementMap"},{"t":"s","v":"feFlood"},{"t":"s","v":"feImage"},{"t":"s","v":"feMorphology"},{"t":"s","v":"feSpecularLighting"},{"t":"s","v":"feDiffuseLighting"},{"t":"s","v":"fePointLight"},{"t":"s","v":"feSpotLight"},{"t":"s","v":"feDistantLight"},{"t":"s","v":"animate"},{"t":"s","v":"animateTransform"},{"t":"s","v":"foreignObject"},{"t":"s","v":"template"},{"t":"s","v":"slot"},{"t":"s","v":"dialog"},{"t":"s","v":"menu"},{"t":"s","v":"VOID_ELEMENTS"},{"t":"s","v":"area"},{"t":"s","v":"base"},{"t":"s","v":"embed"},{"t":"s","v":"param"},{"t":"s","v":"track"},{"t":"s","v":"BOOLEAN_ATTRS"},{"t":"s","v":"async"},{"t":"s","v":"autofocus"},{"t":"s","v":"autoplay"},{"t":"s","v":"checked"},{"t":"s","v":"controls"},{"t":"s","v":"default"},{"t":"s","v":"defer"},{"t":"s","v":"disabled"},{"t":"s","v":"formnovalidate"},{"t":"s","v":"hidden"},{"t":"s","v":"inert"},{"t":"s","v":"ismap"},{"t":"s","v":"loop"},{"t":"s","v":"multiple"},{"t":"s","v":"muted"},{"t":"s","v":"nomodule"},{"t":"s","v":"novalidate"},{"t":"s","v":"open"},{"t":"s","v":"playsinline"},{"t":"s","v":"readonly"},{"t":"s","v":"required"},{"t":"s","v":"reversed"},{"t":"s","v":"selected"},{"t":"s","v":"*definition-form-extensions*"},{"t":"s","v":"definition-form?"},{"t":"code","v":{"bytecode":[16,0,1,1,0,52,0,0,2,6,34,94,0,5,16,0,1,2,0,52,0,0,2,6,34,80,0,5,16,0,1,3,0,52,0,0,2,6,34,66,0,5,16,0,1,4,0,52,0,0,2,6,34,52,0,5,16,0,1,5,0,52,0,0,2,6,34,38,0,5,16,0,1,6,0,52,0,0,2,6,34,24,0,5,16,0,1,7,0,52,0,0,2,6,34,10,0,5,20,9,0,16,0,52,8,0,2,50],"constants":[{"t":"s","v":"="},{"t":"s","v":"define"},{"t":"s","v":"defcomp"},{"t":"s","v":"defisland"},{"t":"s","v":"defmacro"},{"t":"s","v":"defstyle"},{"t":"s","v":"deftype"},{"t":"s","v":"defeffect"},{"t":"s","v":"contains?"},{"t":"s","v":"*definition-form-extensions*"}],"arity":1}},{"t":"s","v":"parse-element-args"},{"t":"code","v":{"bytecode":[52,0,0,0,17,2,52,1,0,0,17,3,51,3,0,1,0,1,1,1,2,1,3,1,4,0,1,5,0,1,6,0,4,52,0,0,4,16,0,52,2,0,3,5,16,2,16,3,52,1,0,2,50],"constants":[{"t":"s","v":"dict"},{"t":"s","v":"list"},{"t":"s","v":"reduce"},{"t":"code","v":{"bytecode":[16,0,1,1,0,52,0,0,2,17,2,16,2,33,29,0,16,0,1,1,0,4,1,3,0,16,0,1,3,0,52,0,0,2,52,4,0,1,52,2,0,5,32,154,0,16,1,52,6,0,1,1,7,0,52,5,0,2,6,33,24,0,5,16,0,1,3,0,52,0,0,2,52,4,0,1,18,0,52,9,0,1,52,8,0,2,33,78,0,20,10,0,20,11,0,18,0,16,0,1,3,0,52,0,0,2,52,4,0,1,52,12,0,2,18,1,48,2,48,1,17,3,18,2,20,14,0,16,1,48,1,16,3,52,13,0,3,5,16,0,1,1,0,3,1,3,0,16,0,1,3,0,52,0,0,2,52,4,0,1,52,2,0,5,32,32,0,20,15,0,18,3,16,1,48,2,5,16,0,1,3,0,16,0,1,3,0,52,0,0,2,52,4,0,1,52,2,0,3,50],"constants":[{"t":"s","v":"get"},{"t":"s","v":"skip"},{"t":"s","v":"assoc"},{"t":"s","v":"i"},{"t":"s","v":"inc"},{"t":"s","v":"="},{"t":"s","v":"type-of"},{"t":"s","v":"keyword"},{"t":"s","v":"<"},{"t":"s","v":"len"},{"t":"s","v":"trampoline"},{"t":"s","v":"eval-expr"},{"t":"s","v":"nth"},{"t":"s","v":"dict-set!"},{"t":"s","v":"keyword-name"},{"t":"s","v":"append!"}],"arity":2,"upvalue-count":4}},{"t":"s","v":"i"},{"t":"n","v":0},{"t":"s","v":"skip"}],"arity":2}},{"t":"s","v":"render-attrs"},{"t":"code","v":{"bytecode":[1,1,0,51,3,0,1,0,16,0,52,4,0,1,52,2,0,2,52,0,0,2,50],"constants":[{"t":"s","v":"join"},{"t":"s","v":""},{"t":"s","v":"map"},{"t":"code","v":{"bytecode":[18,0,16,0,52,0,0,2,17,1,20,2,0,16,0,52,1,0,2,6,33,3,0,5,16,1,33,12,0,1,4,0,16,0,52,3,0,2,32,70,0,20,2,0,16,0,52,1,0,2,6,33,7,0,5,16,1,52,5,0,1,33,6,0,1,6,0,32,41,0,16,1,52,7,0,1,33,6,0,1,6,0,32,26,0,1,4,0,16,0,1,8,0,20,9,0,16,1,52,3,0,1,48,1,1,10,0,52,3,0,5,50],"constants":[{"t":"s","v":"dict-get"},{"t":"s","v":"contains?"},{"t":"s","v":"BOOLEAN_ATTRS"},{"t":"s","v":"str"},{"t":"s","v":" "},{"t":"s","v":"not"},{"t":"s","v":""},{"t":"s","v":"nil?"},{"t":"s","v":"=\""},{"t":"s","v":"escape-attr"},{"t":"s","v":"\""}],"arity":1,"upvalue-count":1}},{"t":"s","v":"keys"}],"arity":1}},{"t":"s","v":"eval-cond"},{"t":"code","v":{"bytecode":[16,0,52,0,0,1,33,12,0,20,1,0,16,0,16,1,49,2,32,9,0,20,2,0,16,0,16,1,49,2,50],"constants":[{"t":"s","v":"cond-scheme?"},{"t":"s","v":"eval-cond-scheme"},{"t":"s","v":"eval-cond-clojure"}],"arity":2}},{"t":"s","v":"eval-cond-scheme"},{"t":"code","v":{"bytecode":[16,0,52,0,0,1,33,4,0,2,32,76,0,16,0,52,1,0,1,17,2,16,2,52,1,0,1,17,3,16,2,1,3,0,52,2,0,2,17,4,16,3,52,4,0,1,33,5,0,16,4,32,35,0,20,5,0,20,6,0,16,3,16,1,48,2,48,1,33,5,0,16,4,32,13,0,20,7,0,16,0,52,8,0,1,16,1,49,2,50],"constants":[{"t":"s","v":"empty?"},{"t":"s","v":"first"},{"t":"s","v":"nth"},{"t":"n","v":1},{"t":"s","v":"is-else-clause?"},{"t":"s","v":"trampoline"},{"t":"s","v":"eval-expr"},{"t":"s","v":"eval-cond-scheme"},{"t":"s","v":"rest"}],"arity":2}},{"t":"s","v":"eval-cond-clojure"},{"t":"code","v":{"bytecode":[16,0,52,1,0,1,1,2,0,52,0,0,2,33,4,0,2,32,71,0,16,0,52,3,0,1,17,2,16,0,1,5,0,52,4,0,2,17,3,16,2,52,6,0,1,33,5,0,16,3,32,38,0,20,7,0,20,8,0,16,2,16,1,48,2,48,1,33,5,0,16,3,32,16,0,20,9,0,16,0,1,2,0,52,10,0,2,16,1,49,2,50],"constants":[{"t":"s","v":"<"},{"t":"s","v":"len"},{"t":"n","v":2},{"t":"s","v":"first"},{"t":"s","v":"nth"},{"t":"n","v":1},{"t":"s","v":"is-else-clause?"},{"t":"s","v":"trampoline"},{"t":"s","v":"eval-expr"},{"t":"s","v":"eval-cond-clojure"},{"t":"s","v":"slice"}],"arity":2}},{"t":"s","v":"process-bindings"},{"t":"code","v":{"bytecode":[20,0,0,16,1,48,1,17,2,51,2,0,1,2,16,0,52,1,0,2,5,16,2,50],"constants":[{"t":"s","v":"env-extend"},{"t":"s","v":"for-each"},{"t":"code","v":{"bytecode":[16,0,52,1,0,1,1,2,0,52,0,0,2,6,33,14,0,5,16,0,52,4,0,1,1,5,0,52,3,0,2,33,79,0,16,0,52,6,0,1,52,1,0,1,1,7,0,52,0,0,2,33,14,0,20,8,0,16,0,52,6,0,1,48,1,32,10,0,16,0,52,6,0,1,52,9,0,1,17,1,20,10,0,18,0,16,1,20,11,0,20,12,0,16,0,1,14,0,52,13,0,2,18,0,48,2,48,1,49,3,32,1,0,2,50],"constants":[{"t":"s","v":"="},{"t":"s","v":"type-of"},{"t":"s","v":"list"},{"t":"s","v":">="},{"t":"s","v":"len"},{"t":"n","v":2},{"t":"s","v":"first"},{"t":"s","v":"symbol"},{"t":"s","v":"symbol-name"},{"t":"s","v":"str"},{"t":"s","v":"env-bind!"},{"t":"s","v":"trampoline"},{"t":"s","v":"eval-expr"},{"t":"s","v":"nth"},{"t":"n","v":1}],"arity":1,"upvalue-count":1}}],"arity":2}},{"t":"s","v":"is-render-expr?"},{"t":"code","v":{"bytecode":[16,0,52,2,0,1,1,3,0,52,1,0,2,52,0,0,1,6,34,7,0,5,16,0,52,4,0,1,33,4,0,4,32,170,0,16,0,52,5,0,1,17,1,16,1,52,2,0,1,1,6,0,52,1,0,2,52,0,0,1,33,4,0,4,32,138,0,20,7,0,16,1,48,1,17,2,16,2,1,8,0,52,1,0,2,6,34,116,0,5,16,2,1,9,0,52,1,0,2,6,34,102,0,5,16,2,1,11,0,52,10,0,2,6,34,88,0,5,16,2,1,12,0,52,10,0,2,6,34,74,0,5,20,14,0,16,2,52,13,0,2,6,34,60,0,5,16,2,1,17,0,52,16,0,2,1,18,0,52,15,0,2,6,33,39,0,5,16,0,52,19,0,1,1,20,0,52,15,0,2,6,33,21,0,5,16,0,1,20,0,52,21,0,2,52,2,0,1,1,22,0,52,1,0,2,50],"constants":[{"t":"s","v":"not"},{"t":"s","v":"="},{"t":"s","v":"type-of"},{"t":"s","v":"list"},{"t":"s","v":"empty?"},{"t":"s","v":"first"},{"t":"s","v":"symbol"},{"t":"s","v":"symbol-name"},{"t":"s","v":"<>"},{"t":"s","v":"raw!"},{"t":"s","v":"starts-with?"},{"t":"s","v":"~"},{"t":"s","v":"html:"},{"t":"s","v":"contains?"},{"t":"s","v":"HTML_TAGS"},{"t":"s","v":">"},{"t":"s","v":"index-of"},{"t":"s","v":"-"},{"t":"n","v":0},{"t":"s","v":"len"},{"t":"n","v":1},{"t":"s","v":"nth"},{"t":"s","v":"keyword"}],"arity":1}},{"t":"s","v":"merge-spread-attrs"},{"t":"code","v":{"bytecode":[51,1,0,1,1,1,0,16,1,52,2,0,1,52,0,0,2,50],"constants":[{"t":"s","v":"for-each"},{"t":"code","v":{"bytecode":[18,0,16,0,52,0,0,2,17,1,16,0,1,2,0,52,1,0,2,33,62,0,18,1,1,2,0,52,0,0,2,17,2,18,1,1,2,0,16,2,6,33,14,0,5,16,2,1,5,0,52,1,0,2,52,4,0,1,33,14,0,16,2,1,7,0,16,1,52,6,0,3,32,2,0,16,1,52,3,0,3,32,84,0,16,0,1,8,0,52,1,0,2,33,62,0,18,1,1,8,0,52,0,0,2,17,2,18,1,1,8,0,16,2,6,33,14,0,5,16,2,1,5,0,52,1,0,2,52,4,0,1,33,14,0,16,2,1,9,0,16,1,52,6,0,3,32,2,0,16,1,52,3,0,3,32,10,0,18,1,16,0,16,1,52,3,0,3,50],"constants":[{"t":"s","v":"dict-get"},{"t":"s","v":"="},{"t":"s","v":"class"},{"t":"s","v":"dict-set!"},{"t":"s","v":"not"},{"t":"s","v":""},{"t":"s","v":"str"},{"t":"s","v":" "},{"t":"s","v":"style"},{"t":"s","v":";"}],"arity":1,"upvalue-count":2}},{"t":"s","v":"keys"}],"arity":2}},{"t":"s","v":"escape-html"},{"t":"code","v":{"bytecode":[16,0,52,0,0,1,17,1,16,1,1,2,0,1,3,0,52,1,0,3,17,1,5,16,1,1,4,0,1,5,0,52,1,0,3,17,1,5,16,1,1,6,0,1,7,0,52,1,0,3,17,1,5,16,1,1,8,0,1,9,0,52,1,0,3,17,1,5,16,1,50],"constants":[{"t":"s","v":"str"},{"t":"s","v":"replace"},{"t":"s","v":"&"},{"t":"s","v":"&"},{"t":"s","v":"<"},{"t":"s","v":"<"},{"t":"s","v":">"},{"t":"s","v":">"},{"t":"s","v":"\""},{"t":"s","v":"""}],"arity":1}},{"t":"s","v":"escape-attr"},{"t":"code","v":{"bytecode":[20,0,0,16,0,49,1,50],"constants":[{"t":"s","v":"escape-html"}],"arity":1}}]}} |