summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2021-03-31 12:50:16 -0400
committerAlan Wu <XrXr@users.noreply.github.com>2021-10-20 18:19:32 -0400
commit9911f486a7d9902a900f91cfa607e8cacdda6494 (patch)
treee67141ad79dbb16eaa3cba827e6f5fafbb6c343f
parent784ef4cbbd563053bfc77b3e367f1c74bc89ab37 (diff)
Stop all other ractors when patching machine code
-rw-r--r--yjit_core.c6
1 files changed, 5 insertions, 1 deletions
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
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)
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);