aboutsummaryrefslogtreecommitdiff
path: root/py/emit.h
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/emit.h
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/emit.h')
-rw-r--r--py/emit.h6
1 files changed, 2 insertions, 4 deletions
diff --git a/py/emit.h b/py/emit.h
index 3c42bdf14..34c6cfd84 100644
--- a/py/emit.h
+++ b/py/emit.h
@@ -134,8 +134,7 @@ typedef struct _emit_method_table_t {
void (*get_iter)(emit_t *emit, bool use_stack);
void (*for_iter)(emit_t *emit, mp_uint_t label);
void (*for_iter_end)(emit_t *emit);
- void (*pop_block)(emit_t *emit);
- void (*pop_except)(emit_t *emit);
+ void (*pop_except_jump)(emit_t *emit, mp_uint_t label, bool within_exc_handler);
void (*unary_op)(emit_t *emit, mp_unary_op_t op);
void (*binary_op)(emit_t *emit, mp_binary_op_t op);
void (*build)(emit_t *emit, mp_uint_t n_args, int kind);
@@ -232,8 +231,7 @@ void mp_emit_bc_end_finally(emit_t *emit);
void mp_emit_bc_get_iter(emit_t *emit, bool use_stack);
void mp_emit_bc_for_iter(emit_t *emit, mp_uint_t label);
void mp_emit_bc_for_iter_end(emit_t *emit);
-void mp_emit_bc_pop_block(emit_t *emit);
-void mp_emit_bc_pop_except(emit_t *emit);
+void mp_emit_bc_pop_except_jump(emit_t *emit, mp_uint_t label, bool within_exc_handler);
void mp_emit_bc_unary_op(emit_t *emit, mp_unary_op_t op);
void mp_emit_bc_binary_op(emit_t *emit, mp_binary_op_t op);
void mp_emit_bc_build(emit_t *emit, mp_uint_t n_args, int kind);