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

ruby-changes:48644

From: nobu <ko1@a...>
Date: Tue, 14 Nov 2017 11:40:09 +0900 (JST)
Subject: [ruby-changes:48644] nobu:r60759 (trunk): compile.c: comments for concatstrings optimization [ci skip]

nobu	2017-11-14 11:40:04 +0900 (Tue, 14 Nov 2017)

  New Revision: 60759

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

  Log:
    compile.c: comments for concatstrings optimization [ci skip]

  Modified files:
    trunk/compile.c
Index: compile.c
===================================================================
--- compile.c	(revision 60758)
+++ compile.c	(revision 60759)
@@ -2614,6 +2614,12 @@ iseq_peephole_optimize(rb_iseq_t *iseq, https://github.com/ruby/ruby/blob/trunk/compile.c#L2614
 
     if (IS_INSN_ID(iobj, tostring)) {
 	LINK_ELEMENT *next = iobj->link.next;
+	/*
+	 *  tostring
+	 *  concatstrings 1
+	 * =>
+	 *  tostring
+	 */
 	if (IS_INSN(next) && IS_INSN_ID(next, concatstrings) &&
 	    OPERAND_AT(next, 0) == INT2FIX(1)) {
 	    REMOVE_ELEM(next);
@@ -2622,6 +2628,12 @@ iseq_peephole_optimize(rb_iseq_t *iseq, https://github.com/ruby/ruby/blob/trunk/compile.c#L2628
 
     if (IS_INSN_ID(iobj, putstring) ||
 	(IS_INSN_ID(iobj, putobject) && RB_TYPE_P(OPERAND_AT(iobj, 0), T_STRING))) {
+	/*
+	 *  putstring ""
+	 *  concatstrings N
+	 * =>
+	 *  concatstrings N-1
+	 */
 	if (IS_NEXT_INSN_ID(&iobj->link, concatstrings) &&
 	    RSTRING_LEN(OPERAND_AT(iobj, 0)) == 0) {
 	    INSN *next = (INSN *)iobj->link.next;
@@ -2633,6 +2645,12 @@ iseq_peephole_optimize(rb_iseq_t *iseq, https://github.com/ruby/ruby/blob/trunk/compile.c#L2645
     }
 
     if (IS_INSN_ID(iobj, concatstrings)) {
+	/*
+	 *  concatstrings N
+	 *  concatstrings M
+	 * =>
+	 *  concatstrings N+M-1
+	 */
 	LINK_ELEMENT *next = iobj->link.next, *freeze = 0;
 	INSN *jump = 0;
 	if (IS_INSN(next) && IS_INSN_ID(next, freezestring))

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

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