self-host: make it the only compile path; drop the bootstrap as a selectable path

eval-toplevel now routes every compiled form through backend/compile-and-eval
(analyzer -> IR -> Janet back end). The bootstrap compiler (compile-ast) stays
only to bootstrap jolt.ir/jolt.analyzer in backend/compile-load. Dropped the
:selfhost? flag and JOLT_SELFHOST env plumbing — self-host is the default.

Three correctness fixes the full-suite-under-self-host sweep exposed:
- analyzer/back end: recur into a variadic arity now compiles. The arity fn
  gets an ordinary positional rest param (the collected seq), with a dispatch
  wrapper, so (recur fixed... rest-seq) is a clean self-call like Clojure --
  instead of punting to the interpreter, which hangs on this (jolt-4df).
- host_iface: interop heads (.foo/.-field/Foo.) and ns-management forms
  (all-ns, create-ns, resolve, ...) now mark uncompilable so they fall back
  instead of compiling to a bad call.
- back end: named-fn self-reference ((fn self [n] ... (self ...))) binds the
  fn name via a var.

Full unit+integration suite green; clojure-test-suite battery holds 3913.
This commit is contained in:
Yogthos 2026-06-06 11:34:02 -04:00
parent 34b880f0d6
commit 497970029d
7 changed files with 93 additions and 27 deletions

View file

@ -77,7 +77,10 @@
(let [pp (parse-params (vec (form-vec-items pvec)))
fixed (:fixed pp)
rst (:rest pp)
rname (when-not rst (gen-name "arity"))
;; Always a recur target, variadic included: the back end gives the rest
;; param an ordinary positional slot (holding the collected seq), so recur
;; is a self-call carrying the rest seq directly — Clojure semantics.
rname (gen-name "arity")
names (cond-> (vec fixed) rst (conj rst) fn-name (conj fn-name))
env* (-> (add-locals env names) (with-recur rname))]
{:params fixed :rest rst :recur-name rname