<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/test/ruby/test_objectspace.rb, 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>Fix id2ref table build when GC in progress</title>
<updated>2025-08-09T00:13:25+00:00</updated>
<author>
<name>John Hawthorn</name>
<email>john@hawthorn.email</email>
</author>
<published>2025-08-08T23:31:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=d80c03d22a5e92a5423a18da1d6494c484392c87'/>
<id>d80c03d22a5e92a5423a18da1d6494c484392c87</id>
<content type='text'>
Previously, if GC was in progress when we're initially building the
id2ref table, it could see the empty table and then crash when trying to
remove ids from it. This commit fixes the bug by only publishing the
table after GC is done.

Co-authored-by: Aaron Patterson &lt;tenderlove@ruby-lang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previously, if GC was in progress when we're initially building the
id2ref table, it could see the empty table and then crash when trying to
remove ids from it. This commit fixes the bug by only publishing the
table after GC is done.

Co-authored-by: Aaron Patterson &lt;tenderlove@ruby-lang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rb_gc_impl_copy_finalizer: generate a new object id</title>
<updated>2025-05-16T18:16:52+00:00</updated>
<author>
<name>Jean Boussier</name>
<email>jean.boussier@gmail.com</email>
</author>
<published>2025-05-15T12:04:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=ec8900e3eb7f0008a635fb6fbabde3eb7802536b'/>
<id>ec8900e3eb7f0008a635fb6fbabde3eb7802536b</id>
<content type='text'>
Fix a regression introduced by: https://github.com/ruby/ruby/pull/13155
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fix a regression introduced by: https://github.com/ruby/ruby/pull/13155
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix warnings in tests for ObjectSpace._id2ref</title>
<updated>2025-05-09T16:43:08+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2025-05-09T16:07:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=011982ef837150044d9f18acc49a7b70e39eaf76'/>
<id>011982ef837150044d9f18acc49a7b70e39eaf76</id>
<content type='text'>
There's a lot of warnings when running test_objectspace.rb because of
ObjectSpace._id2ref. For example:

    test_objectspace.rb:19: warning: ObjectSpace._id2ref is deprecated
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
There's a lot of warnings when running test_objectspace.rb because of
ObjectSpace._id2ref. For example:

    test_objectspace.rb:19: warning: ObjectSpace._id2ref is deprecated
</pre>
</div>
</content>
</entry>
<entry>
<title>Lazily create `objspace-&gt;id_to_obj_tbl`</title>
<updated>2025-04-14T22:57:39+00:00</updated>
<author>
<name>Jean Boussier</name>
<email>jean.boussier@gmail.com</email>
</author>
<published>2025-04-10T09:53:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=0606046c1a3816eabb26b5de18942c02710eb28e'/>
<id>0606046c1a3816eabb26b5de18942c02710eb28e</id>
<content type='text'>
This inverse table is only useful if `ObjectSpace._id2ref` is used,
which is extremely rare. The only notable exception is the `drb` gem
and even then it has an option not to rely on `_id2ref`.

So if we assume this table will never be looked up, we can just
not maintain it, and if it turns out `_id2ref` is called, we
can lock the VM and re-build it.

```
compare-ruby: ruby 3.5.0dev (2025-04-10T09:44:40Z master 684cfa42d7) +YJIT +PRISM [arm64-darwin24]
built-ruby: ruby 3.5.0dev (2025-04-10T10:13:43Z lazy-id-to-obj d3aa9626cc) +YJIT +PRISM [arm64-darwin24]
warming up..

|           |compare-ruby|built-ruby|
|:----------|-----------:|---------:|
|baseline   |     26.364M|   25.974M|
|           |       1.01x|         -|
|object_id  |     10.293M|   14.202M|
|           |           -|     1.38x|
```
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This inverse table is only useful if `ObjectSpace._id2ref` is used,
which is extremely rare. The only notable exception is the `drb` gem
and even then it has an option not to rely on `_id2ref`.

So if we assume this table will never be looked up, we can just
not maintain it, and if it turns out `_id2ref` is called, we
can lock the VM and re-build it.

```
compare-ruby: ruby 3.5.0dev (2025-04-10T09:44:40Z master 684cfa42d7) +YJIT +PRISM [arm64-darwin24]
built-ruby: ruby 3.5.0dev (2025-04-10T10:13:43Z lazy-id-to-obj d3aa9626cc) +YJIT +PRISM [arm64-darwin24]
warming up..

|           |compare-ruby|built-ruby|
|:----------|-----------:|---------:|
|baseline   |     26.364M|   25.974M|
|           |       1.01x|         -|
|object_id  |     10.293M|   14.202M|
|           |           -|     1.38x|
```
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove a puts in test_finalizer_thread_raise</title>
<updated>2024-10-15T13:10:35+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2024-10-11T15:23:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=3da3cabf982eaa4d2c9732651f6a9e18ffd0aba3'/>
<id>3da3cabf982eaa4d2c9732651f6a9e18ffd0aba3</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Replace all GC.disable with EnvUtil.without_gc</title>
<updated>2024-09-17T14:34:26+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2024-09-16T19:29:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=0160dafc4c52b84bb1f989670b54186505649493'/>
<id>0160dafc4c52b84bb1f989670b54186505649493</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Increase timeout of test_finalizer</title>
<updated>2024-08-14T20:23:22+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2024-08-14T20:23:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=fd974f5d740b9b5af63ecfdef3ee092b69e437a3'/>
<id>fd974f5d740b9b5af63ecfdef3ee092b69e437a3</id>
<content type='text'>
The test is timing out on lpi4a so a longer timeout should fix it.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The test is timing out on lpi4a so a longer timeout should fix it.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix crash when GC runs during finalizers at shutdown</title>
<updated>2024-08-14T17:49:52+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2024-08-14T15:31:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=0610f1b083738bb0a84cede42fda048fa116404e'/>
<id>0610f1b083738bb0a84cede42fda048fa116404e</id>
<content type='text'>
We need to remove from the finalizer_table after running all the
finalizers because GC could trigger during the finalizer which could
reclaim the finalizer table array.

The following code crashes:

    1_000_000.times do
      o = Object.new
      ObjectSpace.define_finalizer(o, proc { })
    end
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We need to remove from the finalizer_table after running all the
finalizers because GC could trigger during the finalizer which could
reclaim the finalizer table array.

The following code crashes:

    1_000_000.times do
      o = Object.new
      ObjectSpace.define_finalizer(o, proc { })
    end
</pre>
</div>
</content>
</entry>
<entry>
<title>Refactor how object IDs work for special consts</title>
<updated>2024-04-12T15:27:08+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2024-04-11T18:30:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=edec690e0331b5aa851b3a7c9872b2bf92f3cb21'/>
<id>edec690e0331b5aa851b3a7c9872b2bf92f3cb21</id>
<content type='text'>
We don't need to treat static symbols in any special way since they
can't be confused with other special consts or GC managed objects.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We don't need to treat static symbols in any special way since they
can't be confused with other special consts or GC managed objects.
</pre>
</div>
</content>
</entry>
<entry>
<title>Add RVALUE_OVERHEAD and move ractor_belonging_id</title>
<updated>2022-11-21T16:26:26+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2022-11-18T15:07:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=5f95228c76e6f6994eb4149217fe3e38f9ff8a27'/>
<id>5f95228c76e6f6994eb4149217fe3e38f9ff8a27</id>
<content type='text'>
This commit adds RVALUE_OVERHEAD for storing metadata at the end of the
slot. This commit moves the ractor_belonging_id in debug builds from the
flags to RVALUE_OVERHEAD which frees the 16 bits in the headers for
object shapes.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This commit adds RVALUE_OVERHEAD for storing metadata at the end of the
slot. This commit moves the ractor_belonging_id in debug builds from the
flags to RVALUE_OVERHEAD which frees the 16 bits in the headers for
object shapes.
</pre>
</div>
</content>
</entry>
</feed>
