Zero bootstrap patches: all 11 moved to spec or runtime

- make-raise-guard-frame: was never defined in spec — added it
- *last-error-kont*: set at error origination (host-error calls), not
  wrapped around every cek-run step. Zero overhead on normal path.
- JIT: jit-try-call runtime function called from spec. Platform
  registers hook via _jit_try_call_fn ref. No bootstrap patching.
- bootstrap.py compile_spec_to_ml() now returns transpiled output
  with zero post-processing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-03 15:17:13 +00:00
parent be47a5c1a5
commit bd8d62cd9a
5 changed files with 36 additions and 55 deletions

View File

@@ -474,3 +474,16 @@ let debug_log _ _ = Nil
(* mutable_list — mutable list for bytecode compiler pool entries *)
let mutable_list () = ListRef (ref [])
(* JIT try-call — ref set by sx_server.ml after compiler loads.
Returns Nil (no JIT) or the result value. Spec calls this. *)
let _jit_try_call_fn : (value -> value list -> value option) option ref = ref None
let jit_try_call f args =
match !_jit_try_call_fn with
| None -> Nil
| Some hook ->
match f with
| Lambda l when l.l_name <> None ->
let arg_list = match args with List a | ListRef { contents = a } -> a | _ -> [] in
(match hook f arg_list with Some result -> result | None -> Nil)
| _ -> Nil