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