diff options
| author | Damien George <damien@micropython.org> | 2024-02-13 10:46:11 +1100 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2024-02-16 14:17:01 +1100 |
| commit | def6ad474264a677d22f62c741ef422321a4a41a (patch) | |
| tree | 6fe582befffdb59316e9c2121f53553bf6af5be3 /py/emitglue.c | |
| parent | 5a3dd8c79185be07b7bf68d51ccc8f98ced59182 (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/emitglue.c')
| -rw-r--r-- | py/emitglue.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/py/emitglue.c b/py/emitglue.c index 9d671b710..7dc308087 100644 --- a/py/emitglue.c +++ b/py/emitglue.c @@ -61,11 +61,9 @@ mp_raw_code_t *mp_emit_glue_new_raw_code(void) { } void mp_emit_glue_assign_bytecode(mp_raw_code_t *rc, const byte *code, - #if MICROPY_PERSISTENT_CODE_SAVE || MICROPY_DEBUG_PRINTERS - size_t len, - #endif mp_raw_code_t **children, #if MICROPY_PERSISTENT_CODE_SAVE + size_t len, uint16_t n_children, #endif uint16_t scope_flags) { @@ -73,12 +71,10 @@ void mp_emit_glue_assign_bytecode(mp_raw_code_t *rc, const byte *code, rc->kind = MP_CODE_BYTECODE; rc->is_generator = (scope_flags & MP_SCOPE_FLAG_GENERATOR) != 0; rc->fun_data = code; - #if MICROPY_PERSISTENT_CODE_SAVE || MICROPY_DEBUG_PRINTERS - rc->fun_data_len = len; - #endif rc->children = children; #if MICROPY_PERSISTENT_CODE_SAVE + rc->fun_data_len = len; rc->n_children = n_children; #endif @@ -88,7 +84,7 @@ void mp_emit_glue_assign_bytecode(mp_raw_code_t *rc, const byte *code, #endif #if DEBUG_PRINT - #if !(MICROPY_PERSISTENT_CODE_SAVE || MICROPY_DEBUG_PRINTERS) + #if !MICROPY_PERSISTENT_CODE_SAVE const size_t len = 0; #endif DEBUG_printf("assign byte code: code=%p len=" UINT_FMT " flags=%x\n", code, len, (uint)scope_flags); @@ -136,7 +132,7 @@ void mp_emit_glue_assign_native(mp_raw_code_t *rc, mp_raw_code_kind_t kind, void rc->is_generator = (scope_flags & MP_SCOPE_FLAG_GENERATOR) != 0; rc->fun_data = fun_data; - #if MICROPY_PERSISTENT_CODE_SAVE || MICROPY_DEBUG_PRINTERS + #if MICROPY_PERSISTENT_CODE_SAVE rc->fun_data_len = fun_len; #endif rc->children = children; |
