summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2022-04-08 12:29:02 +0900
committerKoichi Sasada <ko1@atdot.net>2022-04-08 13:31:28 +0900
commit798e21637f28d308bf0d52081fedd1a49cd1f851 (patch)
tree757fca18c216c8d020f1d119e4dd0731fd4e60a8
parent9ca3d537b9dffba416bd37dfb25466f2cebc8510 (diff)
sync `vm->constant_cache`
On multi-ractors, `vm->constant_cache` (and so on) can be accessed in parallel so we need to synchronize the accesses to them. http://rubyci.s3.amazonaws.com/centos7/ruby-master/log/20220407T213003Z.log.html.gz#btest
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/5779
-rw-r--r--vm_insnhelper.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index f56e01d7f7..87aaeefa7e 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -4963,7 +4963,12 @@ static void
vm_ic_compile(rb_control_frame_t *cfp, IC ic)
{
const rb_iseq_t *iseq = cfp->iseq;
- rb_iseq_each(iseq, cfp->pc - ISEQ_BODY(iseq)->iseq_encoded, vm_ic_compile_i, (void *) ic);
+
+ RB_VM_LOCK_ENTER();
+ {
+ rb_iseq_each(iseq, cfp->pc - ISEQ_BODY(iseq)->iseq_encoded, vm_ic_compile_i, (void *) ic);
+ }
+ RB_VM_LOCK_LEAVE();
}
// For MJIT inlining