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

ruby-changes:63892

From: Koichi <ko1@a...>
Date: Fri, 4 Dec 2020 15:01:12 +0900 (JST)
Subject: [ruby-changes:63892] e8cee4915b (master): fix initialize order

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

From e8cee4915b280dab57ca4f916f36bea4eb7ebdf1 Mon Sep 17 00:00:00 2001
From: Koichi Sasada <ko1@a...>
Date: Fri, 4 Dec 2020 14:59:12 +0900
Subject: fix initialize order

`captured->code.val` should be initialize before because it can be
a GC point by another ractor because `RB_OBJ_WRITE` can issue
VM locking.

diff --git a/vm.c b/vm.c
index bc3ec98..bdca822 100644
--- a/vm.c
+++ b/vm.c
@@ -905,8 +905,8 @@ vm_proc_create_from_captured(VALUE klass, https://github.com/ruby/ruby/blob/trunk/vm.c#L905
     VM_ASSERT(VM_EP_IN_HEAP_P(GET_EC(), captured->ep));
 
     /* copy block */
-    RB_OBJ_WRITE(procval, &proc->block.as.captured.self, captured->self);
     RB_OBJ_WRITE(procval, &proc->block.as.captured.code.val, captured->code.val);
+    RB_OBJ_WRITE(procval, &proc->block.as.captured.self, captured->self);
     rb_vm_block_ep_update(procval, &proc->block, captured->ep);
 
     vm_block_type_set(&proc->block, block_type);
-- 
cgit v0.10.2


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

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