ruby-changes:63059
From: Koichi <ko1@a...>
Date: Thu, 24 Sep 2020 17:10:12 +0900 (JST)
Subject: [ruby-changes:63059] 4a588e70b8 (master): sync rb_gc_register_mark_object()
https://git.ruby-lang.org/ruby.git/commit/?id=4a588e70b8 From 4a588e70b88028b3121babc43a26de0d13bdbb03 Mon Sep 17 00:00:00 2001 From: Koichi Sasada <ko1@a...> Date: Thu, 24 Sep 2020 17:06:33 +0900 Subject: sync rb_gc_register_mark_object() rb_vm_t::mark_object_ary is global resource so we need to synchronize to access it. diff --git a/gc.c b/gc.c index d9c8731..fcb9c64 100644 --- a/gc.c +++ b/gc.c @@ -7347,15 +7347,19 @@ rb_gc_force_recycle(VALUE obj) https://github.com/ruby/ruby/blob/trunk/gc.c#L7347 void rb_gc_register_mark_object(VALUE obj) { - VALUE ary_ary = GET_VM()->mark_object_ary; - VALUE ary = rb_ary_last(0, 0, ary_ary); + RB_VM_LOCK_ENTER(); + { + VALUE ary_ary = GET_VM()->mark_object_ary; + VALUE ary = rb_ary_last(0, 0, ary_ary); - if (ary == Qnil || RARRAY_LEN(ary) >= MARK_OBJECT_ARY_BUCKET_SIZE) { - ary = rb_ary_tmp_new(MARK_OBJECT_ARY_BUCKET_SIZE); - rb_ary_push(ary_ary, ary); - } + if (ary == Qnil || RARRAY_LEN(ary) >= MARK_OBJECT_ARY_BUCKET_SIZE) { + ary = rb_ary_tmp_new(MARK_OBJECT_ARY_BUCKET_SIZE); + rb_ary_push(ary_ary, ary); + } - rb_ary_push(ary, obj); + rb_ary_push(ary, obj); + } + RB_VM_LOCK_LEAVE(); } void -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/