diff options
| author | Benoit Daloze <eregontp@gmail.com> | 2025-11-25 23:26:02 +0100 |
|---|---|---|
| committer | Benoit Daloze <eregontp@gmail.com> | 2025-12-02 01:42:14 +0100 |
| commit | 07ea9a38097c088efd6c2872f2a563dbc69a544a (patch) | |
| tree | acb391708e56c7f7857545cc6ed5db53fba58e43 /test/ruby | |
| parent | 2dfb8149d58694cd578dbe2222640499ac021231 (diff) | |
ZJIT: Optimize GetIvar for non-T_OBJECT
* All Invariant::SingleRactorMode PatchPoint are replaced by
assume_single_ractor_mode() to fix https://github.com/Shopify/ruby/issues/875
for SingleRactorMode patchpoints.
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_zjit.rb | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/test/ruby/test_zjit.rb b/test/ruby/test_zjit.rb index d821d8ad5c..6609bb2461 100644 --- a/test/ruby/test_zjit.rb +++ b/test/ruby/test_zjit.rb @@ -3017,7 +3017,35 @@ class TestZJIT < Test::Unit::TestCase test Ractor.new { test }.value - } + }, call_threshold: 2 + end + + def test_ivar_get_with_already_multi_ractor_mode + assert_compiles '42', %q{ + class Foo + def self.set_bar + @bar = [] # needs to be a ractor unshareable object + end + + def self.bar + @bar + rescue Ractor::IsolationError + 42 + end + end + + Foo.set_bar + r = Ractor.new { + Ractor.receive + Foo.bar + } + + Foo.bar + Foo.bar + + r << :go + r.value + }, call_threshold: 2 end def test_ivar_set_with_multi_ractor_mode |
