vm: Consolodate all dispatch instructions
Flash savings: 1268 bytes Performance: 10,000 iteration loop .665 -> .676s (+1.7%)
This commit is contained in:
parent
28638df589
commit
7b359d7a8a
5
py/vm.c
5
py/vm.c
@ -129,11 +129,12 @@ mp_vm_return_kind_t PLACE_IN_ITCM(mp_execute_bytecode)(mp_code_state_t *code_sta
|
||||
#endif
|
||||
#if MICROPY_OPT_COMPUTED_GOTO
|
||||
#include "py/vmentrytable.h"
|
||||
#define DISPATCH() do { \
|
||||
#define ONE_TRUE_DISPATCH() one_true_dispatch: do { \
|
||||
TRACE(ip); \
|
||||
MARK_EXC_IP_GLOBAL(); \
|
||||
goto *(void*)((char*)&&entry_MP_BC_LOAD_CONST_FALSE + entry_table[*ip++]); \
|
||||
} while (0)
|
||||
#define DISPATCH() do { goto one_true_dispatch; } while(0)
|
||||
#define DISPATCH_WITH_PEND_EXC_CHECK() goto pending_exception_check
|
||||
#define ENTRY(op) entry_##op
|
||||
#define ENTRY_DEFAULT entry_default
|
||||
@ -199,7 +200,7 @@ outer_dispatch_loop:
|
||||
for (;;) {
|
||||
dispatch_loop:
|
||||
#if MICROPY_OPT_COMPUTED_GOTO
|
||||
DISPATCH();
|
||||
ONE_TRUE_DISPATCH();
|
||||
#else
|
||||
TRACE(ip);
|
||||
MARK_EXC_IP_GLOBAL();
|
||||
|
Loading…
Reference in New Issue
Block a user