ruby-changes:32402
From: glass <ko1@a...>
Date: Thu, 2 Jan 2014 01:40:17 +0900 (JST)
Subject: [ruby-changes:32402] glass:r44481 (trunk): * vm_eval.c (method_missing): use ALLOCV_N() instead of
glass 2014-01-02 01:40:11 +0900 (Thu, 02 Jan 2014) New Revision: 44481 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44481 Log: * vm_eval.c (method_missing): use ALLOCV_N() instead of ALLOCA_N() and rb_ary_tmp_new(). Modified files: trunk/ChangeLog trunk/vm_eval.c Index: ChangeLog =================================================================== --- ChangeLog (revision 44480) +++ ChangeLog (revision 44481) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Thu Jan 2 01:23:30 2014 Masaki Matsushita <glass.saga@g...> + + * vm_eval.c (method_missing): use ALLOCV_N() instead of + ALLOCA_N() and rb_ary_tmp_new(). + Thu Jan 2 00:53:16 2014 Masaki Matsushita <glass.saga@g...> * array.c (rb_ary_zip): use ALLOCV_N() instead of ALLOCA_N(). Index: vm_eval.c =================================================================== --- vm_eval.c (revision 44480) +++ vm_eval.c (revision 44481) @@ -695,7 +695,7 @@ raise_method_missing(rb_thread_t *th, in https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L695 static inline VALUE method_missing(VALUE obj, ID id, int argc, const VALUE *argv, int call_status) { - VALUE *nargv, result, argv_ary = 0; + VALUE *nargv, result, work; rb_thread_t *th = GET_THREAD(); const rb_block_t *blockptr = th->passed_block; @@ -706,23 +706,16 @@ method_missing(VALUE obj, ID id, int arg https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L706 raise_method_missing(th, argc, argv, obj, call_status | NOEX_MISSING); } - if (argc < 0x100) { - nargv = ALLOCA_N(VALUE, argc + 1); - } - else { - argv_ary = rb_ary_tmp_new(argc + 1); - nargv = RARRAY_PTR(argv_ary); - } + nargv = ALLOCV_N(VALUE, work, argc + 1); nargv[0] = ID2SYM(id); MEMCPY(nargv + 1, argv, VALUE, argc); - if (argv_ary) rb_ary_set_len(argv_ary, argc + 1); if (rb_method_basic_definition_p(CLASS_OF(obj) , idMethodMissing)) { raise_method_missing(th, argc+1, nargv, obj, call_status | NOEX_MISSING); } th->passed_block = blockptr; result = rb_funcall2(obj, idMethodMissing, argc + 1, nargv); - if (argv_ary) rb_ary_clear(argv_ary); + if (work) ALLOCV_END(work); return result; } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/