aboutsummaryrefslogtreecommitdiff
path: root/py/emitbc.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2019-01-04 17:09:41 +1100
committerDamien George <damien.p.george@gmail.com>2019-01-04 17:09:41 +1100
commit6d199344631b9706eab828fe29b795578a81c618 (patch)
tree92f52a6089aded0490c88c49d380923fb609bea2 /py/emitbc.c
parentb33f108cdeb57c9d84e5a4eff5a46aa49c6dd558 (diff)
py: Get optional VM stack overflow check compiling and working again.
Changes to the layout of the bytecode header meant that this debug code was no longer compiling. This is now fixed and a new compile-time option is introduced, MICROPY_DEBUG_VM_STACK_OVERFLOW, to turn on this feature (which is disabled by default). This option is needed because more than one file needs to cooperate to make this check work.
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);
}