Stub VM uses real globals for CEK resume after IO suspension

The _cek_io_suspend_hook creates a stub VM to carry the suspended CEK
state. Previously used empty globals, which caused "Not callable: nil"
when the CEK resume needed platform functions. Now uses _default_vm_globals
(set to _vm_globals by sx_browser.ml) so all platform functions and
definitions are available during resume.

Remaining issue: still getting "resume: Not callable: nil" — the CEK
continuation env may not include letrec bindings from the island body.
The suspension point is inside reload-frame → hs-wait, and the resume
needs to call wait-boot (a letrec binding).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-16 17:26:38 +00:00
parent d981e5f620
commit ca9196a693
7 changed files with 1309 additions and 1265 deletions

View File

@@ -237,6 +237,7 @@ let return_via_side_channel (v : Js.Unsafe.any) : Js.Unsafe.any =
VmClosures from bytecode modules hold vm_env_ref pointing here.
Must stay in sync so VmClosures see post-boot definitions. *)
let _vm_globals : (string, value) Hashtbl.t = Hashtbl.create 512
let () = Sx_types._default_vm_globals := _vm_globals
let _in_batch = ref false
(* Sync env→VM: copy all bindings from global_env.bindings to _vm_globals.