Recompile all 26 .sxbc with define-library wrappers + fix eval/JIT
All 26 browser modules recompiled with define-library/import forms. Compilation works without vm-compile-adapter (JIT pre-compilation hangs with library wrappers in some JIT paths — skipped for now, CEK compilation is ~34s total). Key fixes: - eval command: import-aware loop that handles define-library/import locally without touching the Python bridge pipe (avoids deadlock) - compile-modules.js: skip vm-compile-adapter, bump timeout 2621/2621 OCaml tests passing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1446,6 +1446,8 @@
|
||||
("perform" (step-sf-perform args env kont))
|
||||
("define-library" (step-sf-define-library args env kont))
|
||||
("import" (step-sf-import args env kont))
|
||||
("define-record-type"
|
||||
(make-cek-value (sf-define-record-type args env) env kont))
|
||||
(_
|
||||
(cond
|
||||
(has-key? *custom-special-forms* name)
|
||||
@@ -1573,6 +1575,64 @@
|
||||
env
|
||||
(kont-push (make-perform-frame env) kont)))))
|
||||
|
||||
;; R7RS records (SRFI-9)
|
||||
;;
|
||||
;; (define-record-type <point>
|
||||
;; (make-point x y)
|
||||
;; point?
|
||||
;; (x point-x)
|
||||
;; (y point-y set-point-y!))
|
||||
;;
|
||||
;; Creates: constructor, predicate, accessors, optional mutators.
|
||||
;; Opaque — only accessible through generated functions.
|
||||
;; Generative — each call creates a unique type.
|
||||
(define
|
||||
sf-define-record-type
|
||||
(fn
|
||||
(args env)
|
||||
(let
|
||||
((type-sym (first args))
|
||||
(ctor-spec (nth args 1))
|
||||
(pred-sym (nth args 2))
|
||||
(field-specs (slice args 3)))
|
||||
(let
|
||||
((raw-name (symbol-name type-sym)))
|
||||
(let
|
||||
((type-name
|
||||
(if
|
||||
(and (starts-with? raw-name "<") (ends-with? raw-name ">"))
|
||||
(slice raw-name 1 (- (len raw-name) 1))
|
||||
raw-name))
|
||||
(ctor-name (symbol-name (first ctor-spec)))
|
||||
(ctor-params (map (fn (s) (symbol-name s)) (rest ctor-spec)))
|
||||
(pred-name (symbol-name pred-sym))
|
||||
(field-names
|
||||
(map (fn (fs) (symbol-name (first fs))) field-specs)))
|
||||
(let
|
||||
((rtd-uid (make-rtd type-name field-names ctor-params)))
|
||||
;; Constructor — OCaml returns a NativeFn
|
||||
(env-bind! env ctor-name
|
||||
(make-record-constructor rtd-uid))
|
||||
;; Predicate — OCaml returns a NativeFn
|
||||
(env-bind! env pred-name
|
||||
(make-record-predicate rtd-uid))
|
||||
;; Accessors and optional mutators
|
||||
(for-each-indexed
|
||||
(fn
|
||||
(idx fs)
|
||||
(let
|
||||
((accessor-name (symbol-name (nth fs 1))))
|
||||
(env-bind! env accessor-name
|
||||
(make-record-accessor idx))
|
||||
(when
|
||||
(>= (len fs) 3)
|
||||
(let
|
||||
((mutator-name (symbol-name (nth fs 2))))
|
||||
(env-bind! env mutator-name
|
||||
(make-record-mutator idx))))))
|
||||
field-specs)
|
||||
nil))))))
|
||||
|
||||
;; Delimited continuations
|
||||
(define
|
||||
step-sf-callcc
|
||||
|
||||
Reference in New Issue
Block a user