py/vm: Improve performance of opcode dispatch when using switch stmt.
Before this patch, when using the switch statement for dispatch in the VM (not computed goto) a pending exception check was done after each opcode. This is not necessary and this patch makes the pending exception check only happen when explicitly requested by certain opcodes, like jump. This improves performance of the VM by about 2.5% when using the switch.
This commit is contained in:
parent
46ce395130
commit
869024dd6e
2
py/vm.c
2
py/vm.c
@ -136,7 +136,7 @@ mp_vm_return_kind_t mp_execute_bytecode(mp_code_state_t *code_state, volatile mp
|
||||
#define ENTRY(op) entry_##op
|
||||
#define ENTRY_DEFAULT entry_default
|
||||
#else
|
||||
#define DISPATCH() break
|
||||
#define DISPATCH() goto dispatch_loop
|
||||
#define DISPATCH_WITH_PEND_EXC_CHECK() goto pending_exception_check
|
||||
#define ENTRY(op) case op
|
||||
#define ENTRY_DEFAULT default
|
||||
|
Loading…
Reference in New Issue
Block a user