diff options
| author | Alan Wu <XrXr@users.noreply.github.com> | 2024-02-21 17:42:23 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-21 14:42:23 -0800 |
| commit | 0be09967fee9eda531260e027094d619e034c425 (patch) | |
| tree | 556f29ce44d65e98c690094700dc159d79a5b14e /test/ruby | |
| parent | 551f64745fa0ba0ea70812f63495f2fa7dd5afe4 (diff) | |
YJIT: Grab stack operands after SP change in String#byteslice (#10060)
Previously, `StackOperand`s caching `sp_offset` was held across a
jit_prepare_call_with_gc(), which invalidates the offsets. With the
right register allocation state, the canary overlapped with the old
address of the receiver and YJIT clobbered the receiver writing the
canary.
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_yjit.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_yjit.rb b/test/ruby/test_yjit.rb index 35036aad4e..8936e567d1 100644 --- a/test/ruby/test_yjit.rb +++ b/test/ruby/test_yjit.rb @@ -1594,6 +1594,12 @@ class TestYJIT < Test::Unit::TestCase RUBY end + def test_byteslice_sp_invalidation + assert_compiles(<<~'RUBY', result: 'ok', no_send_fallbacks: true) + "okng".itself.byteslice(0, 2) + RUBY + end + private def code_gc_helpers |
