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:
Yogthos 2026-06-17 18:58:44 -04:00
parent 0f7d2753a8
commit b1cdfd1c9b
9 changed files with 96 additions and 13 deletions

View file

@ -92,7 +92,11 @@
# gains a letrec lowering.
# eval — compile-and-run entry (also loader stateful-head?)
# . / new / Foo. / — thin host-interop heads the back end doesn't model
# .method
# .method — analyzes to a :host-call IR node now (inc 3h), but the
# Janet back end punts it at emit (no interop model). The
# Chez back end DOES lower it (jolt-host-call). Same shape as
# letfn: compiles on Chez, interprets on Janet.
# .-field — field access stays punted at analyze (form-special?)
# gen-class, monitor-enter, monitor-exit — JVM-compat stubs
# Growing this list is a REGRESSION: a new punt means the compiler lost
# coverage. Shrinking it (e.g. letfn via letrec IR) is progress — move the
@ -102,7 +106,9 @@
"(set! *warn-on-reflection* true)"
"(letfn [(f [n] (g n)) (g [n] (f n))] (f 1))"
"(eval (quote (+ 1 2)))"
"(.method obj)"
# .method analyzes to :host-call now; a resolvable target ("x") makes it punt
# at EMIT (the interop reason), not at analyze (an unresolved target).
"(.toUpperCase \"x\")"
"(.-field obj)"
"(new Foo 1)"
"(Foo. 1)"