summaryrefslogtreecommitdiff
path: root/py/showbc.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/showbc.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/showbc.c')
-rw-r--r--py/showbc.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/py/showbc.c b/py/showbc.c
index 3deb18cd3..b9024b716 100644
--- a/py/showbc.c
+++ b/py/showbc.c
@@ -401,14 +401,9 @@ const byte *mp_bytecode_print_str(const byte *ip) {
printf("FOR_ITER " UINT_FMT, (mp_uint_t)(ip + unum - mp_showbc_code_start));
break;
- case MP_BC_POP_BLOCK:
- // pops block and restores the stack
- printf("POP_BLOCK");
- break;
-
- case MP_BC_POP_EXCEPT:
- // pops block, checks it's an exception block, and restores the stack, saving the 3 exception values to local threadstate
- printf("POP_EXCEPT");
+ case MP_BC_POP_EXCEPT_JUMP:
+ DECODE_ULABEL; // these labels are always forward
+ printf("POP_EXCEPT_JUMP " UINT_FMT, (mp_uint_t)(ip + unum - mp_showbc_code_start));
break;
case MP_BC_BUILD_TUPLE: