diff options
author | Damien George <damien.p.george@gmail.com> | 2019-09-24 15:57:08 +1000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2019-10-01 12:26:22 +1000 |
commit | 81d04a0200e0d4038c011e4946bfae5707ef9d9c (patch) | |
tree | 63abd765209f3aa447285db2d8f35c3a53eccb52 /py/objfun.c | |
parent | 4c5e1a036831a3ac36866e4daab3a50c772b4443 (diff) |
py: Add n_state to mp_code_state_t struct.
This value is used often enough that it is better to cache it instead of
decode it each time.
Diffstat (limited to 'py/objfun.c')
-rw-r--r-- | py/objfun.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/py/objfun.c b/py/objfun.c index e0c6fb927..114367b4e 100644 --- a/py/objfun.c +++ b/py/objfun.c @@ -206,9 +206,10 @@ STATIC void dump_args(const mp_obj_t *a, size_t sz) { + n_exc_stack * sizeof(mp_exc_stack_t); \ } -#define INIT_CODESTATE(code_state, _fun_bc, n_args, n_kw, args) \ +#define INIT_CODESTATE(code_state, _fun_bc, _n_state, n_args, n_kw, args) \ code_state->fun_bc = _fun_bc; \ code_state->ip = 0; \ + code_state->n_state = _n_state; \ mp_setup_code_state(code_state, n_args, n_kw, args); \ code_state->old_globals = mp_globals_get(); @@ -235,7 +236,7 @@ mp_code_state_t *mp_obj_fun_bc_prepare_codestate(mp_obj_t self_in, size_t n_args } #endif - INIT_CODESTATE(code_state, self, n_args, n_kw, args); + INIT_CODESTATE(code_state, self, n_state, n_args, n_kw, args); // execute the byte code with the correct globals context mp_globals_set(self->globals); @@ -280,7 +281,7 @@ STATIC mp_obj_t fun_bc_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const } #endif - INIT_CODESTATE(code_state, self, n_args, n_kw, args); + INIT_CODESTATE(code_state, self, n_state, n_args, n_kw, args); // execute the byte code with the correct globals context mp_globals_set(self->globals); |