summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorEileen M. Uchitelle <eileencodes@users.noreply.github.com>2021-11-23 14:09:24 -0500
committerGitHub <noreply@github.com>2021-11-23 14:09:24 -0500
commit459f9e3df8e8080d8c44aed3636a337e6ee64132 (patch)
tree497fdb2d8a6751b2dbbaf7be979bce6444b01b9f /test
parentfb9d67742b77e5b38cfe46b448b64e6965aa3e70 (diff)
Add setclassvariable to yjit (#5127)
Implements setclassvariable in yjit. Note that this version is not faster than the standard version because we aren't handling the inline cache in assembly. This is still important to implement because it will prevent yjit from exiting in methods that call both a cvar setter and other code that yjit can compile. Co-authored-by: Aaron Patterson tenderlove@ruby-lang.org
Notes
Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_yjit.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/ruby/test_yjit.rb b/test/ruby/test_yjit.rb
index a571432ccd..d951f79cfc 100644
--- a/test/ruby/test_yjit.rb
+++ b/test/ruby/test_yjit.rb
@@ -52,6 +52,11 @@ class TestYJIT < Test::Unit::TestCase
assert_in_out_err([yjit_child_env, '-e p RubyVM::YJIT.enabled?'], '', ['true'])
end
+ def test_compile_setclassvariable
+ script = 'class Foo; def self.foo; @@foo = 1; end; end; Foo.foo'
+ assert_compiles(script, insns: %i[setclassvariable], result: 1)
+ end
+
def test_compile_getclassvariable
script = 'class Foo; @@foo = 1; def self.foo; @@foo; end; end; Foo.foo'
assert_compiles(script, insns: %i[getclassvariable], result: 1)