mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
52057336b7
commit
adc0bf933e
1 changed files with 8 additions and 1 deletions
9
vm.c
9
vm.c
|
@ -2354,14 +2354,21 @@ rb_execution_context_mark(const rb_execution_context_t *ec)
|
||||||
rb_gc_mark_values((long)(sp - p), p);
|
rb_gc_mark_values((long)(sp - p), p);
|
||||||
|
|
||||||
while (cfp != limit_cfp) {
|
while (cfp != limit_cfp) {
|
||||||
#if VM_CHECK_MODE > 0
|
|
||||||
const VALUE *ep = cfp->ep;
|
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));
|
VM_ASSERT(!!VM_ENV_FLAGS(ep, VM_ENV_FLAG_ESCAPED) == vm_ep_in_heap_p_(ec, ep));
|
||||||
#endif
|
#endif
|
||||||
rb_gc_mark(cfp->self);
|
rb_gc_mark(cfp->self);
|
||||||
rb_gc_mark((VALUE)cfp->iseq);
|
rb_gc_mark((VALUE)cfp->iseq);
|
||||||
rb_gc_mark((VALUE)cfp->block_code);
|
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);
|
cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue