* 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
This commit is contained in:
ko1 2015-10-10 21:22:54 +00:00
parent ad45aea456
commit 0a40bcb20b
4 changed files with 16 additions and 2 deletions

View File

@ -1,3 +1,10 @@
Sun Oct 11 06:21:50 2015 Koichi Sasada <ko1@atdot.net>
* 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@atdot.net>
* vm_insnhelper.c (vm_call_iseq_setup_normal): setup sp first

View File

@ -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);

View File

@ -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 {

View File

@ -999,6 +999,12 @@ rb_yield_0(int argc, const VALUE * argv)
return vm_yield(GET_THREAD(), argc, argv);
}
VALUE
rb_yield_1(VALUE val)
{
return rb_yield_0(1, &val);
}
VALUE
rb_yield(VALUE val)
{
@ -1006,7 +1012,7 @@ rb_yield(VALUE val)
return rb_yield_0(0, 0);
}
else {
return rb_yield_0(1, &val);
return rb_yield_1(val);
}
}