summaryrefslogtreecommitdiff
path: root/yjit.c
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2023-03-15 13:43:49 -0400
committerAlan Wu <XrXr@users.noreply.github.com>2023-03-15 15:45:20 -0400
commitde174681f7db3cc84ee8c55cafe89bb85a77e945 (patch)
tree98d3394c448380ee3180e97679de97de11ad9a3a /yjit.c
parentf613c18912f4bf5492a8dc02ab5e3661f4ae907c (diff)
YJIT: Assert that we have the VM lock while marking
Somewhat important because having the lock is a key part of the soundness reasoning for the `unsafe` usage here.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/7530
Diffstat (limited to 'yjit.c')
-rw-r--r--yjit.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/yjit.c b/yjit.c
index 5bb8a37e53..a9d1d2c38b 100644
--- a/yjit.c
+++ b/yjit.c
@@ -1100,6 +1100,14 @@ object_shape_count(rb_execution_context_t *ec, VALUE self)
return ULONG2NUM((unsigned long)GET_VM()->next_shape_id);
}
+// Assert that we have the VM lock. Relevant mostly for multi ractor situations.
+// The GC takes the lock before calling us, and this asserts that it indeed happens.
+void
+rb_yjit_assert_holding_vm_lock(void)
+{
+ ASSERT_vm_locking();
+}
+
// Primitives used by yjit.rb
VALUE rb_yjit_stats_enabled_p(rb_execution_context_t *ec, VALUE self);
VALUE rb_yjit_trace_exit_locations_enabled_p(rb_execution_context_t *ec, VALUE self);