ruby-changes:43533
From: naruse <ko1@a...>
Date: Fri, 8 Jul 2016 00:49:22 +0900 (JST)
Subject: [ruby-changes:43533] naruse:r55606 (trunk): * vm_eval.c (yield_under): change prototype to get argc/argv.
naruse 2016-07-08 00:49:17 +0900 (Fri, 08 Jul 2016) New Revision: 55606 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55606 Log: * vm_eval.c (yield_under): change prototype to get argc/argv. * vm_eval.c (specific_eval): change for above. * vm_eval.c (rb_obj_instance_exec): avoid object allocation. * vm_eval.c (rb_mod_module_exec): ditto. Modified files: trunk/ChangeLog trunk/vm_eval.c Index: ChangeLog =================================================================== --- ChangeLog (revision 55605) +++ ChangeLog (revision 55606) @@ -1,3 +1,13 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Fri Jul 8 00:47:36 2016 NARUSE, Yui <naruse@r...> + + * vm_eval.c (yield_under): change prototype to get argc/argv. + + * vm_eval.c (specific_eval): change for above. + + * vm_eval.c (rb_obj_instance_exec): avoid object allocation. + + * vm_eval.c (rb_mod_module_exec): ditto. + Thu Jul 7 20:08:37 2016 Shugo Maeda <shugo@r...> * vm_args.c (vm_caller_setup_arg_block): disable symbol block Index: vm_eval.c =================================================================== --- vm_eval.c (revision 55605) +++ vm_eval.c (revision 55606) @@ -1576,7 +1576,7 @@ rb_eval_cmd(VALUE cmd, VALUE arg, int le https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1576 /* block eval under the class/module context */ static VALUE -yield_under(VALUE under, VALUE self, VALUE values) +yield_under(VALUE under, VALUE self, int argc, const VALUE *argv) { rb_thread_t *th = GET_THREAD(); rb_block_t block, *blockptr; @@ -1589,12 +1589,7 @@ yield_under(VALUE under, VALUE self, VAL https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1589 } cref = vm_cref_push(th, under, blockptr, TRUE); - if (values == Qundef) { - return vm_yield_with_cref(th, 1, &self, cref); - } - else { - return vm_yield_with_cref(th, RARRAY_LENINT(values), RARRAY_CONST_PTR(values), cref); - } + return vm_yield_with_cref(th, argc, argv, cref); } VALUE @@ -1629,7 +1624,7 @@ specific_eval(int argc, const VALUE *arg https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1624 { if (rb_block_given_p()) { rb_check_arity(argc, 0, 0); - return yield_under(klass, self, Qundef); + return yield_under(klass, self, 1, &self); } else { VALUE file = Qundef; @@ -1725,7 +1720,7 @@ VALUE https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1720 rb_obj_instance_exec(int argc, const VALUE *argv, VALUE self) { VALUE klass = singleton_class_for_eval(self); - return yield_under(klass, self, rb_ary_new4(argc, argv)); + return yield_under(klass, self, argc, argv); } /* @@ -1786,7 +1781,7 @@ rb_mod_module_eval(int argc, const VALUE https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1781 VALUE rb_mod_module_exec(int argc, const VALUE *argv, VALUE mod) { - return yield_under(mod, mod, rb_ary_new4(argc, argv)); + return yield_under(mod, mod, argc, argv); } /* -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/