diff options
author | Damien George <damien.p.george@gmail.com> | 2014-03-27 10:55:21 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-03-27 10:55:21 +0000 |
commit | 8dcc0c79248a413f01f1d669b99d51e2519c5267 (patch) | |
tree | 40054715827a52fd4ddfec1d30ad63dc66091e4a /py/emitbc.c | |
parent | 945a01c4e37509a2be8d298cbd762e3fe61aca95 (diff) | |
download | micropython-8dcc0c79248a413f01f1d669b99d51e2519c5267.tar.gz micropython-8dcc0c79248a413f01f1d669b99d51e2519c5267.zip |
py: Calculate maximum exception stack size in compiler.
Diffstat (limited to 'py/emitbc.c')
-rw-r--r-- | py/emitbc.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/py/emitbc.c b/py/emitbc.c index 653b144875..fcaa9b7fae 100644 --- a/py/emitbc.c +++ b/py/emitbc.c @@ -224,7 +224,14 @@ STATIC void emit_bc_start_pass(emit_t *emit, pass_kind_t pass, scope_t *scope) { emit_write_code_info_qstr(emit, scope->source_file); emit_write_code_info_qstr(emit, scope->simple_name); - // prelude for initialising closed over variables + // bytecode prelude: exception stack size; 16 bit uint for now + { + byte* c = emit_get_cur_to_write_byte_code(emit, 2); + c[0] = scope->exc_stack_size & 0xff; + c[1] = (scope->exc_stack_size >> 8) & 0xff; + } + + // bytecode prelude: initialise closed over variables int num_cell = 0; for (int i = 0; i < scope->id_info_len; i++) { id_info_t *id = &scope->id_info[i]; |