Skip to content

Commit 016dab8

Browse files
committed
Fix recompilation test
1 parent b311f02 commit 016dab8

1 file changed

Lines changed: 15 additions & 16 deletions

File tree

zjit/src/hir/opt_tests.rs

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17315,7 +17315,21 @@ mod hir_opt_tests {
1731517315
num_to_compile.times { c.f(1) }
1731617316

1731717317
");
17318-
assert_snapshot!(hir_string_proc("C.new.method(:f)"), @"
17318+
17319+
let intermediate_hir = hir_string_proc("C.new.method(:f)");
17320+
17321+
eval("
17322+
# Supposed to be the same as the earlier Ruby method in this test
17323+
num_to_compile = 30
17324+
c = C.new
17325+
# Call this with a float in order to trigger a guard failure
17326+
# Do this enough times to cause a recompilation
17327+
num_to_compile.times { c.f(1.5) }
17328+
");
17329+
17330+
let final_hir = hir_string_proc("C.new.method(:f)");
17331+
17332+
assert_snapshot!(format!("{intermediate_hir}\n{final_hir}"), @"
1731917333
fn f@<compiled>:4:
1732017334
bb1():
1732117335
EntryPoint interpreter
@@ -17343,22 +17357,7 @@ mod hir_opt_tests {
1734317357
SetIvar v11, :@a, v47
1734417358
CheckInterrupts
1734517359
Return v47
17346-
");
17347-
17348-
let iseq = with_rubyvm(|| get_proc_iseq("C.new.method(:f)"));
17349-
assert_eq!(get_or_create_iseq_payload(iseq).versions.len(), 2,
17350-
"expected a recompile to produce a second ISEQ version"
17351-
);
1735217360

17353-
eval("
17354-
# Supposed to be the same as the earlier Ruby method in this test
17355-
num_to_compile = 30
17356-
c = C.new
17357-
# Call this with a float in order to trigger a guard failure
17358-
# Do this enough times to cause a recompilation
17359-
num_to_compile.times { c.f(1.5) }
17360-
");
17361-
assert_snapshot!(hir_string_proc("C.new.method(:f)"), @"
1736217361
fn f@<compiled>:4:
1736317362
bb1():
1736417363
EntryPoint interpreter

0 commit comments

Comments
 (0)