feat(vm): add call stack depth guard to MirInterpreter

This commit is contained in:
nyash-codex
2025-11-17 18:33:40 +09:00
parent f3cd815c77
commit c551131941
2 changed files with 22 additions and 0 deletions

View File

@ -41,6 +41,9 @@ pub struct MirInterpreter {
pub(super) inst_count: u64,
pub(super) branch_count: u64,
pub(super) compare_count: u64,
/// Call stack depth (exec_function_inner nesting). Used as a safety valve
/// to prevent Rust stack overflow on accidental infinite recursion in MIR.
pub(super) call_depth: usize,
}
impl MirInterpreter {
@ -58,6 +61,7 @@ impl MirInterpreter {
inst_count: 0,
branch_count: 0,
compare_count: 0,
call_depth: 0,
}
}