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

ruby-changes:40025

From: ko1 <ko1@a...>
Date: Sun, 11 Oct 2015 06:23:07 +0900 (JST)
Subject: [ruby-changes:40025] ko1:r52106 (trunk): * vm_eval.c, internal.h (rb_yield_1): added for performance which

ko1	2015-10-11 06:22:54 +0900 (Sun, 11 Oct 2015)

  New Revision: 52106

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

  Log:
    * vm_eval.c, internal.h (rb_yield_1): added for performance which
      doesn't check Qundef.
    * numeric.c (int_dotimes): use rb_yield_1.

  Modified files:
    trunk/ChangeLog
    trunk/internal.h
    trunk/numeric.c
    trunk/vm_eval.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 52105)
+++ ChangeLog	(revision 52106)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun Oct 11 06:21:50 2015  Koichi Sasada  <ko1@a...>
+
+	* vm_eval.c, internal.h (rb_yield_1): added for performance which
+	  doesn't check Qundef.
+
+	* numeric.c (int_dotimes): use rb_yield_1.
+
 Sun Oct 11 06:19:49 2015  Koichi Sasada  <ko1@a...>
 
 	* vm_insnhelper.c (vm_call_iseq_setup_normal): setup sp first
Index: vm_eval.c
===================================================================
--- vm_eval.c	(revision 52105)
+++ vm_eval.c	(revision 52106)
@@ -1000,13 +1000,19 @@ rb_yield_0(int argc, const VALUE * argv) https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1000
 }
 
 VALUE
+rb_yield_1(VALUE val)
+{
+    return rb_yield_0(1, &val);
+}
+
+VALUE
 rb_yield(VALUE val)
 {
     if (val == Qundef) {
 	return rb_yield_0(0, 0);
     }
     else {
-	return rb_yield_0(1, &val);
+	return rb_yield_1(val);
     }
 }
 
Index: numeric.c
===================================================================
--- numeric.c	(revision 52105)
+++ numeric.c	(revision 52106)
@@ -3949,7 +3949,7 @@ int_dotimes(VALUE num) https://github.com/ruby/ruby/blob/trunk/numeric.c#L3949
 
 	end = FIX2LONG(num);
 	for (i=0; i<end; i++) {
-	    rb_yield(LONG2FIX(i));
+	    rb_yield_1(LONG2FIX(i));
 	}
     }
     else {
Index: internal.h
===================================================================
--- internal.h	(revision 52105)
+++ internal.h	(revision 52106)
@@ -1192,6 +1192,7 @@ typedef void rb_check_funcall_hook(int, https://github.com/ruby/ruby/blob/trunk/internal.h#L1192
 VALUE rb_check_funcall_with_hook(VALUE recv, ID mid, int argc, const VALUE *argv,
 				 rb_check_funcall_hook *hook, VALUE arg);
 VALUE rb_catch_protect(VALUE t, rb_block_call_func *func, VALUE data, int *stateptr);
+VALUE rb_yield_1(VALUE val);
 
 /* vm_insnhelper.c */
 VALUE rb_equal_opt(VALUE obj1, VALUE obj2);

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

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