Fix server import suspension, dist sync, JIT errors
- cek_run patched to handle import suspensions via _import_hook. define-library (import ...) now resolves cleanly on the server. IO suspension errors: 190 → 0. JIT failures: ~50 → 0. - _import_hook wired in sx_server.ml to load .sx files on demand. - compile-modules.js syncs source .sx files to dist/sx/ before compiling — eliminates stale bytecode from out-of-date copies. - WASM binary rebuilt with all fixes. - 2658/2658 tests pass (8 new — previously failing import tests). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -783,6 +783,18 @@ let () =
|
||||
if not (Sx_primitives.is_primitive name) then
|
||||
Hashtbl.replace _shared_vm_globals name v)
|
||||
|
||||
(* Import hook — resolves (import ...) suspensions inside eval_expr/cek_run.
|
||||
Loads the .sx file for the library, registers it, and returns true. *)
|
||||
let () =
|
||||
Sx_types._import_hook := Some (fun lib_spec ->
|
||||
let key = Sx_ref.library_name_key lib_spec in
|
||||
if Sx_types.sx_truthy (Sx_ref.library_loaded_p key) then true
|
||||
else match resolve_library_path lib_spec with
|
||||
| Some path ->
|
||||
(try load_library_file path; true
|
||||
with _ -> false)
|
||||
| None -> false)
|
||||
|
||||
let make_server_env () =
|
||||
let env = make_env () in
|
||||
Sx_render.setup_render_env env;
|
||||
|
||||
Reference in New Issue
Block a user