diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-01-08 15:27:56 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-01-08 15:27:56 +0000 |
commit | adc0bf933e1232b43e01e79c8c676ba9420ab5ad (patch) | |
tree | d57c660f8d4030ca350cd0ac1f90b331b46cb756 /vm.c | |
parent | 52057336b7f425a9d336ff9909df3d57b39e8971 (diff) |
fix mark miss of Env (which is pointed by prev_ep).
* vm.c (rb_execution_context_mark): r61624 and r61659 introduce marking miss
bug for Env objects as a prev_ep which is contained by Proc objects because
Proc objects can be collected when they should be living and Env objects
will collected unexpectedly. This patch solves this problem.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm.c')
-rw-r--r-- | vm.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -2354,14 +2354,21 @@ rb_execution_context_mark(const rb_execution_context_t *ec) rb_gc_mark_values((long)(sp - p), p); while (cfp != limit_cfp) { -#if VM_CHECK_MODE > 0 const VALUE *ep = cfp->ep; +#if VM_CHECK_MODE > 0 VM_ASSERT(!!VM_ENV_FLAGS(ep, VM_ENV_FLAG_ESCAPED) == vm_ep_in_heap_p_(ec, ep)); #endif rb_gc_mark(cfp->self); rb_gc_mark((VALUE)cfp->iseq); rb_gc_mark((VALUE)cfp->block_code); + if (!VM_ENV_LOCAL_P(ep)) { + const VALUE *prev_ep = VM_ENV_PREV_EP(ep); + if (VM_ENV_ESCAPED_P(prev_ep)) { + rb_gc_mark(prev_ep[VM_ENV_DATA_INDEX_ENV]); + } + } + cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp); } } |