diff options
| author | Damien George <damien@micropython.org> | 2024-02-09 17:38:25 +1100 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2024-02-16 12:48:02 +1100 |
| commit | 5e3006f1172d0eabbbefeb3268dfb942ec7cf9cd (patch) | |
| tree | 9ad4455beb4711980134e44acd0d2bdf798b74b4 /py/runtime0.h | |
| parent | 416465d81e911b088836f4e7c37fac2bc0f67917 (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/runtime0.h')
| -rw-r--r-- | py/runtime0.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/py/runtime0.h b/py/runtime0.h index 69af38ddc..9c6f0e079 100644 --- a/py/runtime0.h +++ b/py/runtime0.h @@ -26,8 +26,11 @@ #ifndef MICROPY_INCLUDED_PY_RUNTIME0_H #define MICROPY_INCLUDED_PY_RUNTIME0_H -// The first four must fit in 8 bits, see emitbc.c -// The remaining must fit in 16 bits, see scope.h +// These constants are used by: +// - mp_raw_code_t::is_generator (only MP_SCOPE_FLAG_GENERATOR) +// - scope_t::scope_flags (16 bits) +// - MP_BC_PRELUDE_SIG_ENCODE macro, masked by MP_SCOPE_FLAG_ALL_SIG (4 bits) +// - tools/mpy_ld.py, when generating mpy files (maximum 7 bits) #define MP_SCOPE_FLAG_ALL_SIG (0x0f) #define MP_SCOPE_FLAG_GENERATOR (0x01) #define MP_SCOPE_FLAG_VARKEYWORDS (0x02) |
