diff options
author | Damien George <damien@micropython.org> | 2022-12-07 14:42:35 +1100 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2022-12-08 12:27:23 +1100 |
commit | 2283b6d68fe77b72e7beeb1bf24778834231b190 (patch) | |
tree | e7a03f1b759a2312b5b23a04c475f998b4ca20a7 /py/persistentcode.h | |
parent | 96c23432f6ef448fdcccdfa6a442d64d7ed06277 (diff) | |
download | micropython-2283b6d68fe77b72e7beeb1bf24778834231b190.tar.gz micropython-2283b6d68fe77b72e7beeb1bf24778834231b190.zip |
py: Pass in address to compiled module instead of returning it.
This change makes it so the compiler and persistent code loader take a
mp_compiled_module_t* as their last argument, instead of returning this
struct. This eliminates a duplicate context variable for all callers of
these functions (because the context is now stored in the
mp_compiled_module_t by the caller), and also eliminates any confusion
about which context to use after the mp_compile_to_raw_code or
mp_raw_code_load function returns (because there is now only one context,
that stored in mp_compiled_module_t.context).
Reduces code size by 16 bytes on ARM Cortex-based ports.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'py/persistentcode.h')
-rw-r--r-- | py/persistentcode.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/py/persistentcode.h b/py/persistentcode.h index e664358737..d363f544ad 100644 --- a/py/persistentcode.h +++ b/py/persistentcode.h @@ -111,9 +111,9 @@ enum { MP_PERSISTENT_OBJ_TUPLE, }; -mp_compiled_module_t mp_raw_code_load(mp_reader_t *reader, mp_module_context_t *ctx); -mp_compiled_module_t mp_raw_code_load_mem(const byte *buf, size_t len, mp_module_context_t *ctx); -mp_compiled_module_t mp_raw_code_load_file(const char *filename, mp_module_context_t *ctx); +void mp_raw_code_load(mp_reader_t *reader, mp_compiled_module_t *ctx); +void mp_raw_code_load_mem(const byte *buf, size_t len, mp_compiled_module_t *ctx); +void mp_raw_code_load_file(const char *filename, mp_compiled_module_t *ctx); void mp_raw_code_save(mp_compiled_module_t *cm, mp_print_t *print); void mp_raw_code_save_file(mp_compiled_module_t *cm, const char *filename); |