From 1d064a1914b63eeff5fc234dbae10dda3f7e3edb Mon Sep 17 00:00:00 2001 From: giles Date: Sat, 28 Mar 2026 16:49:15 +0000 Subject: [PATCH] sx-http: silent JIT fallback, load signals+engine, fix render-to-html MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit JIT runtime errors now silently fall back to CEK without disabling the compiled bytecode or logging. This prevents render-to-html from being permanently disabled when one page has an unresolved symbol (e.g. the homepage stepper's --- hosts/ocaml/bin/sx_server.ml | 14 +++----------- hosts/ocaml/lib/sx_vm.ml | 13 ++++--------- 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/hosts/ocaml/bin/sx_server.ml b/hosts/ocaml/bin/sx_server.ml index 6e9161d4..5905c28f 100644 --- a/hosts/ocaml/bin/sx_server.ml +++ b/hosts/ocaml/bin/sx_server.ml @@ -696,14 +696,9 @@ let register_jit_hook env = | Lambda l -> (match l.l_compiled with | Some cl when not (Sx_vm.is_jit_failed cl) -> - (* Cached bytecode — run on VM, fall back to CEK on runtime error. - Mark as failed so we don't retry on every call. *) + (* Cached bytecode — run on VM, fall back to CEK on runtime error. *) (try Some (Sx_vm.call_closure cl args cl.vm_env_ref) - with e -> - let fn_name = match l.l_name with Some n -> n | None -> "?" in - Printf.eprintf "[jit] DISABLED %s — %s\n%!" fn_name (Printexc.to_string e); - l.l_compiled <- Some Sx_vm.jit_failed_sentinel; - None) + with _e -> None) (* silent fallback — no disable, no log *) | Some _ -> None (* compile failed or disabled — CEK handles *) | None -> let fn_name = match l.l_name with Some n -> n | None -> "?" in @@ -720,10 +715,7 @@ let register_jit_hook env = | Some cl -> l.l_compiled <- Some cl; (try Some (Sx_vm.call_closure cl args cl.vm_env_ref) - with e -> - Printf.eprintf "[jit] DISABLED %s — %s\n%!" fn_name (Printexc.to_string e); - l.l_compiled <- Some Sx_vm.jit_failed_sentinel; - None) + with _e -> None) (* silent fallback, keep bytecode *) | None -> None end) | _ -> None) diff --git a/hosts/ocaml/lib/sx_vm.ml b/hosts/ocaml/lib/sx_vm.ml index 4525775e..d7d24c39 100644 --- a/hosts/ocaml/lib/sx_vm.ml +++ b/hosts/ocaml/lib/sx_vm.ml @@ -164,10 +164,8 @@ and vm_call vm f args = (* Cached bytecode — run on VM using the closure's captured env, not the caller's globals. Closure vars were merged at compile time. *) (try push vm (call_closure cl args cl.vm_env_ref) - with e -> - let msg = match e with Eval_error m -> m | e -> Printexc.to_string e in - Printf.eprintf "[vm] JIT call failed for %s: %s — falling back to CEK\n%!" - (match l.l_name with Some n -> n | None -> "") msg; + with _e -> + (* Silent fallback to CEK — error is data-dependent, not a JIT bug *) push vm (Sx_ref.cek_call f (List args))) | Some _ -> (* Compile failed — CEK *) @@ -181,11 +179,8 @@ and vm_call vm f args = | Some cl -> l.l_compiled <- Some cl; (try push vm (call_closure cl args cl.vm_env_ref) - with e -> - let msg = match e with Eval_error m -> m | e -> Printexc.to_string e in - Printf.eprintf "[vm] JIT first-call failed for %s: %s — marking failed, falling back to CEK\n%!" - (match l.l_name with Some n -> n | None -> "") msg; - l.l_compiled <- Some jit_failed_sentinel; + with _e -> + (* Don't mark failed — error may be data-dependent *) push vm (Sx_ref.cek_call f (List args))) | None -> push vm (Sx_ref.cek_call f (List args))