diff options
author | Takashi Kokubun <[email protected]> | 2020-07-10 00:42:43 -0700 |
---|---|---|
committer | Takashi Kokubun <[email protected]> | 2020-07-10 00:44:02 -0700 |
commit | 7fa3c71becd6d9b11d1574b3537a3b2993a7046c (patch) | |
tree | 4cab3c6b23d564deaa4271484c21baad35b59b95 /test/ruby/test_jit.rb | |
parent | 4989987419c42b04fbf3b0634ddaeace49108689 (diff) |
Make sure vm_call_cfunc uses inlined cc
which is checked by the first guard. When JIT-inlined cc and operand
cd->cc are different, the JIT-ed code might wrongly dispatch cd->cc even
while class check is done with another cc inlined by JIT.
This fixes SEGV on railsbench.
Diffstat (limited to 'test/ruby/test_jit.rb')
-rw-r--r-- | test/ruby/test_jit.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/ruby/test_jit.rb b/test/ruby/test_jit.rb index 08093a5817..c1f2f7a6d5 100644 --- a/test/ruby/test_jit.rb +++ b/test/ruby/test_jit.rb @@ -793,6 +793,22 @@ class TestJIT < Test::Unit::TestCase end; end + def test_inlined_c_method + assert_eval_with_jit("#{<<~"begin;"}\n#{<<~"end;"}", stdout: "aaa", success_count: 2, recompile_count: 1, min_calls: 2) + begin; + def test(obj, recursive: nil) + if recursive + test(recursive) + end + obj.to_s + end + + print(test('a')) # set #to_s cc to String#to_s (expecting C method) + print(test('a')) # JIT with #to_s cc: String#to_s + print(test('a', recursive: :foo)) # update #to_s cd->cc to Symbol#to_s, then go through inlined #to_s cc with Symbol#to_s + end; + end + def test_inlined_exivar assert_eval_with_jit("#{<<~"begin;"}\n#{<<~"end;"}", stdout: "aaa", success_count: 3, recompile_count: 1, min_calls: 2) begin; |