Chez Phase 1 (increment 3h): host-interop method-call emit
(.method target arg*) now analyzes to a :host-call IR node instead of punting at analyze. The Chez back end lowers it to a jolt-host-call dispatch for the methods the RT shims (.write -> port display, .isDirectory -> file-directory?, .listFiles -> directory-list); any other method stays out of subset (clean emit-time reject, so it can't read as a compiled-but-broken corpus divergence). The Janet back end punts ALL :host-call to the interpreter, same shape as letfn: compiles on Chez, interprets on Janet, zero change to the main language. Closes the io tier's print-method defmethods and file-seq: prelude emit reach 348 -> 354/355 (50-io 20/20). The one remaining gap is the regex literal in parse-uuid (needs a regex engine on Chez; deferred). emit-test 122/122; Chez subset 672/672, 0 divergences; full gate green.
This commit is contained in:
parent
0f7d2753a8
commit
b1cdfd1c9b
9 changed files with 96 additions and 13 deletions
|
|
@ -72,16 +72,19 @@ catalogs the gaps; macros are skipped (analyze-time only, not a runtime value):
|
|||
|
||||
JOLT_CHEZ_PRELUDE=1 janet test/chez/core-prelude-probe.janet
|
||||
|
||||
Baseline after inc 3f (quoted literals): **342/355 non-macro core forms emit** to
|
||||
Scheme (was 334 at inc 3e, 303 at inc 3d). A `:quote` node reconstructs the raw
|
||||
reader form as RT constructor calls — symbol → `jolt-symbol`, list → `jolt-list`,
|
||||
vector → `jolt-vector`, map/set → `jolt-hash-map`/`jolt-hash-set`, scalars via
|
||||
`emit-const`. Prior: `:throw` → `jolt-throw` (Scheme `raise` of the raw jolt
|
||||
value); `:try` → `guard` (catch, class dropped → catch-all) + `dynamic-wind`
|
||||
(finally); `ex-info` native-op building the tagged jolt map, so the tier
|
||||
ex-data/ex-message/ex-cause read it over `get` for free. Remaining 13 gaps: Java
|
||||
host interop `.write`/`.isDirectory` (6, io tier), `letfn` (4), `declare`/
|
||||
def-no-init (2), one edge (`parse-uuid`). The probe has a regression floor.
|
||||
Baseline after inc 3h (host-interop method calls): **354/355 non-macro core forms
|
||||
emit** to Scheme (was 348 at inc 3g, 342 at inc 3f). A `.method` call now analyzes
|
||||
to a `:host-call` IR node; the Chez emitter lowers it to a `jolt-host-call`
|
||||
dispatch for the methods the RT shims — `.write` → port `display`, `.isDirectory`
|
||||
→ `file-directory?`, `.listFiles` → `directory-list` — closing the io tier's
|
||||
print-method defmethods and `file-seq` (now 20/20). Any other method is out of
|
||||
subset (a clean emit-time reject, so it can't masquerade as a compiled-but-broken
|
||||
divergence); the Janet back end punts ALL `:host-call` to the interpreter. Prior
|
||||
incs: `:quote` reconstructs the raw reader form as RT constructors; `:throw` →
|
||||
`jolt-throw`, `:try` → `guard` + `dynamic-wind`, `ex-info` native-op; `letfn` →
|
||||
`letrec*`; `declare`/def-no-init → a reserved var cell. Remaining 1 gap: the regex
|
||||
literal in `parse-uuid` (needs a regex engine on Chez — see jolt issue). The probe
|
||||
has a regression floor (354).
|
||||
|
||||
Prior, inc 3b (seq tier + dynamic IFn, jolt-5pso): 595/595 compiled, 0 divergences,
|
||||
2060/2655 out of subset. The seq tier brought up a list/lazy-seq type with
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@
|
|||
|
||||
# Regression floor (raise it as new IR ops / RT shims land, like the suite
|
||||
# baseline). Fails if prelude emit reach drops below the recorded baseline.
|
||||
(def reach-floor 348)
|
||||
(def reach-floor 354)
|
||||
(when (< compiled reach-floor)
|
||||
(printf "REGRESSION: prelude emit reach %d < floor %d" compiled reach-floor)
|
||||
(os/exit 1))
|
||||
|
|
|
|||
|
|
@ -281,6 +281,25 @@
|
|||
(ok (string "letfn/declare: " src) (and (= code 0) (= out want))
|
||||
(string "chez=" out " janet=" want " | " err))))
|
||||
|
||||
# 3l) host interop method calls (inc 3h). (.method target arg*) analyzes to a
|
||||
# :host-call IR node and lowers to a jolt-host-call dispatch. The Janet back end
|
||||
# PUNTS these (no interop model -> interpreter); the Chez RT shims the methods
|
||||
# jolt-core's io tier uses: .write -> display to a port, .isDirectory ->
|
||||
# file-directory?, .listFiles -> directory-list. Interop has no portable oracle
|
||||
# (the Janet host models it differently), so these are emit-shape checks plus one
|
||||
# deterministic runtime probe (the root "/" is always a directory).
|
||||
(each [label src needle]
|
||||
[["emit .write -> jolt-host-call" "(fn [w x] (.write w x))" "jolt-host-call"]
|
||||
["emit .write keeps method name" "(fn [w x] (.write w x))" "\"write\""]
|
||||
["emit .isDirectory -> jolt-host-call" "(fn [f] (.isDirectory f))" "isDirectory"]
|
||||
["emit .listFiles -> jolt-host-call" "(fn [f] (.listFiles f))" "listFiles"]]
|
||||
(let [scm (protect (emit/emit (backend/analyze-form ctx (in (r/parse-next src) 0))))]
|
||||
(ok label (and (scm 0) (string/find needle (scm 1))) (string/format "%p" scm))))
|
||||
|
||||
(let [[code out err] (d/run-on-chez ctx "(.isDirectory \"/\")")]
|
||||
(ok "runtime .isDirectory \"/\" = true" (and (= code 0) (= out "true"))
|
||||
(string "chez=" out " | " err)))
|
||||
|
||||
# 3h) prelude mode (inc 3d): emitting clojure.core ITSELF, a core->core ref must
|
||||
# lower to a runtime var-deref instead of being rejected as "out of subset".
|
||||
# `frequencies` is a core fn but not a native-op, so it exercises the switch.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue