Skip to content

Commit

Permalink
Assert that the # of bytes matches for label refs (#316)
Browse files Browse the repository at this point in the history
  • Loading branch information
kddnewton authored and maximecb committed Jul 25, 2022
1 parent 6822d78 commit 49e1c38
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions yjit/src/asm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,10 @@ impl CodeBlock {

self.set_pos(ref_pos);
(label_ref.encode)(self, (ref_pos + label_ref.num_bytes) as i64, label_addr as i64);

// Assert that we've written the same number of bytes that we
// expected to have written.
assert!(self.write_pos == ref_pos + label_ref.num_bytes);
}

self.write_pos = orig_pos;
Expand Down

0 comments on commit 49e1c38

Please sign in to comment.