summaryrefslogtreecommitdiff
path: root/py/emitbc.c
diff options
context:
space:
mode:
Diffstat (limited to 'py/emitbc.c')
-rw-r--r--py/emitbc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/py/emitbc.c b/py/emitbc.c
index 98e1d1bde..6a46cfb59 100644
--- a/py/emitbc.c
+++ b/py/emitbc.c
@@ -331,6 +331,10 @@ void mp_emit_bc_start_pass(emit_t *emit, pass_kind_t pass, scope_t *scope) {
// the highest slot in the state (fastn[0], see vm.c).
n_state = 1;
}
+ #if MICROPY_DEBUG_VM_STACK_OVERFLOW
+ // An extra slot in the stack is needed to detect VM stack overflow
+ n_state += 1;
+ #endif
emit_write_code_info_uint(emit, n_state);
emit_write_code_info_uint(emit, scope->exc_stack_size);
}