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

@@ -127,6 +127,8 @@
(define make-raise-eval-frame (fn (env continuable?) {:scheme continuable? :env env :type "raise-eval"}))
(define make-raise-guard-frame (fn (env saved-kont) {:env env :type "raise-guard" :remaining saved-kont}))
(define
find-matching-handler
(fn
@@ -2640,8 +2642,10 @@
(handler-fn (kont-find-handler rest-k condition)))
(if
(nil? handler-fn)
(host-error
(str "Unhandled exception: " (inspect condition)))
(do
(set! *last-error-kont* rest-k)
(host-error
(str "Unhandled exception: " (inspect condition))))
(continue-with-call
handler-fn
(list condition)
@@ -2654,8 +2658,10 @@
rest-k)
(kont-push (make-raise-guard-frame fenv rest-k) rest-k))))))
("raise-guard"
(host-error
"exception handler returned from non-continuable raise"))
(do
(set! *last-error-kont* rest-k)
(host-error
"exception handler returned from non-continuable raise")))
("multi-map"
(let
((f (get frame "f"))
@@ -2685,7 +2691,10 @@
(get frame "env")
(list k)
rest-k)))
(_ (error (str "Unknown frame type: " ft)))))))))
(_
(do
(set! *last-error-kont* rest-k)
(error (str "Unknown frame type: " ft))))))))))
(define
continue-with-call
@@ -2733,7 +2742,12 @@
(for-each
(fn (p) (env-bind! local p nil))
(slice params (len args))))
(make-cek-state (lambda-body f) local kont))
(let
((jit-result (jit-try-call f args)))
(if
(nil? jit-result)
(make-cek-state (lambda-body f) local kont)
(make-cek-value jit-result local kont))))
(or (component? f) (island? f))
(let
((parsed (parse-keyword-args raw-args env))