From cdededf24dff06842fe8401af93cf6d8c304de13 Mon Sep 17 00:00:00 2001 From: Alan Wu Date: Tue, 28 Mar 2023 17:38:06 -0400 Subject: YJIT: Take VM lock in RubyVM::YJIT.code_gc Code GC needs synchronization. --- yjit/src/yjit.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/yjit/src/yjit.rs b/yjit/src/yjit.rs index d75b9db0ee..3201af6982 100644 --- a/yjit/src/yjit.rs +++ b/yjit/src/yjit.rs @@ -139,9 +139,12 @@ pub extern "C" fn rb_yjit_code_gc(_ec: EcPtr, _ruby_self: VALUE) -> VALUE { return Qnil; } - let cb = CodegenGlobals::get_inline_cb(); - let ocb = CodegenGlobals::get_outlined_cb(); - cb.code_gc(ocb); + with_vm_lock(src_loc!(), || { + let cb = CodegenGlobals::get_inline_cb(); + let ocb = CodegenGlobals::get_outlined_cb(); + cb.code_gc(ocb); + }); + Qnil } -- cgit v1.2.3