py/vm: Make n_state variable local to just set-up part of VM.

It's not used anywhere else in the VM loop, and clashes with (is shadowed
by) the n_state variable that's redeclared towards the end of the
mp_execute_bytecode function.  Code size is unchanged.
This commit is contained in:
Damien George 2017-07-18 16:17:23 +10:00
parent 299bc62586
commit 016325dd0a
1 changed files with 7 additions and 3 deletions

10
py/vm.c
View File

@ -162,9 +162,13 @@ mp_vm_return_kind_t mp_execute_bytecode(mp_code_state_t *code_state, volatile mp
run_code_state: ;
#endif
// Pointers which are constant for particular invocation of mp_execute_bytecode()
size_t n_state = mp_decode_uint_value(code_state->fun_bc->bytecode);
mp_obj_t * /*const*/ fastn = &code_state->state[n_state - 1];
mp_exc_stack_t * /*const*/ exc_stack = (mp_exc_stack_t*)(code_state->state + n_state);
mp_obj_t * /*const*/ fastn;
mp_exc_stack_t * /*const*/ exc_stack;
{
size_t n_state = mp_decode_uint_value(code_state->fun_bc->bytecode);
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)
volatile bool currently_in_except_block = MP_TAGPTR_TAG0(code_state->exc_sp); // 0 or 1, to detect nested exceptions