diff options
author | Takashi Kokubun <takashikkbn@gmail.com> | 2019-07-02 23:32:09 +0900 |
---|---|---|
committer | Takashi Kokubun <takashikkbn@gmail.com> | 2019-07-02 23:35:52 +0900 |
commit | ea30dd702512ff9df34fe8c71c825f8f901bf5b1 (patch) | |
tree | fefa0f795f3c8eaa06b00de7c6693f89da27d9c0 /test/ruby | |
parent | 181b966e7553ac53d034266a7cdc18664d080814 (diff) | |
download | ruby-ea30dd702512ff9df34fe8c71c825f8f901bf5b1.tar.gz |
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')
-rw-r--r-- | test/ruby/test_jit.rb | 14 |
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; |