Native bytecode compilation in MCP: 108s → 1.9s (57x faster)

Replace Node.js compile-modules.js with direct Sx_compiler.compile_module
calls in mcp_tree.ml. No subprocess, no JIT warm-up, no Node.js.
23 files compile in 1.9 seconds.

Also includes rebuilt WASM kernel (iterative cek_run) and all 23
bytecode modules recompiled with native compiler.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-30 10:45:38 +00:00
parent a24efc1a00
commit 951b3a6586
61 changed files with 162 additions and 8202 deletions

View File

@@ -1,107 +1,3 @@
(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")))))
:constants ("freeze-registry" "dict" "freeze-signal" {:upvalue-count 0 :arity 2 :constants ("context" "sx-freeze-scope" "get" "freeze-registry" "list" "append!" "dict" "name" "signal" "dict-set!") :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)} "freeze-scope" {:upvalue-count 0 :arity 2 :constants ("scope-push!" "sx-freeze-scope" "dict-set!" "freeze-registry" "list" "cek-call" "scope-pop!") :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)} "cek-freeze-scope" {:upvalue-count 0 :arity 1 :constants ("get" "freeze-registry" "list" "dict" "for-each" {:upvalue-count 1 :arity 1 :constants ("dict-set!" "get" "name" "signal-value" "signal") :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)} "name" "signals") :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)} "cek-freeze-all" {:upvalue-count 0 :arity 0 :constants ("map" {:upvalue-count 0 :arity 1 :constants ("cek-freeze-scope") :bytecode (20 0 0 16 0 49 1 50)} "keys" "freeze-registry") :bytecode (51 1 0 20 3 0 52 2 0 1 52 0 0 2 50)} "cek-thaw-scope" {:upvalue-count 0 :arity 2 :constants ("get" "freeze-registry" "list" "signals" "for-each" {:upvalue-count 1 :arity 1 :constants ("get" "name" "signal" "not" "nil?" "reset!") :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)}) :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)} "cek-thaw-all" {:upvalue-count 0 :arity 1 :constants ("for-each" {:upvalue-count 0 :arity 1 :constants ("cek-thaw-scope" "get" "name") :bytecode (20 0 0 16 0 1 2 0 52 1 0 2 16 0 49 2 50)}) :bytecode (51 1 0 16 0 52 0 0 2 50)} "freeze-to-sx" {:upvalue-count 0 :arity 1 :constants ("sx-serialize" "cek-freeze-scope") :bytecode (20 0 0 20 1 0 16 0 48 1 49 1 50)} "thaw-from-sx" {:upvalue-count 0 :arity 1 :constants ("sx-parse" "not" "empty?" "first" "cek-thaw-scope" "get" "name") :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)}) :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)))