summaryrefslogtreecommitdiff
path: root/py/persistentcode.c
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2024-02-09 17:38:25 +1100
committerDamien George <damien@micropython.org>2024-02-16 12:48:02 +1100
commit5e3006f1172d0eabbbefeb3268dfb942ec7cf9cd (patch)
tree9ad4455beb4711980134e44acd0d2bdf798b74b4 /py/persistentcode.c
parent416465d81e911b088836f4e7c37fac2bc0f67917 (diff)
py/emitglue: Simplify mp_raw_code_t's kind and scope_flags members.
To simplify their access and reduce code size. The `scope_flags` member is only ever used to determine if a function is a generator or not, so make it reflect that fact as a bool type. Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'py/persistentcode.c')
-rw-r--r--py/persistentcode.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/py/persistentcode.c b/py/persistentcode.c
index 83806febb..7b002e7fc 100644
--- a/py/persistentcode.c
+++ b/py/persistentcode.c
@@ -577,7 +577,9 @@ STATIC void save_raw_code(mp_print_t *print, const mp_raw_code_t *rc) {
mp_print_uint(print, rc->prelude_offset);
} else if (rc->kind == MP_CODE_NATIVE_VIPER || rc->kind == MP_CODE_NATIVE_ASM) {
// Save basic scope info for viper and asm
- mp_print_uint(print, rc->scope_flags & MP_SCOPE_FLAG_ALL_SIG);
+ // Viper/asm functions don't support generator, variable args, or default keyword args
+ // so (scope_flags & MP_SCOPE_FLAG_ALL_SIG) for these functions is always 0.
+ mp_print_uint(print, 0);
#if MICROPY_EMIT_INLINE_ASM
if (rc->kind == MP_CODE_NATIVE_ASM) {
mp_print_uint(print, rc->asm_n_pos_args);