aboutsummaryrefslogtreecommitdiffstats
path: root/vm.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-08 15:27:56 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-08 15:27:56 +0000
commitbb70b640cb0b11e2f6af6f0d61ce117ab1451a8e (patch)
treed57c660f8d4030ca350cd0ac1f90b331b46cb756 /vm.c
parent085356631d479f3fbe6c334bc6d3332ef9c19485 (diff)
downloadruby-bb70b640cb0b11e2f6af6f0d61ce117ab1451a8e.tar.gz
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.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/vm.c b/vm.c
index ae002c4721..60647605a6 100644
--- a/vm.c
+++ b/vm.c
@@ -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);
}
}