py: Provide mp_decode_uint_value to help optimise stack usage.

This has a noticeable improvement on x86-64 and Thumb2 archs, where stack
usage is reduced by 2 machine words in the VM.
This commit is contained in:
Damien George
2017-03-17 16:38:46 +11:00
parent 71a3d6ec3b
commit 5640e6dacd
4 changed files with 14 additions and 9 deletions

View File

@@ -135,8 +135,7 @@ mp_vm_return_kind_t mp_obj_gen_resume(mp_obj_t self_in, mp_obj_t send_value, mp_
break;
case MP_VM_RETURN_EXCEPTION: {
const byte *bc = self->code_state.fun_bc->bytecode;
size_t n_state = mp_decode_uint(&bc);
size_t n_state = mp_decode_uint_value(self->code_state.fun_bc->bytecode);
self->code_state.ip = 0;
*ret_val = self->code_state.state[n_state - 1];
break;