YJIT: Remove old comments for regenerated branches (#7083)

This commit is contained in:
Takashi Kokubun 2023-01-09 08:29:41 -08:00 committed by GitHub
parent 9726736006
commit a7fbdc35a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
Notes: git 2023-01-09 16:30:06 +00:00
Merged-By: maximecb <maximecb@ruby-lang.org>
2 changed files with 12 additions and 0 deletions

View File

@ -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();

View File

@ -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;