<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/vm_callinfo.h, branch v4.0.3</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>vm_cc_new: don't assume `cme` is present.</title>
<updated>2025-11-25T15:40:31+00:00</updated>
<author>
<name>Jean Boussier</name>
<email>jean.boussier@gmail.com</email>
</author>
<published>2025-11-17T19:01:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=a36ebb18a6d4c4726915b6d7c16cfdbf4e5d417b'/>
<id>a36ebb18a6d4c4726915b6d7c16cfdbf4e5d417b</id>
<content type='text'>
[Bug #21694]

`vm_search_super_method` explictly calls `vm_cc_new` with `cme=NULL`
when there is no super class.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[Bug #21694]

`vm_search_super_method` explictly calls `vm_cc_new` with `cme=NULL`
when there is no super class.
</pre>
</div>
</content>
</entry>
<entry>
<title>use `SET_SHAREABLE`</title>
<updated>2025-10-23T04:08:26+00:00</updated>
<author>
<name>Koichi Sasada</name>
<email>ko1@atdot.net</email>
</author>
<published>2025-09-24T20:50:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=bc00c4468e0054ca896d2b83d3020180915f64cf'/>
<id>bc00c4468e0054ca896d2b83d3020180915f64cf</id>
<content type='text'>
to adopt strict shareable rule.

* (basically) shareable objects only refer shareable objects
* (exception) shareable objects can refere unshareable objects
  but should not leak reference to unshareable objects to Ruby world
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
to adopt strict shareable rule.

* (basically) shareable objects only refer shareable objects
* (exception) shareable objects can refere unshareable objects
  but should not leak reference to unshareable objects to Ruby world
</pre>
</div>
</content>
</entry>
<entry>
<title>Skip `vm_cc_invalidate`'s `cc-&gt;klass` assertion for multi-ractor for now</title>
<updated>2025-09-10T21:11:45+00:00</updated>
<author>
<name>Stan Lo</name>
<email>stan.lo@shopify.com</email>
</author>
<published>2025-09-10T20:35:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=9401f4e7f28af7cb9e1476c4e513e67ca2a782cd'/>
<id>9401f4e7f28af7cb9e1476c4e513e67ca2a782cd</id>
<content type='text'>
It's failing more frequently on CI in Ractor tests lately. To make allow
other PRs to land more smoothly, we can skip the assertion for now.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It's failing more frequently on CI in Ractor tests lately. To make allow
other PRs to land more smoothly, we can skip the assertion for now.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix race condition in method invalidation for Ractors</title>
<updated>2025-08-20T19:53:00+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2025-08-20T14:53:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=2c7ec3d155ba9d3e0589f716c1522f2c26371586'/>
<id>2c7ec3d155ba9d3e0589f716c1522f2c26371586</id>
<content type='text'>
We lock the VM to invalidate method entries. However, we do not lock the
VM to call methods, so it's possible that during a method call the method
entry gets invalidated. We only check that the method entry in the callcache
is not invalidated at the beginning of the method call, which makes it
possible to have race conditions. This causes crashes like:

    vm_callinfo.h:421: Assertion Failed: vm_cc_cme:cc-&gt;klass != Qundef || !vm_cc_markable(cc)
    vm_insnhelper.c:2200: Assertion Failed: vm_lookup_cc:!METHOD_ENTRY_INVALIDATED(vm_cc_cme(ccs_cc))

This commit adds a VM barrier to method cache invalidation to ensure that
other Ractors are stopped at a safe-point before invalidating the method
entry.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We lock the VM to invalidate method entries. However, we do not lock the
VM to call methods, so it's possible that during a method call the method
entry gets invalidated. We only check that the method entry in the callcache
is not invalidated at the beginning of the method call, which makes it
possible to have race conditions. This causes crashes like:

    vm_callinfo.h:421: Assertion Failed: vm_cc_cme:cc-&gt;klass != Qundef || !vm_cc_markable(cc)
    vm_insnhelper.c:2200: Assertion Failed: vm_lookup_cc:!METHOD_ENTRY_INVALIDATED(vm_cc_cme(ccs_cc))

This commit adds a VM barrier to method cache invalidation to ensure that
other Ractors are stopped at a safe-point before invalidating the method
entry.
</pre>
</div>
</content>
</entry>
<entry>
<title>Add stricter assertions on CC access</title>
<updated>2025-08-06T22:57:13+00:00</updated>
<author>
<name>John Hawthorn</name>
<email>john@hawthorn.email</email>
</author>
<published>2025-08-06T20:53:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=fccd96cc6c3cc9f500dc87ae9be65aaa212b02fa'/>
<id>fccd96cc6c3cc9f500dc87ae9be65aaa212b02fa</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Convert `rb_class_cc_entries.entries` in a flexible array member</title>
<updated>2025-08-01T17:49:38+00:00</updated>
<author>
<name>Jean Boussier</name>
<email>jean.boussier@gmail.com</email>
</author>
<published>2025-08-01T10:21:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=bc789ca804c15eb33b9e682b081aa9bd24c5f7fb'/>
<id>bc789ca804c15eb33b9e682b081aa9bd24c5f7fb</id>
<content type='text'>
`rb_class_cc_entries` is little more than a `len` and `capa`.
Hence embedding the entries doesn't cost much extra copying and
saves a bit of memory and some pointer chasing.

Co-Authored-By: Étienne Barrié &lt;etienne.barrie@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
`rb_class_cc_entries` is little more than a `len` and `capa`.
Hence embedding the entries doesn't cost much extra copying and
saves a bit of memory and some pointer chasing.

Co-Authored-By: Étienne Barrié &lt;etienne.barrie@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Refactor `vm_lookup_cc` to allow lock-free lookups in `RClass.cc_tbl`</title>
<updated>2025-08-01T08:42:04+00:00</updated>
<author>
<name>Jean Boussier</name>
<email>jean.boussier@gmail.com</email>
</author>
<published>2025-07-30T14:51:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=547f111b5b0d773af2a4268fe407fdacc7060109'/>
<id>547f111b5b0d773af2a4268fe407fdacc7060109</id>
<content type='text'>
In multi-ractor mode, the `cc_tbl` mutations use the RCU pattern,
which allow lock-less reads.

Based on the assumption that invalidations and misses should be
increasingly rare as the process ages, locking on modification
isn't a big concern.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In multi-ractor mode, the `cc_tbl` mutations use the RCU pattern,
which allow lock-less reads.

Based on the assumption that invalidations and misses should be
increasingly rare as the process ages, locking on modification
isn't a big concern.
</pre>
</div>
</content>
</entry>
<entry>
<title>Make `RClass.cc_table` a managed object</title>
<updated>2025-08-01T08:42:04+00:00</updated>
<author>
<name>Jean Boussier</name>
<email>jean.boussier@gmail.com</email>
</author>
<published>2025-07-30T10:44:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=f2a7e48deadb9101d49c9b613abf5a83c9e1dd49'/>
<id>f2a7e48deadb9101d49c9b613abf5a83c9e1dd49</id>
<content type='text'>
For now this doesn't change anything, but now that the table
is managed by GC, it opens the door to use RCU when in multi-ractor
mode, hence allow unsynchornized reads.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
For now this doesn't change anything, but now that the table
is managed by GC, it opens the door to use RCU when in multi-ractor
mode, hence allow unsynchornized reads.
</pre>
</div>
</content>
</entry>
<entry>
<title>Use `rb_gc_mark_weak` for `cc-&gt;klass`.</title>
<updated>2025-08-01T08:42:04+00:00</updated>
<author>
<name>Jean Boussier</name>
<email>jean.boussier@gmail.com</email>
</author>
<published>2025-07-29T13:13:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=fc5e1541e4bb4b7995b6acc1ea6121b60fc64e7a'/>
<id>fc5e1541e4bb4b7995b6acc1ea6121b60fc64e7a</id>
<content type='text'>
One of the biggest remaining contention point is `RClass.cc_table`.
The logical solution would be to turn it into a managed object, so
we can use an RCU strategy, given it's read heavy.

However, that's not currently possible because the table can't
be freed before the owning class, given the class free function
MUST go over all the CC entries to invalidate them.

However if the `CC-&gt;klass` reference is weak marked, then the
GC will take care of setting the reference to `Qundef`.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
One of the biggest remaining contention point is `RClass.cc_table`.
The logical solution would be to turn it into a managed object, so
we can use an RCU strategy, given it's read heavy.

However, that's not currently possible because the table can't
be freed before the owning class, given the class free function
MUST go over all the CC entries to invalidate them.

However if the `CC-&gt;klass` reference is weak marked, then the
GC will take care of setting the reference to `Qundef`.
</pre>
</div>
</content>
</entry>
<entry>
<title>vm_callinfo.h: Stick to using user flags</title>
<updated>2025-06-13T08:08:42+00:00</updated>
<author>
<name>Jean Boussier</name>
<email>jean.boussier@gmail.com</email>
</author>
<published>2025-06-13T07:11:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=dd4c5acc0f6a6b3858c784438364a766f5975617'/>
<id>dd4c5acc0f6a6b3858c784438364a766f5975617</id>
<content type='text'>
For some unclear reasons VM_CALLCACHE_UNMARKABLE
and VM_CALLCACHE_UNMARKABLE used global flags rather than the
available IMEMO_FL_USER flags.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
For some unclear reasons VM_CALLCACHE_UNMARKABLE
and VM_CALLCACHE_UNMARKABLE used global flags rather than the
available IMEMO_FL_USER flags.
</pre>
</div>
</content>
</entry>
</feed>
