Merge pull request #4690 from jepler/fix-vm-dispatch

py/vm.c: Restore lost bits of MICROPY_OPT_COMPUTED_GOTO_SAVE_SPACE
This commit is contained in:
Scott Shawcroft 2021-04-30 10:40:07 -07:00 committed by GitHub
commit 0573c17d70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

14
py/vm.c
View File

@ -127,11 +127,21 @@ mp_vm_return_kind_t PLACE_IN_ITCM(mp_execute_bytecode)(mp_code_state_t * code_st
#endif #endif
#if MICROPY_OPT_COMPUTED_GOTO #if MICROPY_OPT_COMPUTED_GOTO
#include "py/vmentrytable.h" #include "py/vmentrytable.h"
#if MICROPY_OPT_COMPUTED_GOTO_SAVE_SPACE
#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)
#else
#define ONE_TRUE_DISPATCH() DISPATCH()
#define DISPATCH() do { \ #define DISPATCH() do { \
TRACE(ip); \ TRACE(ip); \
MARK_EXC_IP_GLOBAL(); \ MARK_EXC_IP_GLOBAL(); \
goto *entry_table[*ip++]; \ goto *entry_table[*ip++]; \
} while (0) } while (0)
#endif
#define DISPATCH_WITH_PEND_EXC_CHECK() goto pending_exception_check #define DISPATCH_WITH_PEND_EXC_CHECK() goto pending_exception_check
#define ENTRY(op) entry_##op #define ENTRY(op) entry_##op
#define ENTRY_DEFAULT entry_default #define ENTRY_DEFAULT entry_default
@ -197,7 +207,7 @@ mp_vm_return_kind_t PLACE_IN_ITCM(mp_execute_bytecode)(mp_code_state_t * code_st
for (;;) { for (;;) {
dispatch_loop: dispatch_loop:
#if MICROPY_OPT_COMPUTED_GOTO #if MICROPY_OPT_COMPUTED_GOTO
DISPATCH(); ONE_TRUE_DISPATCH();
#else #else
TRACE(ip); TRACE(ip);
MARK_EXC_IP_GLOBAL(); MARK_EXC_IP_GLOBAL();