[前][次][番号順一覧][スレッド一覧]

ruby-changes:49471

From: nobu <ko1@a...>
Date: Thu, 4 Jan 2018 09:26:56 +0900 (JST)
Subject: [ruby-changes:49471] nobu:r61587 (trunk): compile.c: next label

nobu	2018-01-04 09:26:51 +0900 (Thu, 04 Jan 2018)

  New Revision: 61587

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61587

  Log:
    compile.c: next label
    
    * compile.c (compile_next): label for jump to the end of block is
      removable.

  Modified files:
    trunk/compile.c
Index: compile.c
===================================================================
--- compile.c	(revision 61586)
+++ compile.c	(revision 61587)
@@ -321,8 +321,8 @@ static void iseq_add_setlocal(rb_iseq_t https://github.com/ruby/ruby/blob/trunk/compile.c#L321
 			   (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 https://github.com/ruby/ruby/blob/trunk/compile.c#L2327
 	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_ANCHO https://github.com/ruby/ruby/blob/trunk/compile.c#L5070
 	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);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]