summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDavid Lechner <david@pybricks.com>2022-07-02 15:05:41 -0500
committerDamien George <damien@micropython.org>2022-07-18 13:52:01 +1000
commita98aa66df64e2676a311139f43dee9d13bae2c42 (patch)
tree02b5e2e1a56a8a0c88fc925bf2658ad8c9e6980e
parent2c728c533059a09635a99facfcce18bda8768497 (diff)
downloadmicropython-a98aa66df64e2676a311139f43dee9d13bae2c42.tar.gz
micropython-a98aa66df64e2676a311139f43dee9d13bae2c42.zip
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>
-rw-r--r--py/mpstate.h5
-rw-r--r--py/persistentcode.c5
2 files changed, 5 insertions, 5 deletions
diff --git a/py/mpstate.h b/py/mpstate.h
index a268e8685b..87d367769e 100644
--- a/py/mpstate.h
+++ b/py/mpstate.h
@@ -184,11 +184,6 @@ typedef struct _mp_state_vm_t {
mp_obj_dict_t *mp_module_builtins_override_dict;
#endif
- #if MICROPY_PERSISTENT_CODE_TRACK_RELOC_CODE
- // An mp_obj_list_t that tracks relocated native code to prevent the GC from reclaiming them.
- mp_obj_t track_reloc_code_list;
- #endif
-
// Include any root pointers registered with MP_REGISTER_ROOT_POINTER().
#ifndef NO_QSTR
// Only include root pointer definitions when not doing qstr extraction, because
diff --git a/py/persistentcode.c b/py/persistentcode.c
index fbef0b2c0f..a8e7429550 100644
--- a/py/persistentcode.c
+++ b/py/persistentcode.c
@@ -644,3 +644,8 @@ void mp_raw_code_save_file(mp_compiled_module_t *cm, const char *filename) {
#endif // MICROPY_PERSISTENT_CODE_SAVE_FILE
#endif // MICROPY_PERSISTENT_CODE_SAVE
+
+#if MICROPY_PERSISTENT_CODE_TRACK_RELOC_CODE
+// An mp_obj_list_t that tracks relocated native code to prevent the GC from reclaiming them.
+MP_REGISTER_ROOT_POINTER(mp_obj_t track_reloc_code_list);
+#endif