Fix IO suspension in both cek_run and cek_run_iterative
The _cek_io_suspend_hook was only added to cek_run_iterative (line 986) but the actual code path went through cek_run (line 624). Added the hook check to both functions. This fixes the "IO suspension in non-IO context" error that blocked hs-wait/perform from propagating through event handler → trampoline → eval_expr call chains. IO suspension now converts to VmSuspended via the hook, which the value_to_js wrapper catches and drives with _driveAsync. +42 OCaml test passes (3924→3966). IO suspension verified working in browser WASM: dom-on click handler → hs-wait → perform → suspend → _driveAsync → setTimeout → resume. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -621,7 +621,9 @@ and cek_run state =
|
|||||||
let result = resolver request final in
|
let result = resolver request final in
|
||||||
run (cek_resume final result)
|
run (cek_resume final result)
|
||||||
| None ->
|
| None ->
|
||||||
raise (Eval_error (value_to_str (String "IO suspension in non-IO context")))
|
(match !Sx_types._cek_io_suspend_hook with
|
||||||
|
| Some hook -> hook final
|
||||||
|
| None -> raise (Eval_error (value_to_str (String "IO suspension in non-IO context"))))
|
||||||
else cek_value final
|
else cek_value final
|
||||||
in run state
|
in run state
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1792,7 +1792,7 @@
|
|||||||
blake2_js_for_wasm_create: blake2_js_for_wasm_create};
|
blake2_js_for_wasm_create: blake2_js_for_wasm_create};
|
||||||
}
|
}
|
||||||
(globalThis))
|
(globalThis))
|
||||||
({"link":[["runtime-0db9b496",0],["prelude-d7e4b000",0],["stdlib-23ce0836",[]],["re-9a0de245",[2]],["sx-eee8f8a7",[2,3]],["jsoo_runtime-f96b44a8",[2]],["js_of_ocaml-651f6707",[2,5]],["dune__exe__Sx_browser-8c3734f6",[2,4,6]],["std_exit-10fb8830",[2]],["start-f808dbe1",0]],"generated":(b=>{var
|
({"link":[["runtime-0db9b496",0],["prelude-d7e4b000",0],["stdlib-23ce0836",[]],["re-9a0de245",[2]],["sx-5ce001fe",[2,3]],["jsoo_runtime-f96b44a8",[2]],["js_of_ocaml-651f6707",[2,5]],["dune__exe__Sx_browser-8c3734f6",[2,4,6]],["std_exit-10fb8830",[2]],["start-f808dbe1",0]],"generated":(b=>{var
|
||||||
c=b,a=b?.module?.export||b;return{"env":{"caml_ba_kind_of_typed_array":()=>{throw new
|
c=b,a=b?.module?.export||b;return{"env":{"caml_ba_kind_of_typed_array":()=>{throw new
|
||||||
Error("caml_ba_kind_of_typed_array not implemented")},"caml_exn_with_js_backtrace":()=>{throw new
|
Error("caml_ba_kind_of_typed_array not implemented")},"caml_exn_with_js_backtrace":()=>{throw new
|
||||||
Error("caml_exn_with_js_backtrace not implemented")},"caml_int64_create_lo_mi_hi":()=>{throw new
|
Error("caml_exn_with_js_backtrace not implemented")},"caml_int64_create_lo_mi_hi":()=>{throw new
|
||||||
|
|||||||
Reference in New Issue
Block a user