Chez inc 3k: converter + string-op RT shims
str/subs/vec/keyword/symbol/compare/int/double/gensym — host-coupled seed natives the overlay assumes, now def-var!'d into clojure.core via host/chez/converters.ss (loaded last, str reuses jolt-pr-str). Semantics match the seed: str-render-one for str (nil->"", bare chars, regex source), the 3-way core-compare port, int truncates. The symbol no-ns sentinel is #f to match emit's quoted-symbol lowering (jolt-symbol #f "x"), so (= 'x (symbol "x")) holds — jolt= compares ns with strict equal?, and jolt-nil vs #f would otherwise diverge. Prelude parity 1220 -> 1326/2497, 0 new divergences. Floor raised to 1326; three newly-reached *ns*/var-rendering cases added to the allowlist (Phase 2). run-prelude and the per-case program file are now PID-unique so concurrent chez runs don't read each other's half-written files.
This commit is contained in:
parent
0c9c7931fe
commit
bb8b2d201c
5 changed files with 175 additions and 12 deletions
|
|
@ -312,8 +312,11 @@
|
|||
(emit/set-prelude-mode! false)
|
||||
(if (not (r 0)) [:emit-err (r 1) ""]
|
||||
(do
|
||||
(spit "/tmp/chez-regex-prelude.ss" (emit/program @[] (r 1)))
|
||||
(def proc (os/spawn ["chez" "--script" "/tmp/chez-regex-prelude.ss"] :p {:out :pipe :err :pipe}))
|
||||
# PID-unique path: two emit-test processes (or a foreground -e) must not
|
||||
# read each other's half-written program file.
|
||||
(def path (string "/tmp/chez-prelude-" (os/getpid) ".ss"))
|
||||
(spit path (emit/program @[] (r 1)))
|
||||
(def proc (os/spawn ["chez" "--script" path] :p {:out :pipe :err :pipe}))
|
||||
(def out (ev/read (proc :out) 0x100000))
|
||||
(def err (ev/read (proc :err) 0x100000))
|
||||
[(os/proc-wait proc) (string/trim (if out (string out) "")) (string/trim (if err (string err) ""))])))
|
||||
|
|
@ -398,6 +401,32 @@
|
|||
(ok (string "pred: " src) (and (= code 0) (= out want))
|
||||
(string "chez=" out " janet=" want " | " err))))
|
||||
|
||||
# 3p) converters + string ops (jolt-t6cr): str/subs/vec/keyword/symbol/compare/
|
||||
# int/double/gensym are host-coupled seed natives (host/chez/converters.ss),
|
||||
# def-var!'d into clojure.core, resolved in prelude mode. Semantics match the
|
||||
# seed (str-render-one for str, the 3-way core-compare, truncating int). Parity
|
||||
# vs the CLI oracle.
|
||||
(each src ["(str)" "(str \"a\")" "(str \"a\" \"b\" \"c\")" "(str 1 2)"
|
||||
"(str :k)" "(str nil)" "(str \"x\" nil \"y\")" "(str \\a)"
|
||||
"(str 'sym)" "(str [1 2])" "(str (* 1.0 5))"
|
||||
"(subs \"hello\" 1)" "(subs \"hello\" 1 3)"
|
||||
"(vec (list 1 2 3))" "(vec (range 3))" "(vec \"ab\")" "(count (vec (range 4)))"
|
||||
"(keyword \"foo\")" "(keyword \"ns\" \"bar\")" "(keyword 'sym)"
|
||||
"(name (keyword \"a\" \"b\"))" "(namespace (keyword \"a\" \"b\"))"
|
||||
"(symbol \"x\")" "(str (symbol \"ns\" \"y\"))" "(name (symbol \"z\"))"
|
||||
"(compare 1 2)" "(compare 2 1)" "(compare 1 1)" "(compare \"a\" \"b\")"
|
||||
"(compare :a :b)" "(compare [1 2] [1 3])" "(compare nil nil)" "(compare nil 1)"
|
||||
"(int 3.7)" "(int \\A)" "(double 5)" "(double \\A)"]
|
||||
(let [[code out err] (run-prelude src) want (cli-oracle src)]
|
||||
(ok (string "conv: " src) (and (= code 0) (= out want))
|
||||
(string "chez=" out " janet=" want " | " err))))
|
||||
# gensym uses a per-process counter, so only the PREFIX is stable across the
|
||||
# Chez run vs the Janet oracle; the numeric suffix legitimately differs.
|
||||
(each src ["(symbol? (gensym))" "(subs (name (gensym \"foo_\")) 0 4)" "(string? (name (gensym)))"]
|
||||
(let [[code out err] (run-prelude src) want (cli-oracle src)]
|
||||
(ok (string "conv: " src) (and (= code 0) (= out want))
|
||||
(string "chez=" out " janet=" want " | " err))))
|
||||
|
||||
# 4) perf signal: emitted fib(30) in-Scheme timing (excludes Chez startup), to
|
||||
# track against the spike ceiling (hand-Scheme fib ~5ms). Informational — the
|
||||
# jolt-truthy? wrapper (~3x) and flonum modeling are known Phase-4 levers.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue