Skip to content

Commit a98aa66

Browse files
dlechdpgeorge
authored andcommitted
py/persistentcode: Use MP_REGISTER_ROOT_POINTER().
This uses MP_REGISTER_ROOT_POINTER() to register track_reloc_code_list instead of using a conditional inside of mp_state_vm_t. Signed-off-by: David Lechner <david@pybricks.com>
1 parent 2c728c5 commit a98aa66

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

py/mpstate.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,11 +184,6 @@ typedef struct _mp_state_vm_t {
184184
mp_obj_dict_t *mp_module_builtins_override_dict;
185185
#endif
186186

187-
#if MICROPY_PERSISTENT_CODE_TRACK_RELOC_CODE
188-
// An mp_obj_list_t that tracks relocated native code to prevent the GC from reclaiming them.
189-
mp_obj_t track_reloc_code_list;
190-
#endif
191-
192187
// Include any root pointers registered with MP_REGISTER_ROOT_POINTER().
193188
#ifndef NO_QSTR
194189
// Only include root pointer definitions when not doing qstr extraction, because

py/persistentcode.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,3 +644,8 @@ void mp_raw_code_save_file(mp_compiled_module_t *cm, const char *filename) {
644644
#endif // MICROPY_PERSISTENT_CODE_SAVE_FILE
645645

646646
#endif // MICROPY_PERSISTENT_CODE_SAVE
647+
648+
#if MICROPY_PERSISTENT_CODE_TRACK_RELOC_CODE
649+
// An mp_obj_list_t that tracks relocated native code to prevent the GC from reclaiming them.
650+
MP_REGISTER_ROOT_POINTER(mp_obj_t track_reloc_code_list);
651+
#endif

0 commit comments

Comments
 (0)