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:
@@ -50,6 +50,13 @@ let rec deep_equal a b =
|
||||
deep_equal
|
||||
(match Hashtbl.find_opt a k with Some v -> v | None -> Nil)
|
||||
(match Hashtbl.find_opt b k with Some v -> v | None -> Nil)) ka
|
||||
| Record a, Record b ->
|
||||
a.r_type.rt_uid = b.r_type.rt_uid &&
|
||||
Array.length a.r_fields = Array.length b.r_fields &&
|
||||
(let eq = ref true in
|
||||
for i = 0 to Array.length a.r_fields - 1 do
|
||||
if not (deep_equal a.r_fields.(i) b.r_fields.(i)) then eq := false
|
||||
done; !eq)
|
||||
| Lambda _, Lambda _ -> a == b (* identity *)
|
||||
| NativeFn _, NativeFn _ -> a == b
|
||||
| _ -> false
|
||||
|
||||
@@ -1030,9 +1030,29 @@ let rec dispatch env cmd =
|
||||
(try
|
||||
let exprs = Sx_parser.parse_all src in
|
||||
let result = List.fold_left (fun _acc expr ->
|
||||
(* Use IO-aware eval to handle import suspensions *)
|
||||
(* Use import-aware eval — handles define-library/import locally
|
||||
but does NOT send other IO to the Python bridge (would deadlock
|
||||
on stdin which carries batch commands). *)
|
||||
let state = Sx_ref.make_cek_state expr (Env env) (List []) in
|
||||
cek_run_with_io state
|
||||
let s = ref (Sx_ref.cek_step_loop state) in
|
||||
while Sx_types.sx_truthy (Sx_ref.cek_suspended_p !s) do
|
||||
let request = Sx_ref.cek_io_request !s in
|
||||
let op = match request with
|
||||
| Dict d -> (match Hashtbl.find_opt d "op" with Some (String o) -> o | _ -> "")
|
||||
| _ -> "" in
|
||||
let response = if op = "import" then begin
|
||||
let lib_spec = Sx_runtime.get_val request (String "library") in
|
||||
let key = Sx_ref.library_name_key lib_spec in
|
||||
if Sx_types.sx_truthy (Sx_ref.library_loaded_p key) then Nil
|
||||
else begin
|
||||
(match resolve_library_path lib_spec with
|
||||
| Some path -> load_library_file path | None -> ());
|
||||
Nil
|
||||
end
|
||||
end else Nil (* non-import IO: resume with nil *) in
|
||||
s := Sx_ref.cek_resume !s response
|
||||
done;
|
||||
Sx_ref.cek_value !s
|
||||
) Nil exprs in
|
||||
(* Use ok-raw with natural list serialization — no (list ...) wrapping.
|
||||
This preserves the SX structure for Python to parse back. *)
|
||||
|
||||
Reference in New Issue
Block a user