diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-10-10 21:22:54 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-10-10 21:22:54 +0000 |
commit | 0a40bcb20b27058f760ce855fc1860a540c49f43 (patch) | |
tree | 415dbfc1f9eb4fa0fe5469c894ea67c79342a6bf | |
parent | ad45aea45631a451ae0b4b4a5592468d0c4617c0 (diff) |
* vm_eval.c, internal.h (rb_yield_1): added for performance which
doesn't check Qundef.
* numeric.c (int_dotimes): use rb_yield_1.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | internal.h | 1 | ||||
-rw-r--r-- | numeric.c | 2 | ||||
-rw-r--r-- | vm_eval.c | 8 |
4 files changed, 16 insertions, 2 deletions
@@ -1,3 +1,10 @@ +Sun Oct 11 06:21:50 2015 Koichi Sasada <[email protected]> + + * 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 <[email protected]> * vm_insnhelper.c (vm_call_iseq_setup_normal): setup sp first diff --git a/internal.h b/internal.h index 00fbabbf93..232218634d 100644 --- a/internal.h +++ b/internal.h @@ -1192,6 +1192,7 @@ typedef void rb_check_funcall_hook(int, VALUE, ID, int, const VALUE *, VALUE); 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); @@ -3949,7 +3949,7 @@ int_dotimes(VALUE num) end = FIX2LONG(num); for (i=0; i<end; i++) { - rb_yield(LONG2FIX(i)); + rb_yield_1(LONG2FIX(i)); } } else { @@ -1000,13 +1000,19 @@ rb_yield_0(int argc, const VALUE * argv) } 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); } } |