Skip to content

Commit 863d792

Browse files
committed
YJIT: Remove a dead test for getinlinecaches
The test was added in ruby#5221 4 years ago but: 1. The insn it targets was removed in 2022 in ruby#6187 2. The YJIT API `blocks_for` seems to be dropped in 2022 when it switched to use Rust in ruby#5826 So this test has not been run in more than 3 years and can't be run anymore. I think we can remove it.
1 parent d4020dd commit 863d792

1 file changed

Lines changed: 0 additions & 85 deletions

File tree

bootstraptest/test_yjit.rb

Lines changed: 0 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -468,91 +468,6 @@ def getter
468468
end
469469
}
470470

471-
assert_equal '0', %q{
472-
# This is a regression test for incomplete invalidation from
473-
# opt_setinlinecache. This test might be brittle, so
474-
# feel free to remove it in the future if it's too annoying.
475-
# This test assumes --yjit-call-threshold=2.
476-
module M
477-
Foo = 1
478-
def foo
479-
Foo
480-
end
481-
482-
def pin_self_type_then_foo
483-
_ = @foo
484-
foo
485-
end
486-
487-
def only_ints
488-
1 + self
489-
foo
490-
end
491-
end
492-
493-
class Integer
494-
include M
495-
end
496-
497-
class Sub
498-
include M
499-
end
500-
501-
foo_method = M.instance_method(:foo)
502-
503-
dbg = ->(message) do
504-
return # comment this out to get printouts
505-
506-
$stderr.puts RubyVM::YJIT.disasm(foo_method)
507-
$stderr.puts message
508-
end
509-
510-
2.times { 42.only_ints }
511-
512-
dbg["There should be two versions of getinlineache"]
513-
514-
module M
515-
remove_const(:Foo)
516-
end
517-
518-
dbg["There should be no getinlinecaches"]
519-
520-
2.times do
521-
42.only_ints
522-
rescue NameError => err
523-
_ = "caught name error #{err}"
524-
end
525-
526-
dbg["There should be one version of getinlineache"]
527-
528-
2.times do
529-
Sub.new.pin_self_type_then_foo
530-
rescue NameError
531-
_ = 'second specialization'
532-
end
533-
534-
dbg["There should be two versions of getinlineache"]
535-
536-
module M
537-
Foo = 1
538-
end
539-
540-
dbg["There should still be two versions of getinlineache"]
541-
542-
42.only_ints
543-
544-
dbg["There should be no getinlinecaches"]
545-
546-
# Find name of the first VM instruction in M#foo.
547-
insns = RubyVM::InstructionSequence.of(foo_method).to_a
548-
if defined?(RubyVM::YJIT.blocks_for) && (insns.last.find { Array === _1 }&.first == :opt_getinlinecache)
549-
RubyVM::YJIT.blocks_for(RubyVM::InstructionSequence.of(foo_method))
550-
.filter { _1.iseq_start_index == 0 }.count
551-
else
552-
0 # skip the test
553-
end
554-
}
555-
556471
# Check that frozen objects are respected
557472
assert_equal 'great', %q{
558473
class Foo

0 commit comments

Comments
 (0)