Delete the Janet host — Chez is the sole substrate

Remove the Janet seed (src/jolt/*.janet: reader, value layer, vars/ns, the
tree-walking interpreter, the Janet backend, the optimizing compiler), the
Janet->Scheme cross-compiler (host/chez/{driver,emit,jolt-chez}.janet),
bin/jolt-chez, the jpm build (project.janet) and the Janet test runner
(run-tests.janet), plus the entire Janet test suite. jolt now builds and runs
on Chez alone: bin/joltc off the checked-in seed, bootstrap.ss to rebuild it.

The portable Clojure stays: jolt-core/**, host/chez/**.ss, and the stdlib +
tooling under src/jolt/clojure + src/jolt/jolt (read by the seed build, no
Janet). The gate is 'make test' (self-host, corpus, unit, cli smoke, certify).
Drop the sci and clojure-test-suite submodules (used only by deleted Janet
integration tests); irregex stays.

Filesystem corpus/unit cases that probed project.janet now probe README.md.

jolt-cf1q.6
This commit is contained in:
Yogthos 2026-06-21 11:29:03 -04:00
parent 5c1fdfc336
commit 58d03d67be
221 changed files with 16 additions and 29925 deletions

View file

@ -1,28 +0,0 @@
# Dump the Janet that jolt's backend emits for the mandelbrot hot fns, so we can
# A/B it against bench/mandelbrot-hand.janet and localize the ~1.43x jolt-over-
# hand-Janet gap measured in the foundational-runtime spike (jolt-5vsp).
(import ../src/jolt/api :as api)
(import ../src/jolt/backend :as backend)
(import ../src/jolt/reader :as reader)
(def ctx (api/init-cached {:compile? true}))
(put (ctx :env) :direct-linking? true)
(put (ctx :env) :inline? true)
(api/eval-string ctx "(ns mandelbrot)")
(def count-point-src
"(defn count-point [cr ci cap] (loop [i 0 zr 0.0 zi 0.0] (if (or (>= i cap) (> (+ (* zr zr) (* zi zi)) 4.0)) i (recur (inc i) (+ (- (* zr zr) (* zi zi)) cr) (+ (* 2.0 (* zr zi)) ci)))))")
(def run-src
"(defn run [n] (let [cap 200 nd (* 1.0 n)] (loop [y 0 acc 0] (if (< y n) (let [ci (- (/ (* 2.0 y) nd) 1.0) row (loop [x 0 a 0] (if (< x n) (let [cr (- (/ (* 2.0 x) nd) 1.5)] (recur (inc x) (+ a (count-point cr ci cap)))) a))] (recur (inc y) (+ acc row))) acc))))")
(api/eval-string ctx count-point-src)
(api/eval-string ctx run-src)
(defn emit [src]
(string/format "%p" (backend/emit-ir ctx (backend/analyze-form ctx (reader/parse-string src)))))
(print "===== count-point emitted Janet =====")
(print (emit count-point-src))
(print "\n===== run emitted Janet =====")
(print (emit run-src))

View file

@ -1,49 +0,0 @@
# mandelbrot — hand-written Janet that MIRRORS jolt's loop-lowering: every loop/
# recur becomes a self-recursive local closure stored in a var and called once
# per iteration (see bench/dump-mandelbrot-emit.janet). If this lands at jolt's
# ~219ms (vs the while-loop mandelbrot-hand.janet's ~153ms), the ~1.43x jolt-
# over-hand-Janet gap is the recursive-closure loop lowering, not anything else.
# janet bench/mandelbrot-hand-rec.janet 200
(defn count-point [cr ci cap]
(var loopfn nil)
(set loopfn (fn [i zr zi]
(if (let [t (>= i cap)] (if t t (> (+ (* zr zr) (* zi zi)) 4)))
i
(loopfn (+ i 1)
(+ (- (* zr zr) (* zi zi)) cr)
(+ (* 2 (* zr zi)) ci)))))
(loopfn 0 0 0))
(defn run [n]
(def cap 200)
(def nd (* 1 n))
(var yloop nil)
(set yloop (fn [y acc]
(if (< y n)
(let [ci (- (/ (* 2 y) nd) 1)
row (do
(var xloop nil)
(set xloop (fn [x a]
(if (< x n)
(let [cr (- (/ (* 2 x) nd) 1.5)]
(xloop (+ x 1) (+ a (count-point cr ci cap))))
a)))
(xloop 0 0))]
(yloop (+ y 1) (+ acc row)))
acc)))
(yloop 0 0))
(defn main [& args]
(def n (if (> (length args) 1) (scan-number (get args 1)) 1000))
(repeat 2 (run (div n 2)))
(def times @[])
(var last-r 0)
(repeat 3
(def t0 (os/clock))
(def r (run n))
(array/push times (* 1000.0 (- (os/clock) t0)))
(set last-r r))
(printf "mandelbrot n %d result %d" n last-r)
(print "runs: " (string/join (map |(string (/ (math/round (* $ 10.0)) 10.0)) times) " "))
(printf "mean: %.1f ms" (/ (sum times) 3)))

View file

@ -1,53 +0,0 @@
# mandelbrot — hand-written idiomatic Janet, same nested loop as bench/mandelbrot.clj.
# This is the "optimal Janet" leg of the foundational-runtime spike (jolt-5vsp):
# comparing jolt-emitted Janet vs this vs JVM localizes the 15x compute floor —
# jolt-backend overhead vs the Janet VM's own floor.
#
# janet bench/mandelbrot-hand.janet 200
(defn count-point [cr ci cap]
(var i 0)
(var zr 0.0)
(var zi 0.0)
(while (and (< i cap) (<= (+ (* zr zr) (* zi zi)) 4.0))
(def nzr (+ (- (* zr zr) (* zi zi)) cr))
(def nzi (+ (* 2.0 (* zr zi)) ci))
(set zr nzr)
(set zi nzi)
(++ i))
i)
(defn run [n]
(def cap 200)
(def nd (* 1.0 n))
(var acc 0)
(var y 0)
(while (< y n)
(def ci (- (/ (* 2.0 y) nd) 1.0))
(var x 0)
(var a 0)
(while (< x n)
(def cr (- (/ (* 2.0 x) nd) 1.5))
(set a (+ a (count-point cr ci cap)))
(++ x))
(set acc (+ acc a))
(++ y))
acc)
(defn main [& args]
(def n (if (> (length args) 1) (scan-number (get args 1)) 1000))
# warmup
(repeat 2 (run (div n 2)))
(def runs 3)
(def times @[])
(var last-r 0)
(repeat runs
(def t0 (os/clock))
(def r (run n))
(def ms (* 1000.0 (- (os/clock) t0)))
(set last-r r)
(array/push times ms))
(def mean (/ (sum times) runs))
(printf "mandelbrot n %d result %d" n last-r)
(print "runs: " (string/join (map |(string (/ (math/round (* $ 10.0)) 10.0)) times) " "))
(printf "mean: %.1f ms" mean))