YJIT: Avoid BorrowError on GC.compact (#7164)

This commit is contained in:
Takashi Kokubun 2023-01-20 13:07:03 -08:00 committed by GitHub
parent 4e037075ae
commit 887d21613c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
Notes: git 2023-01-20 21:07:23 +00:00
Merged-By: k0kubun <takashikkbn@gmail.com>

View File

@ -746,8 +746,8 @@ pub extern "C" fn rb_yjit_iseq_update_references(payload: *mut c_void) {
let cb = CodegenGlobals::get_inline_cb();
for versions in &payload.version_map {
for block in versions {
let mut block = block.borrow_mut();
for version in versions {
let mut block = version.borrow_mut();
block.blockid.iseq = unsafe { rb_gc_location(block.blockid.iseq.into()) }.as_iseq();
@ -757,6 +757,8 @@ pub extern "C" fn rb_yjit_iseq_update_references(payload: *mut c_void) {
}
// Update outgoing branch entries
mem::drop(block); // end mut borrow: target.get_blockid() might borrow it
let block = version.borrow();
for branch in &block.outgoing {
let mut branch = branch.borrow_mut();
for target in branch.targets.iter_mut().flatten() {