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

ruby-changes:68876

From: Alan <ko1@a...>
Date: Thu, 21 Oct 2021 08:15:00 +0900 (JST)
Subject: [ruby-changes:68876] 9911f486a7 (master): Stop all other ractors when patching machine code

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

From 9911f486a7d9902a900f91cfa607e8cacdda6494 Mon Sep 17 00:00:00 2001
From: Alan Wu <XrXr@u...>
Date: Wed, 31 Mar 2021 12:50:16 -0400
Subject: Stop all other ractors when patching machine code

---
 yjit_core.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/yjit_core.c b/yjit_core.c
index fbdc5f1c72..4d710b7499 100644
--- a/yjit_core.c
+++ b/yjit_core.c
@@ -353,7 +353,8 @@ branch_stub_hit(uint32_t branch_idx, uint32_t target_idx, rb_execution_context_t https://github.com/ruby/ruby/blob/trunk/yjit_core.c#L353
     uint8_t* dst_addr;
 
     RB_VM_LOCK_ENTER();
-
+    rb_vm_barrier(); // Stop other ractors since we are going to patch machine code.
+                     // It's how the GC does it.
 
     RUBY_ASSERT(branch_idx < num_branches);
     RUBY_ASSERT(target_idx < 2);
@@ -693,6 +694,9 @@ block_array_remove(rb_yjit_block_array_t block_array, block_t *block) https://github.com/ruby/ruby/blob/trunk/yjit_core.c#L694
 void
 invalidate_block_version(block_t* block)
 {
+    ASSERT_vm_locking();
+    rb_vm_barrier(); // Stop other ractors since we are going to patch machine code.
+
     const rb_iseq_t *iseq = block->blockid.iseq;
 
     // fprintf(stderr, "invalidating block (%p, %d)\n", block->blockid.iseq, block->blockid.idx);
-- 
cgit v1.2.1


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

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