summaryrefslogtreecommitdiff
path: root/test/ruby/test_jit.rb
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2020-02-18 23:16:19 -0800
committerTakashi Kokubun <takashikkbn@gmail.com>2020-02-18 23:19:06 -0800
commitc4794ed73ad348a61a7cfbe3da0a7eb49ba46eb9 (patch)
tree837e3a95bd8ff627b08226e42522c260522bc06d /test/ruby/test_jit.rb
parentf0b815dc670b61eba1daaa67a8613ac431d32b16 (diff)
Avoid jumping to a wrong destination
when the next insn is already compiled by former branches.
Diffstat (limited to 'test/ruby/test_jit.rb')
-rw-r--r--test/ruby/test_jit.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_jit.rb b/test/ruby/test_jit.rb
index a8ce18b48c..f3dca57e83 100644
--- a/test/ruby/test_jit.rb
+++ b/test/ruby/test_jit.rb
@@ -828,6 +828,16 @@ class TestJIT < Test::Unit::TestCase
end;
end
+ def test_jump_to_precompiled_branch
+ assert_eval_with_jit("#{<<~'begin;'}\n#{<<~'end;'}", stdout: ".0", success_count: 1, min_calls: 1)
+ begin;
+ def test(foo)
+ ".#{foo unless foo == 1}" if true
+ end
+ print test(0)
+ end;
+ end
+
def test_clean_so
if RUBY_PLATFORM.match?(/mswin/)
skip 'Removing so file is randomly failing on AppVeyor/RubyCI mswin due to Permission Denied.'