diff options
author | Takashi Kokubun <takashikkbn@gmail.com> | 2023-02-20 09:06:09 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-20 09:06:09 -0800 |
commit | ecd0cdaf820af789f355f1a18c31d6adfe8aad94 (patch) | |
tree | c8756096eec15a4debd1b777b35b7a89c9875436 /test | |
parent | b326a5f3ddf97161039a15fbb49e25b512e6efc8 (diff) |
YJIT: Fix assertion for partially mapped last pages (#7337)
Follows up [Bug #19400]
Notes
Notes:
Merged-By: k0kubun <takashikkbn@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_yjit.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/ruby/test_yjit.rb b/test/ruby/test_yjit.rb index ce51dd83f7..3ab04f6fe9 100644 --- a/test/ruby/test_yjit.rb +++ b/test/ruby/test_yjit.rb @@ -974,6 +974,25 @@ class TestYJIT < Test::Unit::TestCase RUBY end + def test_code_gc_partial_last_page + # call_threshold: 2 to avoid JIT-ing code_gc itself. If code_gc were JITed right before + # code_gc is called, the last page would be on stack. + assert_compiles(<<~'RUBY', exits: :any, result: :ok, call_threshold: 2) + # Leave a bunch of off-stack pages + i = 0 + while i < 1000 + eval("x = proc { 1.to_s }; x.call; x.call") + i += 1 + end + + # On Linux, memory page size != code page size. So the last code page could be partially + # mapped. This call tests that assertions and other things work fine under the situation. + RubyVM::YJIT.code_gc + + :ok + RUBY + end + def test_trace_script_compiled # not ISEQ_TRACE_EVENTS assert_compiles(<<~'RUBY', exits: :any, result: :ok) @eval_counter = 0 |