ruby-changes:55983
From: Aaron <ko1@a...>
Date: Tue, 4 Jun 2019 05:39:26 +0900 (JST)
Subject: [ruby-changes:55983] Aaron Patterson: 2de3d92844 (trunk): allow objects in imemo envs to move
https://git.ruby-lang.org/ruby.git/commit/?id=2de3d92844 From 2de3d92844058511debef2815a0402f892a5536a Mon Sep 17 00:00:00 2001 From: Aaron Patterson <tenderlove@r...> Date: Thu, 30 May 2019 14:50:43 -0700 Subject: allow objects in imemo envs to move diff --git a/gc.c b/gc.c index 1b21845..bb07d3f 100644 --- a/gc.c +++ b/gc.c @@ -4439,20 +4439,24 @@ rb_gc_mark_locations(const VALUE *start, const VALUE *end) https://github.com/ruby/ruby/blob/trunk/gc.c#L4439 } static void -gc_mark_and_pin_values(rb_objspace_t *objspace, long n, const VALUE *values) +gc_mark_values(rb_objspace_t *objspace, long n, const VALUE *values) { long i; for (i=0; i<n; i++) { - gc_mark_and_pin(objspace, values[i]); + gc_mark(objspace, values[i]); } } void rb_gc_mark_values(long n, const VALUE *values) { + long i; rb_objspace_t *objspace = &rb_objspace; - gc_mark_and_pin_values(objspace, n, values); + + for (i=0; i<n; i++) { + gc_mark_and_pin(objspace, values[i]); + } } static void @@ -4962,7 +4966,7 @@ gc_mark_imemo(rb_objspace_t *objspace, VALUE obj) https://github.com/ruby/ruby/blob/trunk/gc.c#L4966 { const rb_env_t *env = (const rb_env_t *)obj; GC_ASSERT(VM_ENV_ESCAPED_P(env->ep)); - gc_mark_and_pin_values(objspace, (long)env->env_size, env->env); + 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)env->iseq); @@ -7794,6 +7798,16 @@ gc_ref_update_method_entry(rb_objspace_t *objspace, rb_method_entry_t *me) https://github.com/ruby/ruby/blob/trunk/gc.c#L7798 } static void +gc_update_values(rb_objspace_t *objspace, long n, VALUE *values) +{ + long i; + + for (i=0; i<n; i++) { + UPDATE_IF_MOVED(objspace, values[i]); + } +} + +static void gc_ref_update_imemo(rb_objspace_t *objspace, VALUE obj) { switch(imemo_type(obj)) { @@ -7801,6 +7815,7 @@ gc_ref_update_imemo(rb_objspace_t *objspace, VALUE obj) https://github.com/ruby/ruby/blob/trunk/gc.c#L7815 { rb_env_t *env = (rb_env_t *)obj; TYPED_UPDATE_IF_MOVED(objspace, rb_iseq_t *, env->iseq); + gc_update_values(objspace, (long)env->env_size, (VALUE *)env->env); } break; break; -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/