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

ruby-changes:42659

From: nobu <ko1@a...>
Date: Sat, 23 Apr 2016 22:15:49 +0900 (JST)
Subject: [ruby-changes:42659] nobu:r54733 (trunk): compile.c: remove redundant trace insn

nobu	2016-04-23 23:12:27 +0900 (Sat, 23 Apr 2016)

  New Revision: 54733

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

  Log:
    compile.c: remove redundant trace insn
    
    * compile.c (iseq_peephole_optimize): remove successive line trace
      instructions except for the last.

  Modified files:
    trunk/compile.c
Index: compile.c
===================================================================
--- compile.c	(revision 54732)
+++ compile.c	(revision 54733)
@@ -2279,6 +2279,17 @@ iseq_peephole_optimize(rb_iseq_t *iseq, https://github.com/ruby/ruby/blob/trunk/compile.c#L2279
 	    }
 	}
     }
+
+    #define IS_TRACE_LINE(insn) \
+	(IS_INSN_ID(insn, trace) && \
+	 OPERAND_AT(insn, 0) == INT2FIX(RUBY_EVENT_LINE))
+    if (IS_TRACE_LINE(iobj) && iobj->link.prev && IS_INSN(iobj->link.prev)) {
+	INSN *piobj = (INSN *)iobj->link.prev;
+	if (IS_TRACE_LINE(piobj)) {
+	    REMOVE_ELEM(iobj->link.prev);
+	}
+    }
+
     return COMPILE_OK;
 }
 

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

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