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
This commit is contained in:
nobu 2018-01-04 00:26:51 +00:00
parent aee02268bd
commit 9b842fd0b5

View File

@ -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);