From b6e41bf4992f213e85194059b6410bd5b21534c9 Mon Sep 17 00:00:00 2001 From: Yogthos Date: Sat, 6 Jun 2026 06:41:36 -0400 Subject: [PATCH] self-host: JOLT_SELFHOST suite mode; keep analyzer interpreted for now MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/jolt/backend.janet | 5 ++++- test/integration/suite-worker.janet | 11 ++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/jolt/backend.janet b/src/jolt/backend.janet index a385ad1..c17d4f3 100644 --- a/src/jolt/backend.janet +++ b/src/jolt/backend.janet @@ -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])")))) diff --git a/test/integration/suite-worker.janet b/test/integration/suite-worker.janet index c7ba60b..8a515e5 100644 --- a/test/integration/suite-worker.janet +++ b/test/integration/suite-worker.janet @@ -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