diff options
author | Damien George <damien@micropython.org> | 2024-02-22 10:49:03 +1100 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2024-02-22 11:27:33 +1100 |
commit | 9e5b6972c767448fb67fa8f13e20b5d3ec2a8673 (patch) | |
tree | 7410246f9aaf7009619ac72c5fee4739783b5dcd /py | |
parent | 01f4e85f1b360d40f8db99aa0db158fa5c2d796e (diff) | |
download | micropython-9e5b6972c767448fb67fa8f13e20b5d3ec2a8673.tar.gz micropython-9e5b6972c767448fb67fa8f13e20b5d3ec2a8673.zip |
py/emitglue: Make mp_emit_glue_assign_native's fun_data arg a const ptr.
It will only ever be read from, and in some cases (eg on esp8266) can
actually be in ROM.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'py')
-rw-r--r-- | py/emitglue.c | 6 | ||||
-rw-r--r-- | py/emitglue.h | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/py/emitglue.c b/py/emitglue.c index 258322724b..6b6d5ccba2 100644 --- a/py/emitglue.c +++ b/py/emitglue.c @@ -92,7 +92,7 @@ void mp_emit_glue_assign_bytecode(mp_raw_code_t *rc, const byte *code, } #if MICROPY_EMIT_MACHINE_CODE -void mp_emit_glue_assign_native(mp_raw_code_t *rc, mp_raw_code_kind_t kind, void *fun_data, mp_uint_t fun_len, +void mp_emit_glue_assign_native(mp_raw_code_t *rc, mp_raw_code_kind_t kind, const void *fun_data, mp_uint_t fun_len, mp_raw_code_t **children, #if MICROPY_PERSISTENT_CODE_SAVE uint16_t n_children, @@ -115,7 +115,7 @@ void mp_emit_glue_assign_native(mp_raw_code_t *rc, mp_raw_code_kind_t kind, void #endif #elif MICROPY_EMIT_ARM #if (defined(__linux__) && defined(__GNUC__)) || __ARM_ARCH == 7 - __builtin___clear_cache(fun_data, (uint8_t *)fun_data + fun_len); + __builtin___clear_cache((void *)fun_data, (uint8_t *)fun_data + fun_len); #elif defined(__arm__) // Flush I-cache and D-cache. asm volatile ( @@ -154,7 +154,7 @@ void mp_emit_glue_assign_native(mp_raw_code_t *rc, mp_raw_code_kind_t kind, void if (i > 0 && i % 16 == 0) { DEBUG_printf("\n"); } - DEBUG_printf(" %02x", ((byte *)fun_data)[i]); + DEBUG_printf(" %02x", ((const byte *)fun_data)[i]); } DEBUG_printf("\n"); diff --git a/py/emitglue.h b/py/emitglue.h index b7368d697d..0960ee22da 100644 --- a/py/emitglue.h +++ b/py/emitglue.h @@ -130,7 +130,7 @@ void mp_emit_glue_assign_bytecode(mp_raw_code_t *rc, const byte *code, #endif uint16_t scope_flags); -void mp_emit_glue_assign_native(mp_raw_code_t *rc, mp_raw_code_kind_t kind, void *fun_data, mp_uint_t fun_len, +void mp_emit_glue_assign_native(mp_raw_code_t *rc, mp_raw_code_kind_t kind, const void *fun_data, mp_uint_t fun_len, mp_raw_code_t **children, #if MICROPY_PERSISTENT_CODE_SAVE uint16_t n_children, |