Wire transpiled VM as active execute_module — 2644 tests pass

The transpiled VM (sx_vm_ref.ml, from lib/vm.sx) is now the ACTIVE
bytecode execution engine. sx_server.ml and sx_browser.ml call
Sx_vm_ref.execute_module instead of Sx_vm.execute_module.

Results:
- OCaml tests: 2644 passed, 0 failed
- WASM tests: 32 passed, 0 failed
- Browser: zero errors, zero warnings, islands hydrate
- Server: pages render, JIT compiles, all routes work

The VM logic now lives in ONE place: lib/vm.sx (SX).
OCaml gets it via transpilation (bootstrap_vm.py).
JS/browser gets it via bytecode compilation (compile-modules.js).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-04 13:34:11 +00:00
parent 54ee673050
commit e46cdf3d4d
15 changed files with 5278 additions and 2729 deletions

View File

@@ -1338,7 +1338,7 @@ let rec dispatch env cmd =
(try
let code = Sx_vm.code_from_value code_val in
let globals = env_to_vm_globals env in
let result = Sx_vm.execute_module code globals in
let result = Sx_vm_ref.execute_module code globals in
send_ok_value result
with
| Eval_error msg -> send_error msg
@@ -1353,7 +1353,7 @@ let rec dispatch env cmd =
let code = Sx_vm.code_from_value code_val in
(* VM uses the LIVE kernel env — defines go directly into it *)
let globals = env_to_vm_globals env in
let _result = Sx_vm.execute_module code globals in
let _result = Sx_vm_ref.execute_module code globals in
(* Copy defines back into env *)
Hashtbl.iter (fun k v -> Hashtbl.replace env.bindings (Sx_types.intern k) v) globals;
send_ok ()
@@ -1950,7 +1950,7 @@ let http_inject_shell_statics env static_dir sx_sxc =
let component_hash = Digest.string component_defs |> Digest.to_hex in
(* Compute per-file hashes for cache busting *)
let wasm_hash = file_hash (static_dir ^ "/wasm/sx_browser.bc.wasm.js") in
let platform_hash = file_hash (static_dir ^ "/wasm/sx-platform-2.js") in
let platform_hash = file_hash (static_dir ^ "/wasm/sx-platform.js") in
let sxbc_hash = sxbc_combined_hash (static_dir ^ "/wasm") in
(* Read CSS for inline injection *)
let css_file_names = get_app_list "css-files" ["basics.css"; "tw.css"] in