aboutsummaryrefslogtreecommitdiff
path: root/py/persistentcode.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2019-03-09 10:59:25 +1100
committerDamien George <damien.p.george@gmail.com>2019-03-14 12:22:25 +1100
commitd9d92f27d7cce287850d971abf3104d2230092fa (patch)
treee69b50bfa4b143f0a6e4efe76fc1d9834e7356fc /py/persistentcode.c
parent0e4c24ec08c19773b26a662abb133c05b474b1fa (diff)
py/compile: Add support to select the native emitter at runtime.
Diffstat (limited to 'py/persistentcode.c')
-rw-r--r--py/persistentcode.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/py/persistentcode.c b/py/persistentcode.c
index ad502a511..70ec2ddd6 100644
--- a/py/persistentcode.c
+++ b/py/persistentcode.c
@@ -78,6 +78,12 @@
#define MPY_FEATURE_ARCH (MP_NATIVE_ARCH_NONE)
#endif
+#if MICROPY_DYNAMIC_COMPILER
+#define MPY_FEATURE_ARCH_DYNAMIC mp_dynamic_compiler.native_arch
+#else
+#define MPY_FEATURE_ARCH_DYNAMIC MPY_FEATURE_ARCH
+#endif
+
#if MICROPY_PERSISTENT_CODE_LOAD || (MICROPY_PERSISTENT_CODE_SAVE && !MICROPY_DYNAMIC_COMPILER)
// The bytecode will depend on the number of bits in a small-int, and
// this function computes that (could make it a fixed constant, but it
@@ -731,7 +737,7 @@ void mp_raw_code_save(mp_raw_code_t *rc, mp_print_t *print) {
#endif
};
if (mp_raw_code_has_native(rc)) {
- header[2] |= MPY_FEATURE_ENCODE_ARCH(MPY_FEATURE_ARCH);
+ header[2] |= MPY_FEATURE_ENCODE_ARCH(MPY_FEATURE_ARCH_DYNAMIC);
}
mp_print_bytes(print, header, sizeof(header));
mp_print_uint(print, QSTR_WINDOW_SIZE);