diff options
author | Damien George <damien.p.george@gmail.com> | 2019-09-18 13:45:20 +1000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2019-09-26 15:53:05 +1000 |
commit | b596638b9b28975adee4a06a92497b5d9dbba34c (patch) | |
tree | 705c384c7dea0df0dcbb09da9b63c7f0936ece21 /py | |
parent | 74503107a7292eb524c4029f44479e418774af90 (diff) | |
download | micropython-b596638b9b28975adee4a06a92497b5d9dbba34c.tar.gz micropython-b596638b9b28975adee4a06a92497b5d9dbba34c.zip |
mpy-cross: Set number of registers in nlr_buf_t based on native arch.
Fixes #5059. Done in collaboration with Jim Mussared.
Diffstat (limited to 'py')
-rw-r--r-- | py/emitnative.c | 4 | ||||
-rw-r--r-- | py/mpstate.h | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/py/emitnative.c b/py/emitnative.c index c701e132a5..760c7fb0c1 100644 --- a/py/emitnative.c +++ b/py/emitnative.c @@ -81,7 +81,11 @@ // (L0-L2 may be in regs instead) // Native emitter needs to know the following sizes and offsets of C structs (on the target): +#if MICROPY_DYNAMIC_COMPILER +#define SIZEOF_NLR_BUF (2 + mp_dynamic_compiler.nlr_buf_num_regs + 1) // the +1 is conservative in case MICROPY_ENABLE_PYSTACK enabled +#else #define SIZEOF_NLR_BUF (sizeof(nlr_buf_t) / sizeof(uintptr_t)) +#endif #define SIZEOF_CODE_STATE (sizeof(mp_code_state_t) / sizeof(uintptr_t)) #define OFFSETOF_CODE_STATE_STATE (offsetof(mp_code_state_t, state) / sizeof(uintptr_t)) #define OFFSETOF_CODE_STATE_FUN_BC (offsetof(mp_code_state_t, fun_bc) / sizeof(uintptr_t)) diff --git a/py/mpstate.h b/py/mpstate.h index aba32084d5..0f9c56d2c7 100644 --- a/py/mpstate.h +++ b/py/mpstate.h @@ -47,6 +47,7 @@ typedef struct mp_dynamic_compiler_t { bool opt_cache_map_lookup_in_bytecode; bool py_builtins_str_unicode; uint8_t native_arch; + uint8_t nlr_buf_num_regs; } mp_dynamic_compiler_t; extern mp_dynamic_compiler_t mp_dynamic_compiler; #endif |