Fix MIR builder me-call recursion and add compile tracing

This commit is contained in:
nyash-codex
2025-11-17 19:53:44 +09:00
parent c551131941
commit f300b9f3c9
7 changed files with 68 additions and 15 deletions

View File

@ -15,7 +15,7 @@ impl MirInterpreter {
) -> Result<VMValue, VMError> {
// Safety valve: cap nested exec_function_inner depth to avoid Rust stack overflow
// on accidental infinite recursion in MIR (e.g., self-recursive call chains).
const MAX_CALL_DEPTH: usize = 1024;
const MAX_CALL_DEPTH: usize = 128;
self.call_depth = self.call_depth.saturating_add(1);
if self.call_depth > MAX_CALL_DEPTH {
eprintln!(