Skip to content

Commit

Permalink
YJIT: Avoid BorrowError on GC.compact (#7164)
Browse files Browse the repository at this point in the history
  • Loading branch information
k0kubun committed Jan 20, 2023
1 parent 4e03707 commit 887d216
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions yjit/src/core.rs
Expand Up @@ -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();

Expand All @@ -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() {
Expand Down

0 comments on commit 887d216

Please sign in to comment.