Skip to content

Commit 016325d

Browse files
committed
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.
1 parent 299bc62 commit 016325d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

py/vm.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,13 @@ mp_vm_return_kind_t mp_execute_bytecode(mp_code_state_t *code_state, volatile mp
162162
run_code_state: ;
163163
#endif
164164
// Pointers which are constant for particular invocation of mp_execute_bytecode()
165-
size_t n_state = mp_decode_uint_value(code_state->fun_bc->bytecode);
166-
mp_obj_t * /*const*/ fastn = &code_state->state[n_state - 1];
167-
mp_exc_stack_t * /*const*/ exc_stack = (mp_exc_stack_t*)(code_state->state + n_state);
165+
mp_obj_t * /*const*/ fastn;
166+
mp_exc_stack_t * /*const*/ exc_stack;
167+
{
168+
size_t n_state = mp_decode_uint_value(code_state->fun_bc->bytecode);
169+
fastn = &code_state->state[n_state - 1];
170+
exc_stack = (mp_exc_stack_t*)(code_state->state + n_state);
171+
}
168172

169173
// variables that are visible to the exception handler (declared volatile)
170174
volatile bool currently_in_except_block = MP_TAGPTR_TAG0(code_state->exc_sp); // 0 or 1, to detect nested exceptions

0 commit comments

Comments
 (0)