py/persistentcode: Add mp_raw_code_save_fun_to_bytes.

Serialises a bytecode function/generator to a valid .mpy as bytes.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2024-07-17 16:06:12 +10:00
parent ceb8ba60b4
commit a11ba7775e
3 changed files with 194 additions and 2 deletions

View File

@@ -121,6 +121,7 @@ void mp_raw_code_load_file(qstr 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, qstr filename);
mp_obj_t mp_raw_code_save_fun_to_bytes(const mp_module_constants_t *consts, const uint8_t *bytecode);
void mp_native_relocate(void *reloc, uint8_t *text, uintptr_t reloc_text);