ruby-changes:49576
From: ko1 <ko1@a...>
Date: Tue, 9 Jan 2018 00:28:01 +0900 (JST)
Subject: [ruby-changes:49576] ko1:r61691 (trunk): fix mark miss of Env (which is pointed by prev_ep).
ko1 2018-01-09 00:27:56 +0900 (Tue, 09 Jan 2018) New Revision: 61691 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61691 Log: 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. Modified files: trunk/vm.c Index: vm.c =================================================================== --- vm.c (revision 61690) +++ vm.c (revision 61691) @@ -2354,14 +2354,21 @@ rb_execution_context_mark(const rb_execu https://github.com/ruby/ruby/blob/trunk/vm.c#L2354 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); } } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/