diff options
author | Kevin Newton <kddnewton@gmail.com> | 2022-07-14 10:35:09 -0400 |
---|---|---|
committer | Takashi Kokubun <takashikkbn@gmail.com> | 2022-08-29 08:47:00 -0700 |
commit | ac77d151d6ef2848a709ff832424fca9cbb66ac6 (patch) | |
tree | ef91f7553866a5195a26982ac3dc1c419d56440d | |
parent | 15c6aacd399b2bc7fb5ee2d6422451c4eb47941f (diff) |
Assert that the # of bytes matches for label refs (https://github.com/Shopify/ruby/pull/316)
-rw-r--r-- | yjit/src/asm/mod.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/yjit/src/asm/mod.rs b/yjit/src/asm/mod.rs index 2fc75083e4..0e05eb5783 100644 --- a/yjit/src/asm/mod.rs +++ b/yjit/src/asm/mod.rs @@ -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; |