summaryrefslogtreecommitdiff
path: root/py/emitbc.c
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2024-02-13 10:46:11 +1100
committerDamien George <damien@micropython.org>2024-02-16 14:17:01 +1100
commitdef6ad474264a677d22f62c741ef422321a4a41a (patch)
tree6fe582befffdb59316e9c2121f53553bf6af5be3 /py/emitbc.c
parent5a3dd8c79185be07b7bf68d51ccc8f98ced59182 (diff)
py/emitglue: Include fun_data_len in mp_raw_code_t only when saving.
Reduces the size of mp_raw_code_t in the case when MICROPY_DEBUG_PRINTERS is enabled. Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'py/emitbc.c')
-rw-r--r--py/emitbc.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/py/emitbc.c b/py/emitbc.c
index a07657408..ca5f07085 100644
--- a/py/emitbc.c
+++ b/py/emitbc.c
@@ -393,13 +393,18 @@ bool mp_emit_bc_end_pass(emit_t *emit) {
mp_raise_msg(&mp_type_RuntimeError, MP_ERROR_TEXT("bytecode overflow"));
}
+ #if MICROPY_PERSISTENT_CODE_SAVE || MICROPY_DEBUG_PRINTERS
+ size_t bytecode_len = emit->code_info_size + emit->bytecode_size;
+ #if MICROPY_DEBUG_PRINTERS
+ emit->scope->raw_code_data_len = bytecode_len;
+ #endif
+ #endif
+
// Bytecode is finalised, assign it to the raw code object.
mp_emit_glue_assign_bytecode(emit->scope->raw_code, emit->code_base,
- #if MICROPY_PERSISTENT_CODE_SAVE || MICROPY_DEBUG_PRINTERS
- emit->code_info_size + emit->bytecode_size,
- #endif
emit->emit_common->children,
#if MICROPY_PERSISTENT_CODE_SAVE
+ bytecode_len,
emit->emit_common->ct_cur_child,
#endif
emit->scope->scope_flags);