40/40 VM tests pass, auto-compile disabled until full aser compilation
All VM tests green: closures with shared mutable upvalues, map/filter/ for-each via CALL_PRIM, recursive functions, nested closures. Auto-compile disabled: replacing individual Lambdas with NativeFn VM wrappers changes how the CEK dispatches calls, causing scope errors when mixed CEK+VM execution hits aser-expand-component. The fix is compiling the ENTIRE aser render path to run on the VM — no mixing. The VM infrastructure is complete and tested. Next step: compile adapter-sx.sx as a whole module, run the aser on the VM. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -831,7 +831,8 @@ let dispatch env cmd =
|
||||
let names = Hashtbl.fold (fun k _ acc -> k :: acc) env.bindings [] in
|
||||
List.iter (fun name ->
|
||||
match Hashtbl.find_opt env.bindings name with
|
||||
| Some (Lambda lam) when lam.l_name <> None ->
|
||||
| Some (Lambda lam) when lam.l_name <> None
|
||||
&& lam.l_closure.parent = None ->
|
||||
(try
|
||||
let quoted = List [Symbol "quote"; lam.l_body] in
|
||||
let result = Sx_ref.eval_expr (List [compile_fn; quoted]) (Env env) in
|
||||
@@ -857,8 +858,11 @@ let dispatch env cmd =
|
||||
incr count
|
||||
| _ -> incr failed
|
||||
with e ->
|
||||
if !failed < 5 then
|
||||
Printf.eprintf "[vm] FAIL %s: %s\n%!" name (Printexc.to_string e);
|
||||
if !failed < 3 then
|
||||
Printf.eprintf "[vm] FAIL %s: %s\n body: %s\n%!"
|
||||
name (Printexc.to_string e)
|
||||
(String.sub (inspect lam.l_body) 0
|
||||
(min 200 (String.length (inspect lam.l_body))));
|
||||
incr failed)
|
||||
| _ -> ()
|
||||
) names;
|
||||
|
||||
@@ -265,9 +265,12 @@ class OcamlBridge:
|
||||
_logger.info("Loaded %d definitions from .sx files into OCaml kernel (%d skipped)",
|
||||
count, skipped)
|
||||
|
||||
# VM auto-compile: ready when compiler handles all SX features.
|
||||
# Currently 6/117 compile; fallback fails on closure scope vars.
|
||||
# await self._send('(vm-compile)')
|
||||
# VM bytecode infrastructure ready. Auto-compile disabled:
|
||||
# compiled NativeFn wrappers change CEK dispatch behavior
|
||||
# causing scope errors in aser-expand-component. The VM
|
||||
# tests (40/40) verify correctness in isolation.
|
||||
# Enable after: full aser adapter compilation so the ENTIRE
|
||||
# render path runs on the VM, not mixed CEK+VM.
|
||||
except Exception as e:
|
||||
_logger.error("Failed to load .sx files into OCaml kernel: %s", e)
|
||||
self._components_loaded = False # retry next time
|
||||
|
||||
Reference in New Issue
Block a user