From ea30dd702512ff9df34fe8c71c825f8f901bf5b1 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Tue, 2 Jul 2019 23:32:09 +0900 Subject: Avoid corrupting VM stack on inlined setlocal setlocal relies on cfp->ep, and frame-omitted method inlining introduced in Ruby 2.7 kept it wrong. This change might slow down frame-omitted method inlining for cfp->ep manipulation, and it obviously complicates the implementaion more. By introducing an optimization that changes Ruby's local variable to C local variable, we could optimize it and simplify the cfp->ep manipulation later. [Bug #15971] --- test/ruby/test_jit.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_jit.rb b/test/ruby/test_jit.rb index 66360731eb..cd7ac23697 100644 --- a/test/ruby/test_jit.rb +++ b/test/ruby/test_jit.rb @@ -11,6 +11,7 @@ class TestJIT < Test::Unit::TestCase IGNORABLE_PATTERNS = [ /\AJIT recompile: .+\n\z/, + /\AJIT inline: .+\n\z/, /\ASuccessful MJIT finish\n\z/, ] @@ -841,6 +842,19 @@ class TestJIT < Test::Unit::TestCase end; end + def test_block_handler_with_frame_omitted_inlining + assert_eval_with_jit("#{<<~"begin;"}\n#{<<~"end;"}", stdout: "70.0\n70.0\n70.0\n", success_count: 1, min_calls: 2) + begin; + def multiply(a, b) + a *= b + end + + 3.times do + p multiply(7.0, 10.0) + end + end; + end + def test_program_counter_with_regexpmatch assert_eval_with_jit("#{<<~"begin;"}\n#{<<~"end;"}", stdout: "aa", success_count: 1) begin; -- cgit v1.2.3