summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-04 00:26:51 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-04 00:26:51 +0000
commit9b842fd0b595c69faea74af182816547f6131ee0 (patch)
tree0f657dc7afc1f6912ec9f753cb3e9c37b292e593 /compile.c
parentaee02268bde1f2ec13eec74fe0843cf174824107 (diff)
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
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c10
1 files changed, 7 insertions, 3 deletions
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);