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

@@ -342,6 +342,11 @@
#define MICROPY_PERSISTENT_CODE_SAVE_FILE (0)
#endif
// Whether to support converting functions to persistent code (bytes)
#ifndef MICROPY_PERSISTENT_CODE_SAVE_FUN
#define MICROPY_PERSISTENT_CODE_SAVE_FUN (MICROPY_CONFIG_ROM_LEVEL_AT_LEAST_EVERYTHING)
#endif
// Whether generated code can persist independently of the VM/runtime instance
// This is enabled automatically when needed by other features
#ifndef MICROPY_PERSISTENT_CODE