Chez parity: deftype (P. args) constructor via host-new var fallback (jolt-cf1q.7)
deftype binds the type name as a VAR (the make-deftype-ctor closure), but (P. 5) lowers to (host-new "P"), which only checked class-ctors-tbl -> "No constructor". Fall back to resolving the class name as a var in the current ns / clojure.core and invoking it — so (P. args) constructs the same jrec as the ->P factory, and protocol method dispatch (.m / .-field) over it works. zero-Janet 2685->2688 (no-constructor 5->2); prelude floor bumped to 2641 (the delay batch's run). Self-host + Janet gates + JVM cert green. jolt-cf1q.7
This commit is contained in:
parent
1d6e740668
commit
60b4bae105
3 changed files with 17 additions and 6 deletions
|
|
@ -94,8 +94,18 @@
|
|||
|
||||
(define (host-new class . args)
|
||||
(let ((ctor (lookup-class class-ctors-tbl class)))
|
||||
(if ctor (apply ctor args)
|
||||
(error #f (string-append "No constructor for class " class)))))
|
||||
(cond
|
||||
(ctor (apply ctor args))
|
||||
;; deftype/defrecord (jolt-499t): the type name is bound as a VAR (the
|
||||
;; make-deftype-ctor closure) in its defining ns, not a registered host class.
|
||||
;; Resolve it in the current ns / clojure.core and invoke it — so (P. args)
|
||||
;; works the same as the ->P factory.
|
||||
(else
|
||||
(let ((cell (or (var-cell-lookup (chez-current-ns) class)
|
||||
(var-cell-lookup "clojure.core" class))))
|
||||
(if (and cell (var-cell-defined? cell) (procedure? (var-cell-root cell)))
|
||||
(apply (var-cell-root cell) args)
|
||||
(error #f (string-append "No constructor for class " class))))))))
|
||||
|
||||
;; ---- coercion helpers -------------------------------------------------------
|
||||
(define (->num x) (exact->inexact x))
|
||||
|
|
|
|||
|
|
@ -321,9 +321,9 @@
|
|||
# match the JVM's async raciness and are allowlisted) -> 2557.
|
||||
# jolt-cf1q.7 parity batches (hash/rseq/cat/transient-as-fn + ns runtime fns +
|
||||
# runtime-require alias registration) -> 2590; arrays + reader-features/
|
||||
# macroexpand/reader-conditional/re-matcher -> 2629.
|
||||
# macroexpand/reader-conditional/re-matcher -> 2629; delay/force/realized? -> 2641.
|
||||
# Strided runs scale down.
|
||||
(def base-floor (scan-number (or (os/getenv "JOLT_CHEZ_PRELUDE_FLOOR") "2629")))
|
||||
(def base-floor (scan-number (or (os/getenv "JOLT_CHEZ_PRELUDE_FLOOR") "2641")))
|
||||
(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)))
|
||||
|
|
|
|||
|
|
@ -215,8 +215,9 @@
|
|||
# are allowlisted) -> 2567. jolt-cf1q.7 parity batches (hash/rseq/cat/transient-as-fn
|
||||
# + ns runtime fns) -> 2600; arrays -> 2631; reader-features/reader-conditional/
|
||||
# re-matcher/macroexpand -> 2642; runtime-defmacro cases via top-level eval of
|
||||
# ACTUAL (matching certify.clj's eval-isolated) -> 2673; delay/force/realized? -> 2685.
|
||||
(def base-floor (scan-number (or (os/getenv "JOLT_CHEZ_ZJ_FLOOR") "2685")))
|
||||
# ACTUAL (matching certify.clj's eval-isolated) -> 2673; delay/force/realized? ->
|
||||
# 2685; deftype (P. args) constructor via host-new var fallback -> 2688.
|
||||
(def base-floor (scan-number (or (os/getenv "JOLT_CHEZ_ZJ_FLOOR") "2688")))
|
||||
(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