Migrate clojure.core/set from a native shim to the kernel overlay tier
set was a native shim (apply jolt-hash-set (seq->list coll)). It is a pure composition, so the Clojure version (apply hash-set (seq coll)) lowers to the same code. The compiler uses set, but only off the emit path (the backend's bare-native-names def and type inference), so it can live in the kernel tier: compiling that tier never calls set, and by the time those callers run the tier is already bound. This is distinct from boolean, which the backend calls for every :if node on the emit path. Moving boolean even to the kernel tier deadlocks (compiling the tier that defines boolean needs boolean), so boolean stays native. Added a comment in predicates.ss recording that. Re-mint converges in 3 passes and the benchmark suite is unchanged within noise (collections 43.3 vs 43.1, binary-trees 367 vs 367, the rest flat).
This commit is contained in:
parent
3d0cbed3c5
commit
d77b4e6420
5 changed files with 310 additions and 298 deletions
|
|
@ -116,6 +116,8 @@
|
|||
(def-var! "clojure.core" "mapv" (letrec ((mapv (lambda (f . colls) (let fnrec5542 ((f f) (colls (list->cseq colls))) (jolt-invoke (var-deref "clojure.core" "vec") (jolt-apply jolt-map f colls)))))) mapv)))
|
||||
(guard (e (#t #f))
|
||||
(def-var! "clojure.core" "update" (letrec ((update (lambda (m k f . args) (let fnrec5543 ((m m) (k k) (f f) (args (list->cseq args))) (jolt-assoc m k (jolt-apply f (jolt-get m k) args)))))) update)))
|
||||
(guard (e (#t #f))
|
||||
(def-var! "clojure.core" "set" (letrec ((set (lambda (coll) (let fnrec5544 ((coll coll)) (if (jolt-nil? coll) (jolt-hash-set) (jolt-apply jolt-hash-set (jolt-seq coll))))))) set)))
|
||||
(guard (e (#t #f))
|
||||
(def-var! "clojure.core" "vreset!" (letrec ((vreset! (lambda (vol newval) (let fnrec4683 ((vol vol) (newval newval)) (begin (jolt-invoke (var-deref "jolt.host" "ref-put!") vol (keyword #f "val") newval) newval))))) vreset!)))
|
||||
(guard (e (#t #f))
|
||||
|
|
@ -485,9 +487,9 @@
|
|||
(guard (e (#t #f))
|
||||
(def-var! "clojure.core" "trampoline" (letrec ((trampoline (case-lambda ((f) (let fnrec4585 ((f f)) (let* ((ret (jolt-invoke f))) (if (jolt-truthy? (jolt-invoke (var-deref "clojure.core" "fn?") ret)) (trampoline ret) ret)))) ((f . args) (let fnrec4586 ((f f) (args (list->cseq args))) (trampoline (lambda () (let fnrec4587 () (jolt-apply f args))))))))) trampoline)))
|
||||
(guard (e (#t #f))
|
||||
(def-var! "clojure.core" "max" (letrec ((_max (case-lambda ((x) (let fnrec4588 ((x x)) x)) ((x y) (let fnrec4589 ((x x) (y y)) (if (> x y) x y))) ((x y . more) (let fnrec4590 ((x x) (y y) (more (list->cseq more))) (jolt-reduce _max (_max x y) more)))))) _max)))
|
||||
(def-var! "clojure.core" "max" (letrec ((max (case-lambda ((x) (let fnrec4588 ((x x)) x)) ((x y) (let fnrec4589 ((x x) (y y)) (if (> x y) x y))) ((x y . more) (let fnrec4590 ((x x) (y y) (more (list->cseq more))) (jolt-reduce max (max x y) more)))))) max)))
|
||||
(guard (e (#t #f))
|
||||
(def-var! "clojure.core" "min" (letrec ((_min (case-lambda ((x) (let fnrec4591 ((x x)) x)) ((x y) (let fnrec4592 ((x x) (y y)) (if (< x y) x y))) ((x y . more) (let fnrec4593 ((x x) (y y) (more (list->cseq more))) (jolt-reduce _min (_min x y) more)))))) _min)))
|
||||
(def-var! "clojure.core" "min" (letrec ((min (case-lambda ((x) (let fnrec4591 ((x x)) x)) ((x y) (let fnrec4592 ((x x) (y y)) (if (< x y) x y))) ((x y . more) (let fnrec4593 ((x x) (y y) (more (list->cseq more))) (jolt-reduce min (min x y) more)))))) min)))
|
||||
(guard (e (#t #f))
|
||||
(def-var! "clojure.core" "reverse" (letrec ((reverse (lambda (coll) (let fnrec4594 ((coll coll)) (jolt-reduce jolt-conj (jolt-list ) coll))))) reverse)))
|
||||
(guard (e (#t #f))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue