Chez: runtime eval / load-string / defmacro on the zero-Janet spine
The compiler image is already resident at runtime on the Chez spine, so eval and load-string are just wiring: make them clojure.core functions instead of analyzer special forms. - eval / load-string are now functions, not special forms. Dropped "eval" from the host-contract special-symbol lists so it resolves as an ordinary var, and def-var! both in compile-eval.ss. eval takes an already-read form (e.g. from quote/list) and compiles+evals it in the current ns; load-string reads every form from a source string and evals each, returning the last. - Runtime defmacro: jolt-compile-eval-form intercepts a (defmacro ...) form before analysis, defs the expander fn + mark-macro!s the var, exactly as emit-image.ss does at build time. The two helpers (macro-form? / defmacro->fn) move to compile-eval.ss and emit-image.ss reuses them. - Top-level (do ...) is now unrolled form-by-form, like Clojure, so a defmacro or def in an earlier subform is visible (macro flag set / var interned) before a later subform is analyzed. This is what makes multi-form -e with a macro work. Seed is byte-identical (no source references eval), so no re-mint; bootstrap-test still passes. Zero-Janet corpus 2534 -> 2544 (eval/load-string cases now run), 0 new divergences; floor raised. Prelude corpus, JVM cert, full Janet gate green. jolt-r8ku
This commit is contained in:
parent
a8b61283b3
commit
a23095b502
5 changed files with 112 additions and 41 deletions
|
|
@ -36,7 +36,18 @@
|
|||
["(case 3 1 :a 2 :b :other)" ":other"]
|
||||
["(reduce + (vals (reduce (fn [m k] (assoc m k (* k k))) {} [1 2 3])))" "14"]
|
||||
["(map inc [1 2 3])" "(2 3 4)"]
|
||||
["nil" ""]])
|
||||
["nil" ""]
|
||||
# jolt-r8ku: runtime eval / load-string / defmacro on the Chez spine.
|
||||
["(eval (quote (+ 1 2)))" "3"]
|
||||
["(eval (list (quote +) 1 2 3))" "6"]
|
||||
["(eval (quote (let [a 2 b 3] (* a b))))" "6"]
|
||||
["(load-string \"(+ 1 2)\")" "3"]
|
||||
["(load-string \"(def y 5) (* y y)\")" "25"]
|
||||
["(load-string \"\")" ""]
|
||||
["(map eval [(quote (+ 1 1)) (quote (* 3 3))])" "(2 9)"]
|
||||
["(defmacro add1 [x] (list (quote +) x 1)) (add1 10)" "11"]
|
||||
["(defmacro twice [x] `(do ~x ~x)) (twice (+ 2 3))" "5"]
|
||||
["(defmacro m [x] `(+ ~x 1)) (m (m (m 0)))" "3"]])
|
||||
|
||||
(each [src want] cases
|
||||
(def [code out err] (joltc src))
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@
|
|||
|
||||
# Regression floor: raise as the Chez-hosted compiler closes gaps. The gate fails
|
||||
# on any NEW divergence or if pass drops below the floor. Strided runs scale to 0.
|
||||
(def base-floor (scan-number (or (os/getenv "JOLT_CHEZ_ZJ_FLOOR") "2534")))
|
||||
(def base-floor (scan-number (or (os/getenv "JOLT_CHEZ_ZJ_FLOOR") "2544")))
|
||||
(def floor (if (os/getenv "JOLT_CORPUS_LIMIT") 0 base-floor))
|
||||
(when (or (> (length diverged) 0) (< pass floor))
|
||||
(printf "REGRESSION: pass %d < floor %d or %d new divergence(s)" pass floor (length diverged)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue