aboutsummaryrefslogtreecommitdiff
path: root/py/vm.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2019-09-23 23:37:01 +1000
committerDamien George <damien.p.george@gmail.com>2019-10-01 12:26:22 +1000
commit4c5e1a036831a3ac36866e4daab3a50c772b4443 (patch)
tree795134f3011461f5574d64d545a3061eff655ea8 /py/vm.c
parent1d7afcce49366c11f67561019a5adf5e60c450f5 (diff)
py/bc: Change mp_code_state_t.exc_sp to exc_sp_idx.
Change from a pointer to an index, to make space in mp_code_state_t.
Diffstat (limited to 'py/vm.c')
-rw-r--r--py/vm.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/py/vm.c b/py/vm.c
index 16b1348b4..c0cd9ffbf 100644
--- a/py/vm.c
+++ b/py/vm.c
@@ -234,7 +234,7 @@ FRAME_SETUP();
}
// variables that are visible to the exception handler (declared volatile)
- mp_exc_stack_t *volatile exc_sp = MP_TAGPTR_PTR(code_state->exc_sp); // stack grows up, exc_sp points to top of stack
+ mp_exc_stack_t *volatile exc_sp = MP_CODE_STATE_EXC_SP_IDX_TO_PTR(exc_stack, code_state->exc_sp_idx); // stack grows up, exc_sp points to top of stack
#if MICROPY_PY_THREAD_GIL && MICROPY_PY_THREAD_GIL_VM_DIVISOR
// This needs to be volatile and outside the VM loop so it persists across handling
@@ -953,7 +953,7 @@ unwind_jump:;
if (mp_obj_get_type(*sp) == &mp_type_fun_bc) {
code_state->ip = ip;
code_state->sp = sp;
- code_state->exc_sp = MP_TAGPTR_MAKE(exc_sp, 0);
+ code_state->exc_sp_idx = MP_CODE_STATE_EXC_SP_IDX_FROM_PTR(exc_stack, exc_sp);
mp_code_state_t *new_state = mp_obj_fun_bc_prepare_codestate(*sp, unum & 0xff, (unum >> 8) & 0xff, sp + 1);
#if !MICROPY_ENABLE_PYSTACK
if (new_state == NULL) {
@@ -990,7 +990,7 @@ unwind_jump:;
if (mp_obj_get_type(*sp) == &mp_type_fun_bc) {
code_state->ip = ip;
code_state->sp = sp;
- code_state->exc_sp = MP_TAGPTR_MAKE(exc_sp, 0);
+ code_state->exc_sp_idx = MP_CODE_STATE_EXC_SP_IDX_FROM_PTR(exc_stack, exc_sp);
mp_call_args_t out_args;
mp_call_prepare_args_n_kw_var(false, unum, sp, &out_args);
@@ -1034,7 +1034,7 @@ unwind_jump:;
if (mp_obj_get_type(*sp) == &mp_type_fun_bc) {
code_state->ip = ip;
code_state->sp = sp;
- code_state->exc_sp = MP_TAGPTR_MAKE(exc_sp, 0);
+ code_state->exc_sp_idx = MP_CODE_STATE_EXC_SP_IDX_FROM_PTR(exc_stack, exc_sp);
size_t n_args = unum & 0xff;
size_t n_kw = (unum >> 8) & 0xff;
@@ -1075,7 +1075,7 @@ unwind_jump:;
if (mp_obj_get_type(*sp) == &mp_type_fun_bc) {
code_state->ip = ip;
code_state->sp = sp;
- code_state->exc_sp = MP_TAGPTR_MAKE(exc_sp, 0);
+ code_state->exc_sp_idx = MP_CODE_STATE_EXC_SP_IDX_FROM_PTR(exc_stack, exc_sp);
mp_call_args_t out_args;
mp_call_prepare_args_n_kw_var(true, unum, sp, &out_args);
@@ -1197,7 +1197,7 @@ yield:
nlr_pop();
code_state->ip = ip;
code_state->sp = sp;
- code_state->exc_sp = MP_TAGPTR_MAKE(exc_sp, 0);
+ code_state->exc_sp_idx = MP_CODE_STATE_EXC_SP_IDX_FROM_PTR(exc_stack, exc_sp);
FRAME_LEAVE();
return MP_VM_RETURN_YIELD;
@@ -1503,7 +1503,7 @@ unwind_loop:
fastn = &code_state->state[n_state - 1];
exc_stack = (mp_exc_stack_t*)(code_state->state + n_state);
// variables that are visible to the exception handler (declared volatile)
- exc_sp = MP_TAGPTR_PTR(code_state->exc_sp); // stack grows up, exc_sp points to top of stack
+ exc_sp = MP_CODE_STATE_EXC_SP_IDX_TO_PTR(exc_stack, code_state->exc_sp_idx); // stack grows up, exc_sp points to top of stack
goto unwind_loop;
#endif