You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Encode VM stack/context/register lifecycle invariants as
debug_assert!s. Zero cost in release; surfaces violations during
debug-mode tests and CI.
Invariants covered:
- reset_execution_state postcondition: all stacks empty, registers
resized to base and Undefined, rule_cache reset, pc/executed counters
zeroed, builtins_cache cleared, execution_state Ready.
- Per-opcode invariant check (assert_vm_invariants) invoked at the top
of run_stackless_loop and jump_to iterations: state is Ready/Running,
registers non-empty, rule_cache sized to program, execution stack
bounded.
- resume() precondition: execution_state is Suspended.
- execute_suspendable_entry precondition: clean state (callers reset
immediately before).
- ComprehensionEnd dispatch: comprehension_stack non-empty.
- Rule finalize / call_rule completion: call_rule_stack non-empty and
popped frame's rule_index matches.
- IterationState::advance: Single iterator not advanced past consumption,
Array index not at usize::MAX before saturating_add.
All gated by #[cfg(debug_assertions)] (directly or via debug_assert!)
so release builds are unaffected.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
0 commit comments