VM: fix nested IO suspension frame corruption, island hydration preload
VM frame merging bug: call_closure_reuse now saves caller continuations on a reuse_stack instead of merging frames. resume_vm restores them in innermost-first order. Fixes frame count corruption when nested closures suspend via OP_PERFORM. Zero test regressions (3924/3924). Island hydration: hydrate-island now looks up components from (global-env) instead of render-env, triggering the symbol resolve hook. Added JS-level preload-island-defs that scans DOM for data-sx-island and loads definitions from the content-addressed manifest BEFORE hydration — avoids K.load reentrancy when the resolve hook fires inside env_get. loadDefinitionByHash: fixed isMultiDefine check — defcomp/defisland bodies containing nested (define ...) forms no longer suppress name insertion. Added K.load return value checking for silent error string returns. sx_browser.ml: resolve hook falls back to global_env.bindings when _vm_globals miss (sync gap). Snapshot reuse_stack alongside pending_cek. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -269,7 +269,9 @@ let () =
|
||||
(* Check if the symbol appeared in globals after the load *)
|
||||
match Hashtbl.find_opt _vm_globals name with
|
||||
| Some v -> Some v
|
||||
| None -> None)
|
||||
| None ->
|
||||
(* Fallback: check global_env directly if vm_globals missed the sync *)
|
||||
Hashtbl.find_opt global_env.bindings (Sx_types.intern name))
|
||||
|
||||
(* ================================================================== *)
|
||||
(* Core API *)
|
||||
|
||||
Reference in New Issue
Block a user