From 9b842fd0b595c69faea74af182816547f6131ee0 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 4 Jan 2018 00:26:51 +0000 Subject: compile.c: next label * compile.c (compile_next): label for jump to the end of block is removable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61587 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- compile.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'compile.c') diff --git a/compile.c b/compile.c index 0d6ffaaa62..e256abae27 100644 --- a/compile.c +++ b/compile.c @@ -321,8 +321,8 @@ static void iseq_add_setlocal(rb_iseq_t *iseq, LINK_ANCHOR *const seq, int line, (VALUE)(ls) | 1, (VALUE)(le) | 1, \ (VALUE)(iseqv), (VALUE)(lc) | 1); \ LABEL_UNREMOVABLE(ls); \ - LABEL_UNREMOVABLE(le); \ - LABEL_UNREMOVABLE(lc); \ + LABEL_REF(le); \ + LABEL_REF(lc); \ rb_ary_push(ISEQ_COMPILE_DATA(iseq)->catch_table_ary, freeze_hide_obj(_e)); \ } while (0) @@ -2327,7 +2327,10 @@ remove_unreachable_chunk(rb_iseq_t *iseq, LINK_ELEMENT *i) else if (IS_TRACE(i)) { /* do nothing */ } - else return 0; + else if (IS_ADJUST(i)) { + LABEL *dest = ((ADJUST *)i)->label; + if (dest && dest->unremovable) return 0; + } i = i->next; } end = i; @@ -5067,6 +5070,7 @@ compile_next(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, in add_ensure_iseq(ret, iseq, 0); ADD_INSNL(ret, line, jump, ISEQ_COMPILE_DATA(iseq)->end_label); ADD_ADJUST_RESTORE(ret, splabel); + splabel->unremovable = FALSE; if (!popped) { ADD_INSN(ret, line, putnil); -- cgit v1.2.3