In `call_closure_reuse`, the success path used a bare `pop vm` that relied on OP_RETURN having left the stack at exactly `saved_sp + 1`. When the callee returns a closure (or hits the bytecode-exhausted fallback path), `vm.sp` can end up inconsistent with the parent frame's expected layout, corrupting intermediate values such as parser combinator state in `parse-bind`/`many`/ `seq`. Fix: read the result at the expected slot, then explicitly reset `vm.sp <- saved_sp` before returning so the parent frame sees a clean stack regardless of what the callee left behind. OCaml run_tests baseline: 4525/5864 unchanged. WASM kernel tests: 24/29 unchanged. No regressions.
64 KiB
64 KiB