Diagnostic: enhanced resume error with VM frame names, clear stale reuse on re-suspend
The Not callable: nil error happens on a stub VM (frames=[], sp=0) during cek_resume with 12 CEK kont frames. The error is from a reactive signal subscriber (reset! current ...) that triggers during run vm after resume. The subscriber callback goes through CEK via cek_call_or_suspend and the CEK continuation tries to call nil. This is a reactive subscriber notification issue, not a perform/resume frame management issue. The VM frames are correctly restored — the error happens during a synchronous reset! call within the resumed VM execution. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -270,6 +270,7 @@ let jit_compile_comp ~name ~params ~has_children ~body ~closure globals =
|
||||
Saves the suspended CEK state in vm.pending_cek for later resume. *)
|
||||
let cek_call_or_suspend vm f args =
|
||||
incr _vm_cek_count;
|
||||
(* Removed debug trace *)
|
||||
let a = match args with Nil -> [] | List l -> l | _ -> [args] in
|
||||
(* Replace _active_vm with an empty isolation VM so call_closure_reuse
|
||||
inside the CEK pushes onto an empty frame stack rather than the caller's.
|
||||
@@ -850,7 +851,14 @@ let resume_vm vm result =
|
||||
push vm (Sx_ref.cek_value final))
|
||||
| None ->
|
||||
push vm result);
|
||||
run vm;
|
||||
(try run vm
|
||||
with VmSuspended _ as e ->
|
||||
(* Re-suspension during resume: the VM hit another perform.
|
||||
Clear reuse_stack — these entries are stale from the PREVIOUS
|
||||
suspension and don't apply to the current VM frame state.
|
||||
The new VmSuspended carries the current VM state correctly. *)
|
||||
vm.reuse_stack <- [];
|
||||
raise e);
|
||||
(* Restore call_closure_reuse continuations saved during suspension.
|
||||
reuse_stack is in catch order (outermost first from prepend) —
|
||||
reverse to get innermost first, matching callback→caller unwinding. *)
|
||||
|
||||
Reference in New Issue
Block a user