Chez parity: missing native core fns + ns runtime fns (jolt-cf1q.7)

Native Chez shims for clojure.core fns that live in the Janet seed but had none
on the zero-Janet spine (they resolved to nil -> "not a fn"):

- host/chez/natives-parity.ss: hash / hash-combine / hash-ordered-coll /
  hash-unordered-coll (24-bit masked like core_extra), transient?, rseq (vectors +
  sorted colls), cat (transducer).
- jolt-invoke now dispatches a TRANSIENT vec/map/set as a fn (callable on the JVM):
  ((transient [10 20 30]) 1) -> 20.
- ns.ss: ns-resolve, ns-imports, remove-ns, intern, alias, ns-unalias, refer,
  ns-refers, refer-clojure, alter-meta!, reset-meta!, and a real ns-aliases (was a
  stub returning {}).
- runtime (require ...)/(use ...) now register :as/:refer into the Chez ns tables
  (was a no-op). The Chez analyzer already pre-registers at analyze time, but when
  the JANET analyzer compiled the form (prelude path) the Chez tables stayed empty,
  so ns-aliases/ns-resolve over an alias diverged — this fixes both paths.

Seed unchanged (overlay doesn't reference these at mint time). zero-Janet corpus
2567->2600, prelude 2557->2590, 0 new divergences on either; Janet gate + JVM cert
green. Filed jolt-vgrp for the pre-existing var-get-of-scalar-native-op quirk.

jolt-cf1q.7
This commit is contained in:
Yogthos 2026-06-20 15:46:11 -04:00
parent d7cfafd3a9
commit 1ba19759c8
7 changed files with 168 additions and 9 deletions

View file

@ -277,8 +277,14 @@
(def-var! "clojure.core" "str-replace" str-replace)
(def-var! "clojure.core" "str-replace-all" str-replace-all)
;; (require ...) / (use ...) at runtime: the Chez AOT driver pre-evals these
;; against the analyzer ctx to register aliases + load aliased nss (driver.janet),
;; so the emitted call only needs to not crash. A no-op returning nil.
(def-var! "clojure.core" "require" (lambda args jolt-nil))
(def-var! "clojure.core" "use" (lambda args jolt-nil))
;; (require ...) / (use ...) at runtime: register each spec's :as alias + :refer
;; names into the runtime ns tables (chez-register-spec!, ns.ss), keyed by the
;; current ns. The zero-Janet spine also pre-registers these at analyze time
;; (idempotent); but when the JANET analyzer compiled the form (the prelude path)
;; the Chez tables were never populated, so ns-aliases/ns-resolve over an :as alias
;; need this runtime registration (jolt-cf1q.7). Specs arrive evaluated (quoted).
(define (chez-runtime-require . specs)
(for-each (lambda (s) (chez-register-spec! (chez-current-ns) s)) specs)
jolt-nil)
(def-var! "clojure.core" "require" chez-runtime-require)
(def-var! "clojure.core" "use" chez-runtime-require)