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

ruby-changes:49921

From: nobu <ko1@a...>
Date: Thu, 25 Jan 2018 21:00:07 +0900 (JST)
Subject: [ruby-changes:49921] nobu:r62039 (trunk): compile.c: unnecessary freezing

nobu	2018-01-25 21:00:00 +0900 (Thu, 25 Jan 2018)

  New Revision: 62039

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

  Log:
    compile.c: unnecessary freezing
    
    * compile.c (iseq_peephole_optimize): get rid of freezing
      dynamically created string to be duplicated immediately.

  Modified files:
    trunk/compile.c
Index: compile.c
===================================================================
--- compile.c	(revision 62038)
+++ compile.c	(revision 62039)
@@ -2832,6 +2832,22 @@ iseq_peephole_optimize(rb_iseq_t *iseq, https://github.com/ruby/ruby/blob/trunk/compile.c#L2832
 	}
     }
 
+    if (IS_INSN_ID(iobj, freezestring) &&
+	IS_NEXT_INSN_ID(&iobj->link, send)) {
+	INSN *niobj = (INSN *)iobj->link.next;
+	struct rb_call_info *ci = (struct rb_call_info *)OPERAND_AT(niobj, 0);
+	/*
+	 *  freezestring debug_info
+	 *  send <:+@, 0, ARG_SIMPLE>
+	 * =>
+	 *  send <:+@, 0, ARG_SIMPLE>
+	 */
+	if ((ci->flag & VM_CALL_ARGS_SIMPLE) && ci->orig_argc == 0) {
+	    ELEM_REMOVE(list);
+	    return COMPILE_OK;
+	}
+    }
+
     if (do_tailcallopt &&
 	(IS_INSN_ID(iobj, send) ||
 	 IS_INSN_ID(iobj, opt_aref_with) ||

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

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