py/bc: Provide separate code-state setup funcs for bytecode and native.

mpy-cross will now generate native code based on the size of
mp_code_state_native_t, and the runtime will use this struct to calculate
the offset of the .state field.  This makes native code generation and
execution (which rely on this struct) independent to the settings
MICROPY_STACKLESS and MICROPY_PY_SYS_SETTRACE, both of which change the
size of the mp_code_state_t struct.

Fixes issue #5059.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2022-05-15 13:37:06 +10:00
parent 8e1db993cd
commit 1762990579
7 changed files with 98 additions and 46 deletions

View File

@@ -302,7 +302,7 @@ const mp_fun_table_t mp_fun_table = {
mp_delete_global,
mp_obj_new_closure,
mp_arg_check_num_sig,
mp_setup_code_state,
mp_setup_code_state_native,
mp_small_int_floor_divide,
mp_small_int_modulo,
mp_native_yield_from,