<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/class.c, branch v3_3_11</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>merge revision(s) 3b7892b6e4d1a1a5d6019987f9b46ed443dd104f: [Backport #20871]</title>
<updated>2025-01-15T01:48:57+00:00</updated>
<author>
<name>Takashi Kokubun</name>
<email>takashikkbn@gmail.com</email>
</author>
<published>2025-01-15T01:48:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=8506fdfb4aca5262940b9c49827c2a839f6bb1fe'/>
<id>8506fdfb4aca5262940b9c49827c2a839f6bb1fe</id>
<content type='text'>
	Fix a bug in rb_include_module that stops nested inclusion into module subclasses

	This bug was present since the code was originally added by me
	in 3556a834a2847e52162d1d3302d4c64390df1694.

	Fixes [Bug #20871]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	Fix a bug in rb_include_module that stops nested inclusion into module subclasses

	This bug was present since the code was originally added by me
	in 3556a834a2847e52162d1d3302d4c64390df1694.

	Fixes [Bug #20871]
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) 6118e8a47394409b53164b60e79fadf348b97db3: [Backport #20716]</title>
<updated>2024-11-04T22:42:47+00:00</updated>
<author>
<name>Takashi Kokubun</name>
<email>takashikkbn@gmail.com</email>
</author>
<published>2024-11-04T22:42:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=edeb0319f7a95dfe3f9b895bcf32371dd8514726'/>
<id>edeb0319f7a95dfe3f9b895bcf32371dd8514726</id>
<content type='text'>
	Fix method caching bug when including/prepend module A that prepends module B

	Fix by always adding the generated iclass to the subclasses list,
	otherwise the method cache for the iclass is not cleared when
	the method in the module is overwritten.

	Fixes [Bug #20716]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	Fix method caching bug when including/prepend module A that prepends module B

	Fix by always adding the generated iclass to the subclasses list,
	otherwise the method cache for the iclass is not cleared when
	the method in the module is overwritten.

	Fixes [Bug #20716]
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) e626da82eae3d437b84d4f9ead0164d436b08e1a,f3af5ae7e6c1c096bbfe46d69de825a02b1696cf: [Backport #20311] (#10312)</title>
<updated>2024-03-21T05:31:36+00:00</updated>
<author>
<name>NARUSE, Yui</name>
<email>nurse@users.noreply.github.com</email>
</author>
<published>2024-03-21T05:31:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=f79b1d1ef1f7aa64d20f0eadbb3b0f8f7084deb3'/>
<id>f79b1d1ef1f7aa64d20f0eadbb3b0f8f7084deb3</id>
<content type='text'>
Don't pin named structs defined in Ruby

	[Bug #20311]

	`rb_define_class_under` assumes it's called from C and that the
	reference might be held in a C global variable, so it adds the
	class to the VM root.

	In the case of `Struct.new('Name')` it's wasteful and make
	the struct immortal.

	Make Struct memory leak test faster

	[Bug #20311]

	It times out on some platform, so we can reduce iterations.
	On my machine it completes in 250ms and RSS grows 8X.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Don't pin named structs defined in Ruby

	[Bug #20311]

	`rb_define_class_under` assumes it's called from C and that the
	reference might be held in a C global variable, so it adds the
	class to the VM root.

	In the case of `Struct.new('Name')` it's wasteful and make
	the struct immortal.

	Make Struct memory leak test faster

	[Bug #20311]

	It times out on some platform, so we can reduce iterations.
	On my machine it completes in 250ms and RSS grows 8X.</pre>
</div>
</content>
</entry>
<entry>
<title>Set m_tbl right after allocation</title>
<updated>2023-12-19T21:09:36+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2023-12-19T19:38:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=28a6e4ea9d9379a654a8f7c4b37fa33aa3ccd0b7'/>
<id>28a6e4ea9d9379a654a8f7c4b37fa33aa3ccd0b7</id>
<content type='text'>
We should set the m_tbl right after allocation before anything that can
trigger GC to avoid clone_p from becoming old and needing to fire write
barriers.

Co-authored-by: Aaron Patterson &lt;tenderlove@ruby-lang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We should set the m_tbl right after allocation before anything that can
trigger GC to avoid clone_p from becoming old and needing to fire write
barriers.

Co-authored-by: Aaron Patterson &lt;tenderlove@ruby-lang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[Bug #19901]</title>
<updated>2023-09-23T21:10:46+00:00</updated>
<author>
<name>Adam Hess</name>
<email>HParker@github.com</email>
</author>
<published>2023-09-23T19:41:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=c42261059dfebabbf0391327a5e077545a9bc438'/>
<id>c42261059dfebabbf0391327a5e077545a9bc438</id>
<content type='text'>
fix leak in module clone

Co-authored-by: Peter Zhu &lt;peter@peterzhu.ca&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
fix leak in module clone

Co-authored-by: Peter Zhu &lt;peter@peterzhu.ca&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Stop exposing FrozenCore in headers</title>
<updated>2023-09-19T05:08:05+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2023-09-19T04:56:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=4634405f7c7a7e0b5490ed3de35c12aad9c91bf5'/>
<id>4634405f7c7a7e0b5490ed3de35c12aad9c91bf5</id>
<content type='text'>
Revert commit "Directly allocate FrozenCore as an ICLASS",
813a5f4fc46a24ca1695d23c159250b9e1080ac7.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Revert commit "Directly allocate FrozenCore as an ICLASS",
813a5f4fc46a24ca1695d23c159250b9e1080ac7.
</pre>
</div>
</content>
</entry>
<entry>
<title>Store object age in a bitmap</title>
<updated>2023-07-13T08:21:36+00:00</updated>
<author>
<name>Matt Valentine-House</name>
<email>matt@eightbitraptor.com</email>
</author>
<published>2023-03-29T20:05:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=d426343418aab6148706860bd1678ac309dc12c0'/>
<id>d426343418aab6148706860bd1678ac309dc12c0</id>
<content type='text'>
Closes [Feature #19729]

Previously 2 bits of the flags on each RVALUE are reserved to store the
number of GC cycles that each object has survived. This commit
introduces a new bit array on the heap page, called age_bits, to store
that information instead.

This patch still reserves one of the age bits in the flags (the old
FL_PROMOTED0 bit, now renamed FL_PROMOTED).

This is set to 0 for young objects and 1 for old objects, and is used as
a performance optimisation for the write barrier. Fetching the age_bits
from the heap page and doing the required math to calculate if the
object was old or not would slow down the write barrier. So we keep this
bit synced in the flags for fast access.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Closes [Feature #19729]

Previously 2 bits of the flags on each RVALUE are reserved to store the
number of GC cycles that each object has survived. This commit
introduces a new bit array on the heap page, called age_bits, to store
that information instead.

This patch still reserves one of the age bits in the flags (the old
FL_PROMOTED0 bit, now renamed FL_PROMOTED).

This is set to 0 for young objects and 1 for old objects, and is used as
a performance optimisation for the write barrier. Fetching the age_bits
from the heap page and doing the required math to calculate if the
object was old or not would slow down the write barrier. So we keep this
bit synced in the flags for fast access.
</pre>
</div>
</content>
</entry>
<entry>
<title>Prefer `0` over `NULL` as function pointers</title>
<updated>2023-06-22T18:15:55+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2023-06-22T18:15:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=b934976024ef4e1694ec47158d94bce0f6d003b7'/>
<id>b934976024ef4e1694ec47158d94bce0f6d003b7</id>
<content type='text'>
SunC warns use of `NULL`, pointer to data as function pointers.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
SunC warns use of `NULL`, pointer to data as function pointers.</pre>
</div>
</content>
</entry>
<entry>
<title>Directly allocate FrozenCore as an ICLASS</title>
<updated>2023-06-14T14:42:40+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2023-06-14T12:01:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=813a5f4fc46a24ca1695d23c159250b9e1080ac7'/>
<id>813a5f4fc46a24ca1695d23c159250b9e1080ac7</id>
<content type='text'>
It's a bad idea to overwrite the flags as the garbage collector may have
set other flags.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It's a bad idea to overwrite the flags as the garbage collector may have
set other flags.
</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "Revert "Fix cvar caching when class is cloned""</title>
<updated>2023-06-05T18:11:12+00:00</updated>
<author>
<name>eileencodes</name>
<email>eileencodes@gmail.com</email>
</author>
<published>2023-06-02T18:25:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=40f090f4339820d19da8ecdf81a981489c22eb57'/>
<id>40f090f4339820d19da8ecdf81a981489c22eb57</id>
<content type='text'>
This reverts commit 10621f7cb9a0c70e568f89cce47a02e878af6778.

This was reverted because the gc integrity build started failing. We
have figured out a fix so I'm reopening the PR.

Original commit message:

Fix cvar caching when class is cloned

The class variable cache that was added in
ruby#4544 changed the behavior of class
variables on cloned classes. As reported when a class is cloned AND a
class variable was set, and the class variable was read from the
original class, reading a class variable from the cloned class would
return the value from the original class.

This was happening because the IC (inline cache) is stored on the ISEQ
which is shared between the original and cloned class, therefore they
share the cache too.

To fix this we are now storing the `cref` in the cache so that we can
check if it's equal to the current `cref`. If it's different we don't
want to read from the cache. If it's the same we do. Cloned classes
don't share the same cref with their original class.

This will need to be backported to 3.1 in addition to 3.2 since the bug
exists in both versions.

We also added a marking function which was missing.

Fixes [Bug #19379]

Co-authored-by: Aaron Patterson &lt;tenderlove@ruby-lang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reverts commit 10621f7cb9a0c70e568f89cce47a02e878af6778.

This was reverted because the gc integrity build started failing. We
have figured out a fix so I'm reopening the PR.

Original commit message:

Fix cvar caching when class is cloned

The class variable cache that was added in
ruby#4544 changed the behavior of class
variables on cloned classes. As reported when a class is cloned AND a
class variable was set, and the class variable was read from the
original class, reading a class variable from the cloned class would
return the value from the original class.

This was happening because the IC (inline cache) is stored on the ISEQ
which is shared between the original and cloned class, therefore they
share the cache too.

To fix this we are now storing the `cref` in the cache so that we can
check if it's equal to the current `cref`. If it's different we don't
want to read from the cache. If it's the same we do. Cloned classes
don't share the same cref with their original class.

This will need to be backported to 3.1 in addition to 3.2 since the bug
exists in both versions.

We also added a marking function which was missing.

Fixes [Bug #19379]

Co-authored-by: Aaron Patterson &lt;tenderlove@ruby-lang.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
