1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

vm.c: use MEMCPY

* vm.c (vm_make_env_each): use MEMCPY instead of copy by loop.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50108 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-03-29 02:47:24 +00:00
parent 2303483dde
commit 485d04253f

7
vm.c
View file

@ -512,16 +512,17 @@ vm_make_env_each(const rb_thread_t *const th, rb_control_frame_t *const cfp,
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);