summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Bernstein <max.bernstein@shopify.com>2025-03-14 16:19:47 -0400
committerTakashi Kokubun <takashikkbn@gmail.com>2025-04-18 21:53:00 +0900
commitbe874df1c4250d16701d0c3b8c169a96f0ed4dc4 (patch)
tree88d671b883d85ed4e77d4874164fac9f81edf6c3
parent92b87ec53fe87978554793a4fc58e4b5ccb879db (diff)
Print fake/stable addresses in HIR printer in tests
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/13131
-rw-r--r--zjit/src/hir.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/zjit/src/hir.rs b/zjit/src/hir.rs
index fe0048b1db..d9433ff469 100644
--- a/zjit/src/hir.rs
+++ b/zjit/src/hir.rs
@@ -48,6 +48,7 @@ impl std::fmt::Display for VALUE {
&Qnil => write!(f, "nil"),
&Qtrue => write!(f, "true"),
&Qfalse => write!(f, "false"),
+ _ if cfg!(test) => write!(f, "VALUE(0xffffffffffffffff)"),
val => write!(f, "VALUE({:#X?})", val.as_ptr::<u8>()),
}
}
@@ -683,7 +684,7 @@ impl<'a> std::fmt::Display for FunctionPrinter<'a> {
// For tests, we want to check HIR snippets textually. Addresses change
// between runs, making tests fail. Instead, pick an arbitrary hex value to
// use as a "pointer" so we can check the rest of the HIR.
- let blockiseq = if cfg!(test) { "0xdeadbeef".into() } else { format!("{blockiseq:?}") };
+ let blockiseq = if cfg!(test) { "0xffffffffffffffff".into() } else { format!("{blockiseq:?}") };
write!(f, "Send {self_val}, {blockiseq}, :{}", call_info.method_name)?;
for arg in args {
write!(f, ", {arg}")?;
@@ -1857,7 +1858,7 @@ mod tests {
");
assert_method_hir("test", "
bb0(v0:BasicObject):
- v3:BasicObject = Send v0, 0xdeadbeef, :each
+ v3:BasicObject = Send v0, 0xffffffffffffffff, :each
Return v3
");
}