diff options
author | Adam Hess <HParker@github.com> | 2021-11-19 13:57:09 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-19 16:57:09 -0500 |
commit | 73388aff5e2a6c6f5520d4ccc7843990fb15520e (patch) | |
tree | 47ceb4156b0781b35d9846cf0b46d1fce07d1d7f /test/ruby | |
parent | 3c92516519bf0cf3ed586462f947ed8c4ed64abd (diff) |
Add YJIT codegen for objtostring (#5149)
This is the minimal correct objtostring implementation in YJIT.
For correctness, it is important that to_string not get called on strings or subclasses of string.
There is a new test for this behavior.
A follow up should implement an optimized version for other types as performed in `vm_objtostring`.
Co-authored-by: John Hawthorn <jhawthorn@github.com>
Co-authored-by: John Hawthorn <jhawthorn@github.com>
Notes
Notes:
Merged-By: maximecb <maximecb@ruby-lang.org>
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_yjit.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/test/ruby/test_yjit.rb b/test/ruby/test_yjit.rb index 2b7d5523df..a571432ccd 100644 --- a/test/ruby/test_yjit.rb +++ b/test/ruby/test_yjit.rb @@ -215,7 +215,7 @@ class TestYJIT < Test::Unit::TestCase def test_compile_tostring assert_no_exits('"i am a string #{true}"') - end if false # Until objtostring supported + end def test_compile_opt_aset assert_compiles('[1,2,3][2] = 4', insns: %i[opt_aset]) @@ -240,7 +240,7 @@ class TestYJIT < Test::Unit::TestCase def test_compile_regexp assert_no_exits('/#{true}/') - end if false # Until objtostring supported + end def test_getlocal_with_level assert_compiles(<<~RUBY, insns: %i[getlocal opt_plus], result: [[7]]) @@ -377,7 +377,7 @@ class TestYJIT < Test::Unit::TestCase end def test_string_interpolation - assert_compiles(<<~'RUBY', insns: %i[checktype concatstrings], result: "foobar", min_calls: 2) + assert_compiles(<<~'RUBY', insns: %i[objtostring anytostring concatstrings], result: "foobar", min_calls: 2) def make_str(foo, bar) "#{foo}#{bar}" end @@ -385,17 +385,17 @@ class TestYJIT < Test::Unit::TestCase make_str("foo", "bar") make_str("foo", "bar") RUBY - end if false # Until objtostring supported + end def test_string_interpolation_cast - assert_compiles(<<~'RUBY', insns: %i[checktype concatstrings tostring], result: "123") + assert_compiles(<<~'RUBY', insns: %i[objtostring anytostring concatstrings], result: "123") def make_str(foo, bar) "#{foo}#{bar}" end make_str(1, 23) RUBY - end if false # Until objtostring supported + end def test_checkkeyword assert_compiles(<<~'RUBY', insns: %i[checkkeyword], result: [2, 5]) |