<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/gc/gc.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>Move rb_gc_verify_shareable to gc.c</title>
<updated>2025-11-09T01:58:25+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2025-11-08T22:13:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=827f11fce3c92dce80ebc5dc80be9acdafae1173'/>
<id>827f11fce3c92dce80ebc5dc80be9acdafae1173</id>
<content type='text'>
rb_gc_verify_shareable is not GC implementation specific so it should live
in gc.c.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
rb_gc_verify_shareable is not GC implementation specific so it should live
in gc.c.
</pre>
</div>
</content>
</entry>
<entry>
<title>catch up modular-gc</title>
<updated>2025-10-23T04:08:26+00:00</updated>
<author>
<name>Koichi Sasada</name>
<email>ko1@atdot.net</email>
</author>
<published>2025-10-21T19:47:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=a177799807006b15341aa87b4f0ad9bb26c6b89c'/>
<id>a177799807006b15341aa87b4f0ad9bb26c6b89c</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Output parent object info when marking T_NONE</title>
<updated>2025-09-02T13:22:27+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2025-09-02T11:37:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=636da19e2bd01dda7f056404962b326695cc0597'/>
<id>636da19e2bd01dda7f056404962b326695cc0597</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>YJIT: Set code mem permissions in bulk</title>
<updated>2025-07-14T20:21:55+00:00</updated>
<author>
<name>Kunshan Wang</name>
<email>wks1986@gmail.com</email>
</author>
<published>2025-06-30T06:21:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=51a3ea5adeb452e51c119a395acfd5c87cc63735'/>
<id>51a3ea5adeb452e51c119a395acfd5c87cc63735</id>
<content type='text'>
Some GC modules, notably MMTk, support parallel GC, i.e. multiple GC
threads work in parallel during a GC.  Currently, when two GC threads
scan two iseq objects simultaneously when YJIT is enabled, both threads
will attempt to borrow `CodeBlock::mem_block`, which will result in
panic.

This commit makes one part of the change.

We now set the YJIT code memory to writable in bulk before the
reference-updating phase, and reset it to executable in bulk after the
reference-updating phase.  Previously, YJIT lazily sets memory pages
writable while updating object references embedded in JIT-compiled
machine code, and sets the memory back to executable by calling
`mark_all_executable`.  This approach is inherently unfriendly to
parallel GC because (1) it borrows `CodeBlock::mem_block`, and (2) it
sets the whole `CodeBlock` as executable which races with other GC
threads that are updating other iseq objects.  It also has performance
overhead due to the frequent invocation of system calls.  We now set the
permission of all the code memory in bulk before and after the reference
updating phase.  Multiple GC threads can now perform raw memory writes
in parallel.  We should also see performance improvement during moving
GC because of the reduced number of `mprotect` system calls.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Some GC modules, notably MMTk, support parallel GC, i.e. multiple GC
threads work in parallel during a GC.  Currently, when two GC threads
scan two iseq objects simultaneously when YJIT is enabled, both threads
will attempt to borrow `CodeBlock::mem_block`, which will result in
panic.

This commit makes one part of the change.

We now set the YJIT code memory to writable in bulk before the
reference-updating phase, and reset it to executable in bulk after the
reference-updating phase.  Previously, YJIT lazily sets memory pages
writable while updating object references embedded in JIT-compiled
machine code, and sets the memory back to executable by calling
`mark_all_executable`.  This approach is inherently unfriendly to
parallel GC because (1) it borrows `CodeBlock::mem_block`, and (2) it
sets the whole `CodeBlock` as executable which races with other GC
threads that are updating other iseq objects.  It also has performance
overhead due to the frequent invocation of system calls.  We now set the
permission of all the code memory in bulk before and after the reference
updating phase.  Multiple GC threads can now perform raw memory writes
in parallel.  We should also see performance improvement during moving
GC because of the reduced number of `mprotect` system calls.
</pre>
</div>
</content>
</entry>
<entry>
<title>Support message in GC_ASSERT</title>
<updated>2025-06-26T13:37:55+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2025-06-25T18:33:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=80f53eba4076a11c7b547ac406c15da7aa5a2345'/>
<id>80f53eba4076a11c7b547ac406c15da7aa5a2345</id>
<content type='text'>
RUBY_ASSERT_MESG_WHEN supports a format string at the end for additional
information. This commit adds support for that in GC_ASSERT.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
RUBY_ASSERT_MESG_WHEN supports a format string at the end for additional
information. This commit adds support for that in GC_ASSERT.
</pre>
</div>
</content>
</entry>
<entry>
<title>Take file and line in GC VM locks</title>
<updated>2025-06-09T17:57:18+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2025-06-06T14:56:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=837699e16059936f9fb98b3c2e4ec7eeb933d420'/>
<id>837699e16059936f9fb98b3c2e4ec7eeb933d420</id>
<content type='text'>
This commit adds file and line to GC VM locking functions for debugging
purposes and adds upper case macros to pass __FILE__ and __LINE__.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This commit adds file and line to GC VM locking functions for debugging
purposes and adds upper case macros to pass __FILE__ and __LINE__.
</pre>
</div>
</content>
</entry>
<entry>
<title>Optimize callcache invalidation for refinements</title>
<updated>2025-06-09T03:33:35+00:00</updated>
<author>
<name>alpaca-tc</name>
<email>alpaca-tc@alpaca.tc</email>
</author>
<published>2025-04-05T16:50:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=c8ddc0a843074811b200673a2019fbe4b50bb890'/>
<id>c8ddc0a843074811b200673a2019fbe4b50bb890</id>
<content type='text'>
Fixes [Bug #21201]

This change addresses a performance regression where defining methods
inside `refine` blocks caused severe slowdowns. The issue was due to
`rb_clear_all_refinement_method_cache()` triggering a full object
space scan via `rb_objspace_each_objects` to find and invalidate
affected callcaches, which is very inefficient.

To fix this, I introduce `vm-&gt;cc_refinement_table` to track
callcaches related to refinements. This allows us to invalidate
only the necessary callcaches without scanning the entire heap,
resulting in significant performance improvement.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes [Bug #21201]

This change addresses a performance regression where defining methods
inside `refine` blocks caused severe slowdowns. The issue was due to
`rb_clear_all_refinement_method_cache()` triggering a full object
space scan via `rb_objspace_each_objects` to find and invalidate
affected callcaches, which is very inefficient.

To fix this, I introduce `vm-&gt;cc_refinement_table` to track
callcaches related to refinements. This allows us to invalidate
only the necessary callcaches without scanning the entire heap,
resulting in significant performance improvement.
</pre>
</div>
</content>
</entry>
<entry>
<title>Introduce MODULAR_GC_FN</title>
<updated>2025-06-06T14:46:55+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2025-06-06T02:10:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=347e581a4cbe2bbf7c13532038f2a68b0b37099a'/>
<id>347e581a4cbe2bbf7c13532038f2a68b0b37099a</id>
<content type='text'>
MODULAR_GC_FN allows functions in gc.c to be defined as static when not
building with modular GC.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
MODULAR_GC_FN allows functions in gc.c to be defined as static when not
building with modular GC.
</pre>
</div>
</content>
</entry>
<entry>
<title>Rename `id_to_obj_tbl` -&gt; `id2ref_tbl`</title>
<updated>2025-05-14T09:41:14+00:00</updated>
<author>
<name>Jean Boussier</name>
<email>jean.boussier@gmail.com</email>
</author>
<published>2025-05-14T08:53:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=f9c3feccf4229b766f609658da3b8e96c2cdd29c'/>
<id>f9c3feccf4229b766f609658da3b8e96c2cdd29c</id>
<content type='text'>
As well as associated functions, this should make it more obvious
what the purpose is.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
As well as associated functions, this should make it more obvious
what the purpose is.
</pre>
</div>
</content>
</entry>
<entry>
<title>Get rid of RB_GC_VM_ID_TO_OBJ_TABLE_KEYS</title>
<updated>2025-05-08T05:58:05+00:00</updated>
<author>
<name>Jean Boussier</name>
<email>jean.boussier@gmail.com</email>
</author>
<published>2025-05-07T15:56:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=2d1241ba97a048830421f840a628471bbbeea469'/>
<id>2d1241ba97a048830421f840a628471bbbeea469</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
