summaryrefslogtreecommitdiff
path: root/py/vm.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2019-02-15 12:18:59 +1100
committerDamien George <damien.p.george@gmail.com>2019-03-05 16:09:58 +1100
commit5a2599d96299ad37cda954f1de345159f9acf11c (patch)
tree13e82197f7494090b98a72f85f5aec3425d7cfa3 /py/vm.c
parent6f9e3ff719917616f163d3d671d6abe9472ba6ff (diff)
py: Replace POP_BLOCK and POP_EXCEPT opcodes with POP_EXCEPT_JUMP.
POP_BLOCK and POP_EXCEPT are now the same, and are always followed by a JUMP. So this optimisation reduces code size, and RAM usage of bytecode by two bytes for each try-except handler.
Diffstat (limited to 'py/vm.c')
-rw-r--r--py/vm.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/py/vm.c b/py/vm.c
index a53b4a083..901a23f22 100644
--- a/py/vm.c
+++ b/py/vm.c
@@ -759,17 +759,13 @@ unwind_jump:;
}
// matched against: SETUP_EXCEPT, SETUP_FINALLY, SETUP_WITH
- ENTRY(MP_BC_POP_BLOCK):
- // we are exiting an exception handler, so pop the last one of the exception-stack
+ ENTRY(MP_BC_POP_EXCEPT_JUMP): {
assert(exc_sp >= exc_stack);
POP_EXC_BLOCK();
- DISPATCH();
-
- // matched against: SETUP_EXCEPT
- ENTRY(MP_BC_POP_EXCEPT):
- assert(exc_sp >= exc_stack);
- POP_EXC_BLOCK();
- DISPATCH();
+ DECODE_ULABEL;
+ ip += ulab;
+ DISPATCH_WITH_PEND_EXC_CHECK();
+ }
ENTRY(MP_BC_BUILD_TUPLE): {
MARK_EXC_IP_SELECTIVE();