summaryrefslogtreecommitdiff
path: root/py/emitnative.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2018-05-22 21:50:22 +1000
committerDamien George <damien.p.george@gmail.com>2018-05-23 00:23:04 +1000
commit8a513da5a560e9c6afa5f0a0f8d44c5fb1ed552d (patch)
treed61f8574967d104436dea3a008b619730129a10a /py/emitnative.c
parent6211d979eed0a809cef03230e14b6d264f6f92ee (diff)
py/emit: Combine break_loop and continue_loop into one emit function.
Reduces code size by: bare-arm: +0 minimal x86: +0 unix x64: -80 unix nanbox: +0 stm32: -12 cc3200: +0 esp8266: -28 esp32: +0
Diffstat (limited to 'py/emitnative.c')
-rw-r--r--py/emitnative.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/py/emitnative.c b/py/emitnative.c
index 8624680a6..b4a3f987c 100644
--- a/py/emitnative.c
+++ b/py/emitnative.c
@@ -1560,16 +1560,11 @@ STATIC void emit_native_jump_if_or_pop(emit_t *emit, bool cond, mp_uint_t label)
emit_post(emit);
}
-STATIC void emit_native_break_loop(emit_t *emit, mp_uint_t label, mp_uint_t except_depth) {
+STATIC void emit_native_unwind_jump(emit_t *emit, mp_uint_t label, mp_uint_t except_depth) {
(void)except_depth;
emit_native_jump(emit, label & ~MP_EMIT_BREAK_FROM_FOR); // TODO properly
}
-STATIC void emit_native_continue_loop(emit_t *emit, mp_uint_t label, mp_uint_t except_depth) {
- (void)except_depth;
- emit_native_jump(emit, label); // TODO properly
-}
-
STATIC void emit_native_setup_with(emit_t *emit, mp_uint_t label) {
// the context manager is on the top of the stack
// stack: (..., ctx_mgr)
@@ -2248,8 +2243,7 @@ const emit_method_table_t EXPORT_FUN(method_table) = {
emit_native_jump,
emit_native_pop_jump_if,
emit_native_jump_if_or_pop,
- emit_native_break_loop,
- emit_native_continue_loop,
+ emit_native_unwind_jump,
emit_native_setup_with,
emit_native_with_cleanup,
emit_native_setup_except,