@@ -830,10 +830,10 @@ def foo
830
830
def test_code_gc
831
831
assert_compiles ( code_gc_helpers + <<~'RUBY' , exits : :any , result : :ok )
832
832
return :not_paged unless add_pages(100) # prepare freeable pages
833
- code_gc # first code GC
833
+ RubyVM::YJIT. code_gc # first code GC
834
834
return :not_compiled1 unless compiles { nil } # should be JITable again
835
835
836
- code_gc # second code GC
836
+ RubyVM::YJIT. code_gc # second code GC
837
837
return :not_compiled2 unless compiles { nil } # should be JITable again
838
838
839
839
code_gc_count = RubyVM::YJIT.runtime_stats[:code_gc_count]
@@ -854,7 +854,7 @@ def test_on_stack_code_gc_call
854
854
855
855
return :not_paged1 unless add_pages(400) # go to a page without initial ocb code
856
856
return :broken_resume1 if fiber.resume != 0 # JIT the fiber
857
- code_gc # first code GC, which should not free the fiber page
857
+ RubyVM::YJIT. code_gc # first code GC, which should not free the fiber page
858
858
return :broken_resume2 if fiber.resume != 0 # The code should be still callable
859
859
860
860
code_gc_count = RubyVM::YJIT.runtime_stats[:code_gc_count]
@@ -873,19 +873,19 @@ def test_on_stack_code_gc_twice
873
873
874
874
return :not_paged1 unless add_pages(400) # go to a page without initial ocb code
875
875
return :broken_resume1 if fiber.resume(true) != 0 # JIT the fiber
876
- code_gc # first code GC, which should not free the fiber page
876
+ RubyVM::YJIT. code_gc # first code GC, which should not free the fiber page
877
877
878
878
return :not_paged2 unless add_pages(300) # add some stuff to be freed
879
879
# Not calling fiber.resume here to test the case that the YJIT payload loses some
880
880
# information at the previous code GC. The payload should still be there, and
881
881
# thus we could know the fiber ISEQ is still on stack on this second code GC.
882
- code_gc # second code GC, which should still not free the fiber page
882
+ RubyVM::YJIT. code_gc # second code GC, which should still not free the fiber page
883
883
884
884
return :not_paged3 unless add_pages(200) # attempt to overwrite the fiber page (it shouldn't)
885
885
return :broken_resume2 if fiber.resume(true) != 0 # The fiber code should be still fine
886
886
887
887
return :broken_resume3 if fiber.resume(false) != nil # terminate the fiber
888
- code_gc # third code GC, freeing a page that used to be on stack
888
+ RubyVM::YJIT. code_gc # third code GC, freeing a page that used to be on stack
889
889
890
890
return :not_paged4 unless add_pages(100) # check everything still works
891
891
@@ -933,11 +933,6 @@ def add_pages(num_jits)
933
933
num_jits.times { return false unless eval('compiles { nil.to_i }') }
934
934
pages.nil? || pages < RubyVM::YJIT.runtime_stats[:compiled_page_count]
935
935
end
936
-
937
- def code_gc
938
- RubyVM::YJIT.simulate_oom! # bump write_pos
939
- eval('proc { nil }.call') # trigger code GC
940
- end
941
936
RUBY
942
937
end
943
938
0 commit comments