summaryrefslogtreecommitdiffstatshomepage
path: root/py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-04-27 18:19:06 +0100
committerDamien George <damien.p.george@gmail.com>2014-04-27 18:19:06 +0100
commitdb128919187d86962f7ba46ddb072c1dfe53eb7e (patch)
tree134fd655b4a0d13d7b2b71250589037780a0f1f3 /py
parent9d181f62dcfed780cf4b0e92c19d8024a02687f1 (diff)
downloadmicropython-db128919187d86962f7ba46ddb072c1dfe53eb7e.tar.gz
micropython-db128919187d86962f7ba46ddb072c1dfe53eb7e.zip
py: Eliminate 'op' variable in VM dispatch loop.
Remembering the last op is rarely needed, and when it is, can simply use *save_ip.
Diffstat (limited to 'py')
-rw-r--r--py/vm.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/py/vm.c b/py/vm.c
index 8b4c926def..9cf4696739 100644
--- a/py/vm.c
+++ b/py/vm.c
@@ -68,7 +68,7 @@ typedef enum {
#define PUSH_EXC_BLOCK() \
DECODE_ULABEL; /* except labels are always forward */ \
++exc_sp; \
- exc_sp->opcode = op; \
+ exc_sp->opcode = *save_ip; \
exc_sp->handler = ip + unum; \
exc_sp->val_sp = MP_TAGPTR_MAKE(sp, currently_in_except_block); \
exc_sp->prev_exc = MP_OBJ_NULL; \
@@ -200,8 +200,7 @@ mp_vm_return_kind_t mp_execute_byte_code_2(const byte *code_info, const byte **i
#define DISPATCH() do { \
TRACE(ip); \
save_ip = ip; \
- op = *ip++; \
- goto *entry_table[op]; \
+ goto *entry_table[*ip++]; \
} while(0)
#define ENTRY(op) entry_##op
#define ENTRY_DEFAULT entry_default
@@ -229,7 +228,6 @@ mp_vm_return_kind_t mp_execute_byte_code_2(const byte *code_info, const byte **i
outer_dispatch_loop:
if (nlr_push(&nlr) == 0) {
// local variables that are not visible to the exception handler
- byte op = 0;
const byte *ip = *ip_in_out;
mp_obj_t *sp = *sp_in_out;
machine_uint_t unum;
@@ -256,11 +254,8 @@ dispatch_loop:
#else
TRACE(ip);
save_ip = ip;
- op = *ip++;
-
- switch (op) {
+ switch (*ip++) {
#endif
- //printf("ip=%p sp=%p op=%u\n", save_ip, sp, op);
ENTRY(MP_BC_LOAD_CONST_FALSE):
PUSH(mp_const_false);