[前][次][番号順一覧][スレッド一覧]

ruby-changes:56834

From: Aaron <ko1@a...>
Date: Tue, 6 Aug 2019 05:32:24 +0900 (JST)
Subject: [ruby-changes:56834] Aaron Patterson: 81252c5ccd (master): Let prev EP move again

https://git.ruby-lang.org/ruby.git/commit/?id=81252c5ccd

From 81252c5ccd15295155a8fe30b0b56117ba7c79e7 Mon Sep 17 00:00:00 2001
From: Aaron Patterson <tenderlove@r...>
Date: Mon, 5 Aug 2019 11:32:42 -0700
Subject: Let prev EP move again

The last time we committed this, we were asking the VM to write to the
ep.  But VM assertions check if the ENV data is the correct type, which
if it's a T_MOVED pointer it's not the correct type.  So the vm
assertions would fail.  This time we just directly write to it from the
GC and that bypasses the vm assertion checks.

diff --git a/gc.c b/gc.c
index 7bbc125..eacc609 100644
--- a/gc.c
+++ b/gc.c
@@ -5028,7 +5028,7 @@ gc_mark_imemo(rb_objspace_t *objspace, VALUE obj) https://github.com/ruby/ruby/blob/trunk/gc.c#L5028
 	    GC_ASSERT(VM_ENV_ESCAPED_P(env->ep));
             gc_mark_values(objspace, (long)env->env_size, env->env);
 	    VM_ENV_FLAGS_SET(env->ep, VM_ENV_FLAG_WB_REQUIRED);
-            gc_mark_and_pin(objspace, (VALUE)rb_vm_env_prev_env(env));
+            gc_mark(objspace, (VALUE)rb_vm_env_prev_env(env));
 	    gc_mark(objspace, (VALUE)env->iseq);
 	}
 	return;
@@ -7867,10 +7867,10 @@ gc_ref_update_imemo(rb_objspace_t *objspace, VALUE obj) https://github.com/ruby/ruby/blob/trunk/gc.c#L7867
         {
             rb_env_t *env = (rb_env_t *)obj;
             TYPED_UPDATE_IF_MOVED(objspace, rb_iseq_t *, env->iseq);
+            UPDATE_IF_MOVED(objspace, env->ep[VM_ENV_DATA_INDEX_ENV]);
             gc_update_values(objspace, (long)env->env_size, (VALUE *)env->env);
         }
         break;
-        break;
       case imemo_cref:
         UPDATE_IF_MOVED(objspace, RANY(obj)->as.imemo.cref.klass);
         TYPED_UPDATE_IF_MOVED(objspace, struct rb_cref_struct *, RANY(obj)->as.imemo.cref.next);
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]