<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/class.c, branch v3_2_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>2024-11-30T05:29:18+00:00</updated>
<author>
<name>nagachika</name>
<email>nagachika@ruby-lang.org</email>
</author>
<published>2024-11-30T05:29:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=bb065f08441aab8f97b45bd3f1600202547c9532'/>
<id>bb065f08441aab8f97b45bd3f1600202547c9532</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, dc64448202299633a235f310b8bf2192263f274f: [Backport #20716]</title>
<updated>2024-10-18T04:57:08+00:00</updated>
<author>
<name>nagachika</name>
<email>nagachika@ruby-lang.org</email>
</author>
<published>2024-10-18T04:10:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=cb75fcef6feb126a67874109ce1503976a6f90cc'/>
<id>cb75fcef6feb126a67874109ce1503976a6f90cc</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]

	Remove an unused variable
</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]

	Remove an unused variable
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) e626da82eae3d437b84d4f9ead0164d436b08e1a, f3af5ae7e6c1c096bbfe46d69de825a02b1696cf: [Backport #20311]</title>
<updated>2024-07-07T07:44:06+00:00</updated>
<author>
<name>nagachika</name>
<email>nagachika@ruby-lang.org</email>
</author>
<published>2024-07-07T05:47:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=bd5df1693c89d389471d145fc19b487c708912b1'/>
<id>bd5df1693c89d389471d145fc19b487c708912b1</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>merge revision(s) c42261059dfebabbf0391327a5e077545a9bc438: [Backport #19901]</title>
<updated>2023-09-30T04:47:33+00:00</updated>
<author>
<name>nagachika</name>
<email>nagachika@ruby-lang.org</email>
</author>
<published>2023-09-30T04:47:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=a191cf561786bde3d0b7d298aab1fbeb1051645c'/>
<id>a191cf561786bde3d0b7d298aab1fbeb1051645c</id>
<content type='text'>
	[Bug #19901]

	fix leak in module clone

	Co-authored-by: Peter Zhu &lt;peter@peterzhu.ca&gt;
	---
	 class.c                  |  1 +
	 test/ruby/test_module.rb | 12 ++++++++++++
	 2 files changed, 13 insertions(+)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	[Bug #19901]

	fix leak in module clone

	Co-authored-by: Peter Zhu &lt;peter@peterzhu.ca&gt;
	---
	 class.c                  |  1 +
	 test/ruby/test_module.rb | 12 ++++++++++++
	 2 files changed, 13 insertions(+)
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix cvar caching when class is cloned</title>
<updated>2023-07-01T05:17:30+00:00</updated>
<author>
<name>eileencodes</name>
<email>eileencodes@gmail.com</email>
</author>
<published>2023-02-07T20:46:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=8a3d57971c99680d4baec84553247b9c6ee41080'/>
<id>8a3d57971c99680d4baec84553247b9c6ee41080</id>
<content type='text'>
The class variable cache that was added in
https://github.com/ruby/ruby/pull/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>
The class variable cache that was added in
https://github.com/ruby/ruby/pull/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>
<entry>
<title>Copy cvar table on clone</title>
<updated>2023-07-01T05:17:30+00:00</updated>
<author>
<name>eileencodes</name>
<email>eileencodes@gmail.com</email>
</author>
<published>2023-02-08T20:27:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=06dae46036316e6e9926c4613ac8058b78eb7f2e'/>
<id>06dae46036316e6e9926c4613ac8058b78eb7f2e</id>
<content type='text'>
When a class with a class variable is cloned we need to also copy the
cvar cache table from the original table to the clone. I found this bug
while working on fixing [Bug #19379]. While this does not fix that bug
directly it is still a required change to fix another bug revealed by
the fix in https://github.com/ruby/ruby/pull/7265

This needs to be backported to 3.2.x and 3.1.x.

Co-authored-by: Aaron Patterson &lt;tenderlove@ruby-lang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When a class with a class variable is cloned we need to also copy the
cvar cache table from the original table to the clone. I found this bug
while working on fixing [Bug #19379]. While this does not fix that bug
directly it is still a required change to fix another bug revealed by
the fix in https://github.com/ruby/ruby/pull/7265

This needs to be backported to 3.2.x and 3.1.x.

Co-authored-by: Aaron Patterson &lt;tenderlove@ruby-lang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[DOC] Clarify Class#subclases behavior quirks</title>
<updated>2022-12-11T16:43:44+00:00</updated>
<author>
<name>zverok</name>
<email>zverok.offline@gmail.com</email>
</author>
<published>2022-01-24T22:31:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=f07897fd7bb53a40a8fad5ee2be74e02b53e8614'/>
<id>f07897fd7bb53a40a8fad5ee2be74e02b53e8614</id>
<content type='text'>
As per discussion in [Feature #18273], explain the
non-deterministic nature of the method.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
As per discussion in [Feature #18273], explain the
non-deterministic nature of the method.
</pre>
</div>
</content>
</entry>
<entry>
<title>Freeze singleton class, not its origin</title>
<updated>2022-12-08T20:58:26+00:00</updated>
<author>
<name>Alan Wu</name>
<email>XrXr@users.noreply.github.com</email>
</author>
<published>2022-12-06T17:06:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=bb8afd7265af41a75e8889774aa26f157f146380'/>
<id>bb8afd7265af41a75e8889774aa26f157f146380</id>
<content type='text'>
Previously, when we froze an object, we froze
`RCLASS_ORIGIN(object.singleton_class)`, which didn't freeze
`object.singleton_class` when it has some prepended modules.

Origin iclass are internal objects and users can't interact with
them through Kernel#freeze?, Kernel#freeze, or any mutation method
that checks the frozen status. So we shouldn't touch the origin
iclasses when the frozen status should be visible.

[Bug #19169]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previously, when we froze an object, we froze
`RCLASS_ORIGIN(object.singleton_class)`, which didn't freeze
`object.singleton_class` when it has some prepended modules.

Origin iclass are internal objects and users can't interact with
them through Kernel#freeze?, Kernel#freeze, or any mutation method
that checks the frozen status. So we shouldn't touch the origin
iclasses when the frozen status should be visible.

[Bug #19169]
</pre>
</div>
</content>
</entry>
<entry>
<title>Inherit max_iv_count from superclass</title>
<updated>2022-12-01T23:37:15+00:00</updated>
<author>
<name>John Hawthorn</name>
<email>john@hawthorn.email</email>
</author>
<published>2022-11-22T22:28:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=da204d2eee51082854ff6ec89eacea2911ea1590'/>
<id>da204d2eee51082854ff6ec89eacea2911ea1590</id>
<content type='text'>
In 274870bd5434ab64ac3a3c9db9aa27d262c1d6d6 we gained the ability to
make an educated guess at the max_iv_count of a class based on its
initialize method. This commit makes subclasses inherit their super's
max_iv_count, which makes the estimate work in cases that the subclass
does not have an initialize method.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In 274870bd5434ab64ac3a3c9db9aa27d262c1d6d6 we gained the ability to
make an educated guess at the max_iv_count of a class based on its
initialize method. This commit makes subclasses inherit their super's
max_iv_count, which makes the estimate work in cases that the subclass
does not have an initialize method.
</pre>
</div>
</content>
</entry>
<entry>
<title>Using UNDEF_P macro</title>
<updated>2022-11-16T09:58:33+00:00</updated>
<author>
<name>S-H-GAMELINKS</name>
<email>gamelinks007@gmail.com</email>
</author>
<published>2022-11-15T04:24:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=1f4f6c9832d83e7ebd65ccf4e95cef358b3512c6'/>
<id>1f4f6c9832d83e7ebd65ccf4e95cef358b3512c6</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
