Skip to content

Commit 3b3ab33

Browse files
committed
ZJIT: Fix test failures from line number of Primitive shifting
This can happen with documentation updates and we don't want those to trip on ZJIT tests. Redact the whole name since names like "_bi342" aren't that helpful anyways.
1 parent 0601999 commit 3b3ab33

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

zjit/src/hir.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1297,9 +1297,11 @@ impl<'a> std::fmt::Display for InsnPrinter<'a> {
12971297
Ok(())
12981298
}
12991299
Insn::InvokeBuiltin { bf, args, leaf, .. } => {
1300+
let bf_name = unsafe { CStr::from_ptr(bf.name) }.to_str().unwrap();
13001301
write!(f, "InvokeBuiltin{} {}",
13011302
if *leaf { " leaf" } else { "" },
1302-
unsafe { CStr::from_ptr(bf.name) }.to_str().unwrap())?;
1303+
// e.g. Code that use `Primitive.cexpr!`. From BUILTIN_INLINE_PREFIX.
1304+
if bf_name.starts_with("_bi") { "<inline_expr>" } else { bf_name })?;
13031305
for arg in args {
13041306
write!(f, ", {arg}")?;
13051307
}

zjit/src/hir/opt_tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2588,7 +2588,7 @@ mod hir_opt_tests {
25882588
v13:Fixnum[1] = Const Value(1)
25892589
PatchPoint MethodRedefined(Integer@0x1000, zero?@0x1008, cme:0x1010)
25902590
IncrCounter inline_iseq_optimized_send_count
2591-
v23:BasicObject = InvokeBuiltin leaf _bi285, v13
2591+
v23:BasicObject = InvokeBuiltin leaf <inline_expr>, v13
25922592
CheckInterrupts
25932593
Return v23
25942594
");
@@ -2620,7 +2620,7 @@ mod hir_opt_tests {
26202620
PatchPoint MethodRedefined(Array@0x1008, first@0x1010, cme:0x1018)
26212621
PatchPoint NoSingletonClass(Array@0x1008)
26222622
IncrCounter inline_iseq_optimized_send_count
2623-
v31:BasicObject = InvokeBuiltin leaf _bi132, v17
2623+
v31:BasicObject = InvokeBuiltin leaf <inline_expr>, v17
26242624
CheckInterrupts
26252625
Return v31
26262626
");

zjit/src/hir/tests.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3026,7 +3026,7 @@ pub mod hir_build_tests {
30263026
EntryPoint JIT(0)
30273027
Jump bb2(v4)
30283028
bb2(v6:BasicObject):
3029-
v10:HeapObject = InvokeBuiltin leaf _bi20, v6
3029+
v10:HeapObject = InvokeBuiltin leaf <inline_expr>, v6
30303030
Jump bb3(v6, v10)
30313031
bb3(v12:BasicObject, v13:HeapObject):
30323032
CheckInterrupts
@@ -3140,7 +3140,7 @@ pub mod hir_build_tests {
31403140
EntryPoint JIT(0)
31413141
Jump bb2(v4)
31423142
bb2(v6:BasicObject):
3143-
v10:StringExact = InvokeBuiltin leaf _bi28, v6
3143+
v10:StringExact = InvokeBuiltin leaf <inline_expr>, v6
31443144
Jump bb3(v6, v10)
31453145
bb3(v12:BasicObject, v13:StringExact):
31463146
CheckInterrupts
@@ -3162,7 +3162,7 @@ pub mod hir_build_tests {
31623162
EntryPoint JIT(0)
31633163
Jump bb2(v4)
31643164
bb2(v6:BasicObject):
3165-
v10:StringExact = InvokeBuiltin leaf _bi12, v6
3165+
v10:StringExact = InvokeBuiltin leaf <inline_expr>, v6
31663166
Jump bb3(v6, v10)
31673167
bb3(v12:BasicObject, v13:StringExact):
31683168
CheckInterrupts

0 commit comments

Comments
 (0)