diff options
author | Takashi Kokubun <takashikkbn@gmail.com> | 2023-01-20 13:07:03 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-20 13:07:03 -0800 |
commit | 887d21613cb62f7e964474131dcdf73034f879af (patch) | |
tree | 3a092596e82b2cf8b9c57a7637470a2023620e17 /yjit | |
parent | 4e037075ae7bd858ee59833a39bb61a5bfefa98c (diff) | |
download | ruby-887d21613cb62f7e964474131dcdf73034f879af.tar.gz |
YJIT: Avoid BorrowError on GC.compact (#7164)
Diffstat (limited to 'yjit')
-rw-r--r-- | yjit/src/core.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/yjit/src/core.rs b/yjit/src/core.rs index 15b8fe4466..5f8be84d3c 100644 --- a/yjit/src/core.rs +++ b/yjit/src/core.rs @@ -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() { |