summaryrefslogtreecommitdiff
path: root/test/ruby/test_zjit.rb
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2025-11-04 20:37:57 +0100
committerBenoit Daloze <eregontp@gmail.com>2025-11-18 18:54:40 +0100
commit0e10dfded0498cf71efb9fc61a804db6db540009 (patch)
tree0de2e1b854843ed45de6aeadbd2c6c5d61217d04 /test/ruby/test_zjit.rb
parentf84bbb423836d9d0d018b8ab71ecceb5868fd5be (diff)
ZJIT: Inline setting Struct fields
* Add Insn::StoreField and Insn::WriteBarrier
Diffstat (limited to 'test/ruby/test_zjit.rb')
-rw-r--r--test/ruby/test_zjit.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/ruby/test_zjit.rb b/test/ruby/test_zjit.rb
index 2e04dbddd5..64372c231c 100644
--- a/test/ruby/test_zjit.rb
+++ b/test/ruby/test_zjit.rb
@@ -2957,6 +2957,25 @@ class TestZJIT < Test::Unit::TestCase
}
end
+ def test_struct_set
+ assert_compiles '[42, 42, :frozen_error]', %q{
+ C = Struct.new(:foo).new(1)
+
+ def test
+ C.foo = Object.new
+ 42
+ end
+
+ r = [test, test]
+ C.freeze
+ r << begin
+ test
+ rescue FrozenError
+ :frozen_error
+ end
+ }, call_threshold: 2
+ end
+
def test_global_tracepoint
assert_compiles 'true', %q{
def foo = 1