<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/struct.c, 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>merge revision(s) d7a6ff8224519005d2deeb3f4e98689a8a0835ad: [Backport #21819]</title>
<updated>2026-01-13T01:13:00+00:00</updated>
<author>
<name>Takashi Kokubun</name>
<email>takashikkbn@gmail.com</email>
</author>
<published>2026-01-13T01:13:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=6273c59a6e1f8587e549d5a5f44fd9363e6eb018'/>
<id>6273c59a6e1f8587e549d5a5f44fd9363e6eb018</id>
<content type='text'>
	[PATCH] [Bug #21819] Data objects without members should also be frozen
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	[PATCH] [Bug #21819] Data objects without members should also be frozen
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix fields object in embedded struct</title>
<updated>2025-12-05T23:40:39+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2025-12-05T22:58:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=8f9838476dc8cc857859a0a93da285d792be7d3b'/>
<id>8f9838476dc8cc857859a0a93da285d792be7d3b</id>
<content type='text'>
We don't set RSTRUCT_GEN_FIELDS when RCLASS_MAX_IV_COUNT(klass) != 0, so
we need to set RSTRUCT_SET_FIELDS_OBJ to 0 otherwise it may have an
invalid value and crash.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We don't set RSTRUCT_GEN_FIELDS when RCLASS_MAX_IV_COUNT(klass) != 0, so
we need to set RSTRUCT_SET_FIELDS_OBJ to 0 otherwise it may have an
invalid value and crash.
</pre>
</div>
</content>
</entry>
<entry>
<title>Handle NEWOBJ tracepoints settings fields</title>
<updated>2025-12-03T07:14:56+00:00</updated>
<author>
<name>Jean Boussier</name>
<email>jean.boussier@gmail.com</email>
</author>
<published>2025-11-25T14:06:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=8c3909935e2ba9f79bf3492772c77c305a0d370b'/>
<id>8c3909935e2ba9f79bf3492772c77c305a0d370b</id>
<content type='text'>
[Bug #21710]

- struct.c: `struct_alloc`

It is possible for a `NEWOBJ` tracepoint call back to write fields
into a newly allocated object before `struct_alloc` had the time
to set the `RSTRUCT_GEN_FIELDS` flags and such.

Hence we can't blindly initialize the `fields_obj` reference to `0`
we first need to check no fields were added yet.

- object.c: `rb_class_allocate_instance`

Similarly, if a `NEWOBJ` tracepoint tries to set fields on the object,
the `shape_id` must already be set, as it's required on T_OBJECT to
know where to write fields.

`NEWOBJ_OF` had to be refactored to accept a `shape_id`.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[Bug #21710]

- struct.c: `struct_alloc`

It is possible for a `NEWOBJ` tracepoint call back to write fields
into a newly allocated object before `struct_alloc` had the time
to set the `RSTRUCT_GEN_FIELDS` flags and such.

Hence we can't blindly initialize the `fields_obj` reference to `0`
we first need to check no fields were added yet.

- object.c: `rb_class_allocate_instance`

Similarly, if a `NEWOBJ` tracepoint tries to set fields on the object,
the `shape_id` must already be set, as it's required on T_OBJECT to
know where to write fields.

`NEWOBJ_OF` had to be refactored to accept a `shape_id`.
</pre>
</div>
</content>
</entry>
<entry>
<title>Clear fields on heap RStruct before allocating</title>
<updated>2025-10-03T17:30:14+00:00</updated>
<author>
<name>John Hawthorn</name>
<email>john@hawthorn.email</email>
</author>
<published>2025-10-03T00:47:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=8eaa9eb3eb287063f8e004ecf4d12225214cda42'/>
<id>8eaa9eb3eb287063f8e004ecf4d12225214cda42</id>
<content type='text'>
Now that we no longer explicitly set the first three elements, we need
to ensure the object is in a state safe for GC before we call
struct_heap_alloc, which may GC.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Now that we no longer explicitly set the first three elements, we need
to ensure the object is in a state safe for GC before we call
struct_heap_alloc, which may GC.
</pre>
</div>
</content>
</entry>
<entry>
<title>Clear out memory for newly allocated structs</title>
<updated>2025-09-17T13:25:17+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2025-09-12T19:01:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=a456e79e06faf36caac20d9b33e92a98613c9d07'/>
<id>a456e79e06faf36caac20d9b33e92a98613c9d07</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Struct: keep direct reference to IMEMO/fields when space allows</title>
<updated>2025-08-06T15:07:49+00:00</updated>
<author>
<name>Jean Boussier</name>
<email>jean.boussier@gmail.com</email>
</author>
<published>2025-08-06T12:46:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=f3206cc79bec2fd852e81ec56de59f0a67ab32b7'/>
<id>f3206cc79bec2fd852e81ec56de59f0a67ab32b7</id>
<content type='text'>
It's not rare for structs to have additional ivars, hence are one
of the most common, if not the most common type in the `gen_fields_tbl`.

This can cause Ractor contention, but even in single ractor mode
means having to do a hash lookup to access the ivars, and increase
GC work.

Instead, unless the struct is perfectly right sized, we can store
a reference to the associated IMEMO/fields object right after the
last struct member.

```
compare-ruby: ruby 3.5.0dev (2025-08-06T12:50:36Z struct-ivar-fields-2 9a30d141a1) +PRISM [arm64-darwin24]
built-ruby: ruby 3.5.0dev (2025-08-06T12:57:59Z struct-ivar-fields-2 2ff3ec237f) +PRISM [arm64-darwin24]
warming up.....

|                      |compare-ruby|built-ruby|
|:---------------------|-----------:|---------:|
|member_reader         |    590.317k|  579.246k|
|                      |       1.02x|         -|
|member_writer         |    543.963k|  527.104k|
|                      |       1.03x|         -|
|member_reader_method  |    213.540k|  213.004k|
|                      |       1.00x|         -|
|member_writer_method  |    192.657k|  191.491k|
|                      |       1.01x|         -|
|ivar_reader           |    403.993k|  569.915k|
|                      |           -|     1.41x|
```

Co-Authored-By: Étienne Barrié &lt;etienne.barrie@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It's not rare for structs to have additional ivars, hence are one
of the most common, if not the most common type in the `gen_fields_tbl`.

This can cause Ractor contention, but even in single ractor mode
means having to do a hash lookup to access the ivars, and increase
GC work.

Instead, unless the struct is perfectly right sized, we can store
a reference to the associated IMEMO/fields object right after the
last struct member.

```
compare-ruby: ruby 3.5.0dev (2025-08-06T12:50:36Z struct-ivar-fields-2 9a30d141a1) +PRISM [arm64-darwin24]
built-ruby: ruby 3.5.0dev (2025-08-06T12:57:59Z struct-ivar-fields-2 2ff3ec237f) +PRISM [arm64-darwin24]
warming up.....

|                      |compare-ruby|built-ruby|
|:---------------------|-----------:|---------:|
|member_reader         |    590.317k|  579.246k|
|                      |       1.02x|         -|
|member_writer         |    543.963k|  527.104k|
|                      |       1.03x|         -|
|member_reader_method  |    213.540k|  213.004k|
|                      |       1.00x|         -|
|member_writer_method  |    192.657k|  191.491k|
|                      |       1.01x|         -|
|ivar_reader           |    403.993k|  569.915k|
|                      |           -|     1.41x|
```

Co-Authored-By: Étienne Barrié &lt;etienne.barrie@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[Bug #21440] Stop caching member list in frozen Data/Struct class</title>
<updated>2025-06-13T05:22:06+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2025-06-13T05:15:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=2e7e78cd590d20aa9d41422e96302f3edd73f623'/>
<id>2e7e78cd590d20aa9d41422e96302f3edd73f623</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[DOC] Show `NONE` within `Measure` namespace (#12274)</title>
<updated>2025-01-09T04:53:49+00:00</updated>
<author>
<name>Shannon Skipper</name>
<email>shannonskipper@gmail.com</email>
</author>
<published>2025-01-09T04:53:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=841555245d770df88a0c8079fc97a51ffa7ef8e9'/>
<id>841555245d770df88a0c8079fc97a51ffa7ef8e9</id>
<content type='text'>
Keep `NONE` within `Measure`</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Keep `NONE` within `Measure`</pre>
</div>
</content>
</entry>
<entry>
<title>[DOC] Exclude 'Class' and 'Module' from RDoc's autolinking</title>
<updated>2025-01-02T03:36:06+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2025-01-02T03:36:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=e433e6515efbb31a77ab8013a7e9b2c57212264d'/>
<id>e433e6515efbb31a77ab8013a7e9b2c57212264d</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[DOC] Exclude 'Method' from RDoc's autolinking</title>
<updated>2025-01-02T03:23:49+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2025-01-02T03:06:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=b4ec22fe6c493a212c059cecab90de5b5f349102'/>
<id>b4ec22fe6c493a212c059cecab90de5b5f349102</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
