jit: HO-loop desugar + hyperscript hs-* interpret-only (--jit == CEK parity)

Ported from loops/sx-vm-extensions 2d24c0cf + dcc5d9fa (file hunks only), on top of
be071d56 (compile-let/letrec residue fixes).

1. compiler.sx: desugar map/filter/reduce/for-each/some/every? (literal-fn arg0) to
   resumable named-let bytecode loops instead of CALL_PRIM into a native OCaml loop.
   The general fix for the serving-JIT "perform-in-HO-callback drops all-but-first"
   miscompile — the bytecode loop suspends/resumes within the VM and survives, so the
   call_closure_reuse inline-resolve band-aid (and boot-loader jit-exclude! recipes)
   are no longer needed. Data-first/symbol-fn forms fall back to CALL_PRIM unchanged.
   Proven zero-regression: full run_tests --jit failure SETS byte-identical with/without.

2. lib/hyperscript/runtime.sx: (jit-exclude! "hs-*") — hyperscript was the only guest
   missing its jit-exclude! decl; its recursive-descent tokenizer/parser combinators hit
   the parser-combinator JIT bug. Runs on CEK (correct); hyperscript compiles to SX at
   author time so no serve-time cost.

Together these take run_tests --jit to 4862/1082 = EXACT parity with the CEK baseline
(zero deterministic JIT-specific failures, verified by failure-set diff).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-30 21:09:31 +00:00
parent be071d5631
commit 921db09f5e
2 changed files with 64 additions and 0 deletions

View File

@@ -3351,3 +3351,13 @@
(bind-path! (host-global "window") name-path)
wrapper)))))
;; Hyperscript's tokenizer/parser are recursive-descent combinators (hs-tokenize,
;; hs-stream-*, hs-parse-*). Like every other guest interpreter (scheme-*, er-*,
;; pl-*, cl-*, js-*, hk-*), their recursion web miscompiles under the bytecode JIT
;; (the parser-combinator JIT bug — see project_jit_bytecode_bug). Declare the whole
;; hs- namespace interpret-only: it runs on the CEK, where it is correct. Hyperscript
;; is compiled to SX once at author/load time (not per request), so there is no
;; serve-time perf cost. With this, run_tests --jit == CEK (4862/1082, zero
;; JIT-specific failures).
(jit-exclude! "hs-*")