summaryrefslogtreecommitdiff
path: root/vm.c
diff options
context:
space:
mode:
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/vm.c b/vm.c
index 74fa78be9d..4b6e0c7225 100644
--- a/vm.c
+++ b/vm.c
@@ -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);