aboutsummaryrefslogtreecommitdiffstats
path: root/yjit/src/yjit.rs
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2023-03-28 17:21:40 -0400
committerAlan Wu <XrXr@users.noreply.github.com>2023-03-29 14:53:49 -0400
commit93b6997103b34750b2d84df07e09586fe1de0649 (patch)
tree14520ad62418b506c2509fd351e5760bdff249a8 /yjit/src/yjit.rs
parenta8c6ba23a6a95272edd6179737d4f98d7b2cdf6e (diff)
downloadruby-93b6997103b34750b2d84df07e09586fe1de0649.tar.gz
YJIT: Fix overlapping &mut in Assembler::code_gc()
Making overlapping `&mut`s triggers Undefined Bahavior. This function previously had them through `cb` and `ocb` aliasing with `self` or live references in the caller. To fix the overlap, take `ocb` as a parameter and don't use `get_inline_cb()` in the body of the function.
Diffstat (limited to 'yjit/src/yjit.rs')
-rw-r--r--yjit/src/yjit.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/yjit/src/yjit.rs b/yjit/src/yjit.rs
index 10bddcc600..d75b9db0ee 100644
--- a/yjit/src/yjit.rs
+++ b/yjit/src/yjit.rs
@@ -140,7 +140,8 @@ pub extern "C" fn rb_yjit_code_gc(_ec: EcPtr, _ruby_self: VALUE) -> VALUE {
}
let cb = CodegenGlobals::get_inline_cb();
- cb.code_gc();
+ let ocb = CodegenGlobals::get_outlined_cb();
+ cb.code_gc(ocb);
Qnil
}