self-host: JOLT_SELFHOST suite mode; keep analyzer interpreted for now

suite-worker honors JOLT_SELFHOST=1 to route the clojure-test-suite through the
self-hosted pipeline (for validating once the analyzer compiles).

The analyzer stays interpreted: compiling it via the bootstrap miscompiles
(qualified refs regressed compile mode 3932->1181; compile-loading yields
corrupted IR) — tracked in jolt-4xc. Correctness is unaffected (the self-hosted
pipeline passes 218/218 conformance); only speed is pending.
This commit is contained in:
Yogthos 2026-06-06 06:41:36 -04:00
parent f9df794475
commit b6e41bf499
2 changed files with 14 additions and 2 deletions

View file

@ -157,7 +157,10 @@
(defn- ensure-analyzer [ctx]
# Load jolt.analyzer (and transitively jolt.ir) once; jolt.host is pre-installed
# by host/install! so its require is a no-op.
# by host/install! so its require is a no-op. The analyzer currently runs
# INTERPRETED — compiling it via the bootstrap is blocked by bootstrap
# miscompilation bugs on the constructs it uses (tracked); correctness is fine,
# speed is the open item.
(when (= 0 (length ((ctx-find-ns ctx "jolt.analyzer") :mappings)))
(eval-form ctx @{} (r/parse-string "(require '[jolt.analyzer])"))))

View file

@ -5,6 +5,7 @@
(use ../../src/jolt/api)
(use ../../src/jolt/reader)
(use ../../src/jolt/evaluator)
(import ../../src/jolt/backend :as selfhost)
(defn- parse-forms [src]
(var s src) (def fs @[]) (var go true)
@ -23,8 +24,16 @@
# compile, unsupported forms fall back to the interpreter) so the whole battery
# validates compile-mode correctness against the same baseline.
(def compile? (= "1" (os/getenv "JOLT_COMPILE")))
# JOLT_SELFHOST=1 routes each form through the self-hosted pipeline (the
# portable Clojure analyzer + Janet back end, hybrid with interpreter fallback)
# so the whole battery validates the self-hosted compiler against the baseline.
(def selfhost? (= "1" (os/getenv "JOLT_SELFHOST")))
(def ctx (init (if compile? {:compile? true} {})))
(defn run-form [f] (if compile? (eval-one ctx f) (eval-form ctx @{} f)))
(defn run-form [f]
(cond
selfhost? (selfhost/compile-and-eval ctx f)
compile? (eval-one ctx f)
(eval-form ctx @{} f)))
(each f (parse-forms (slurp "test/support/clojure_test.clj")) (run-form f))
# Pre-load the suite's own clojure.core-test.number-range helper ns if present