Skip to content

Commit

Permalink
YJIT: Remove old comments for regenerated branches (#7083)
Browse files Browse the repository at this point in the history
  • Loading branch information
k0kubun committed Jan 9, 2023
1 parent 9726736 commit a7fbdc3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
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) {

This comment has been minimized.

Copy link
@nobu

nobu Jan 10, 2023

Member

This line results in warnings: https://github.com/ruby/ruby/actions/runs/3875734714/jobs/6608680374#step:13:130

warning: unused variable: `start`
   --> ../src/yjit/src/asm/mod.rs:360:13
    |
360 |         let start = start_addr;
    |             ^^^^^ help: if this is intentional, prefix it with an underscore: `_start`
    |
    = note: `#[warn(unused_variables)]` on by default

warning: unused variable: `end_addr`
   --> ../src/yjit/src/asm/mod.rs:359:60
    |
359 |     pub fn remove_comments(&mut self, start_addr: CodePtr, end_addr: CodePtr) {
    |                                                            ^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_end_addr`

warning: 2 warnings emitted
#[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

0 comments on commit a7fbdc3

Please sign in to comment.