summaryrefslogtreecommitdiff
path: root/test/ruby/test_jit.rb
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2019-07-02 23:32:09 +0900
committerTakashi Kokubun <takashikkbn@gmail.com>2019-07-02 23:35:52 +0900
commitea30dd702512ff9df34fe8c71c825f8f901bf5b1 (patch)
treefefa0f795f3c8eaa06b00de7c6693f89da27d9c0 /test/ruby/test_jit.rb
parent181b966e7553ac53d034266a7cdc18664d080814 (diff)
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]
Diffstat (limited to 'test/ruby/test_jit.rb')
-rw-r--r--test/ruby/test_jit.rb14
1 files changed, 14 insertions, 0 deletions
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;