From de174681f7db3cc84ee8c55cafe89bb85a77e945 Mon Sep 17 00:00:00 2001 From: Alan Wu Date: Wed, 15 Mar 2023 13:43:49 -0400 Subject: 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. --- yjit.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'yjit.c') 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); -- cgit v1.2.1