ruby-changes:38027
From: nobu <ko1@a...>
Date: Sun, 29 Mar 2015 11:47:34 +0900 (JST)
Subject: [ruby-changes:38027] nobu:r50108 (trunk): vm.c: use MEMCPY
nobu 2015-03-29 11:47:24 +0900 (Sun, 29 Mar 2015) New Revision: 50108 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50108 Log: vm.c: use MEMCPY * vm.c (vm_make_env_each): use MEMCPY instead of copy by loop. Modified files: trunk/vm.c Index: vm.c =================================================================== --- vm.c (revision 50107) +++ vm.c (revision 50108) @@ -512,16 +512,17 @@ vm_make_env_each(const rb_thread_t *cons https://github.com/ruby/ruby/blob/trunk/vm.c#L512 env->env_size = local_size + 1 + 1; env->local_size = local_size; - for (i = 0; i <= local_size; i++) { - env->env[i] = envptr[-local_size + i]; + i = local_size + 1; + MEMCPY(env->env, envptr - local_size, VALUE, i); #if 0 + for (i = 0; i <= local_size; i++) { fprintf(stderr, "%2d ", &envptr[-local_size + i] - th->stack); dp(env->env[i]); if (RUBY_VM_NORMAL_ISEQ_P(cfp->iseq)) { /* clear value stack for GC */ envptr[-local_size + i] = 0; } -#endif } +#endif /* be careful not to trigger GC after this */ envval = TypedData_Wrap_Struct(rb_cEnv, &env_data_type, env); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/