Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YJIT: Remove old comments for regenerated branches #7083

Merged
merged 1 commit into from Jan 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions yjit/src/asm/mod.rs
Expand Up @@ -356,6 +356,13 @@ impl CodeBlock {
self.asm_comments.get(&pos)
}

pub fn remove_comments(&mut self, start_addr: CodePtr, end_addr: CodePtr) {
#[cfg(feature = "disasm")]
for addr in start_addr.into_usize()..end_addr.into_usize() {
self.asm_comments.remove(&addr);
}
}

pub fn clear_comments(&mut self) {
#[cfg(feature = "disasm")]
self.asm_comments.clear();
Expand Down
5 changes: 5 additions & 0 deletions yjit/src/core.rs
Expand Up @@ -1609,6 +1609,11 @@ fn regenerate_branch(cb: &mut CodeBlock, branch: &mut Branch) {
}
*/

// Remove old comments
if let (Some(start_addr), Some(end_addr)) = (branch.start_addr, branch.end_addr) {
cb.remove_comments(start_addr, end_addr)
}

let mut block = branch.block.borrow_mut();
let branch_terminates_block = branch.end_addr == block.end_addr;

Expand Down