YJIT: code_gc(): Assert self is inline to avoid other_cb()
The derived `&mut` from `other_cb()` overlapped with the parameter `ocb`. Use `cfg!()` instead of `#[cfg...]` to avoid unused warnings.
This commit is contained in:
parent
cdededf24d
commit
a1a4d77472
Notes:
git
2023-03-29 18:54:17 +00:00
@ -154,8 +154,9 @@ impl CodeBlock {
|
||||
}
|
||||
|
||||
// Move the other CodeBlock to the same page if it's on the furthest page
|
||||
#[cfg(not(test))]
|
||||
self.other_cb().unwrap().set_page(next_page_idx.unwrap(), &jmp_ptr);
|
||||
if cfg!(not(test)) {
|
||||
self.other_cb().unwrap().set_page(next_page_idx.unwrap(), &jmp_ptr);
|
||||
}
|
||||
|
||||
return !self.dropped_bytes;
|
||||
}
|
||||
@ -584,6 +585,8 @@ impl CodeBlock {
|
||||
|
||||
/// Code GC. Free code pages that are not on stack and reuse them.
|
||||
pub fn code_gc(&mut self, ocb: &mut OutlinedCb) {
|
||||
assert!(self.inline(), "must use on inline code block");
|
||||
|
||||
// The previous code GC failed to free any pages. Give up.
|
||||
if self.freed_pages.as_ref() == &Some(vec![]) {
|
||||
return;
|
||||
@ -641,7 +644,7 @@ impl CodeBlock {
|
||||
// Track which pages are free.
|
||||
let new_freed_pages = Rc::new(Some(freed_pages));
|
||||
let old_freed_pages = mem::replace(&mut self.freed_pages, Rc::clone(&new_freed_pages));
|
||||
self.other_cb().unwrap().freed_pages = new_freed_pages;
|
||||
ocb.unwrap().freed_pages = new_freed_pages;
|
||||
assert_eq!(1, Rc::strong_count(&old_freed_pages)); // will deallocate
|
||||
|
||||
CodegenGlobals::incr_code_gc_count();
|
||||
|
Loading…
x
Reference in New Issue
Block a user