aboutsummaryrefslogtreecommitdiff
path: root/py/vm.c
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2022-03-21 16:36:13 +1100
committerDamien George <damien@micropython.org>2022-03-28 15:43:09 +1100
commit6d11c69983f8084459e5bb037d931d5e2d283c78 (patch)
tree326ba09cf5a38fba7c384e764e76bece924a2413 /py/vm.c
parentacd2c5c8349a4cd713b1b36c0e6ec6f39791ca19 (diff)
py: Change jump-if-x-or-pop opcodes to have unsigned offset argument.
These jumps are always forwards, and it's more efficient in the VM to decode an unsigned argument. These opcodes are already optimised versions of the sequence "dup-top pop-jump-if-x pop" so it doesn't hurt generality to optimise them further. Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'py/vm.c')
-rw-r--r--py/vm.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/py/vm.c b/py/vm.c
index 990009c00..50da90e7d 100644
--- a/py/vm.c
+++ b/py/vm.c
@@ -560,9 +560,9 @@ dispatch_loop:
}
ENTRY(MP_BC_JUMP_IF_TRUE_OR_POP): {
- DECODE_SLABEL;
+ DECODE_ULABEL;
if (mp_obj_is_true(TOP())) {
- ip += slab;
+ ip += ulab;
} else {
sp--;
}
@@ -570,11 +570,11 @@ dispatch_loop:
}
ENTRY(MP_BC_JUMP_IF_FALSE_OR_POP): {
- DECODE_SLABEL;
+ DECODE_ULABEL;
if (mp_obj_is_true(TOP())) {
sp--;
} else {
- ip += slab;
+ ip += ulab;
}
DISPATCH_WITH_PEND_EXC_CHECK();
}