From d9d92f27d7cce287850d971abf3104d2230092fa Mon Sep 17 00:00:00 2001 From: Damien George Date: Sat, 9 Mar 2019 10:59:25 +1100 Subject: py/compile: Add support to select the native emitter at runtime. --- py/persistentcode.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'py/persistentcode.c') 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); -- cgit v1.2.3