When cek_call_or_suspend runs a CEK machine for a non-bytecoded Lambda (e.g. a thunk), _active_vm still pointed to the caller's VM. VmClosure calls inside the CEK (e.g. hs-wait) would merge their frames with the caller's VM via call_closure_reuse, causing the VM to skip the CEK's remaining continuation on resume — producing wrong DOM mutation order (+active, +active, -active instead of +active, -active, +active). Fix: swap _active_vm with an empty isolation VM before running the CEK, restore after. This keeps VmClosure calls on their own frame stack while preserving js_of_ocaml exception identity (Some path, not None). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
11 KiB
11 KiB