aac1d87040 (ruby_4_0): Use stack callinfo/calldata for super dispatch

0 views
Skip to first unread message

John Hawthorn

unread,
Jun 9, 2026, 7:38:14 PM (13 hours ago) Jun 9
to ruby...@g.ruby-lang.org
John Hawthorn 2026-05-26 18:08:47 +0000 (Tue, 26 May 2026)

New Revision: aac1d87040

https://github.com/ruby/ruby/commit/aac1d87040

Log:
Use stack callinfo/calldata for super dispatch

Previously vm_search_super_method would allocate a new callinfo and
write it back into the iseq's call data. Because iseqs can be shared
between Ractors (e.g. via Ractor.shareable_proc + define_method), two
Ractors invoking super through the same iseq could race on the ci/cc,
producing wrong dispatch or crashes from torn callcache reads on
weakly-ordered architectures.

Build the adjusted callinfo on the stack instead, mirroring
sendforward/invokesuperforward. The callcache is also loaded and stored
back with acquire/release atomics so it can be safely shared.

[Bug #22084]

Modified files:
insns.def
test/ruby/test_ractor.rb
vm_insnhelper.c
zjit/src/cruby.rs
zjit/src/hir.rs
Reply all
Reply to author
Forward
0 new messages