<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/transient_heap.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>Transition complex objects to "too complex" shape</title>
<updated>2022-12-15T18:06:04+00:00</updated>
<author>
<name>Jemma Issroff</name>
<email>jemmaissroff@gmail.com</email>
</author>
<published>2022-12-08T22:16:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=c1ab6ddc9a6fa228caa5d26b118b54855051279c'/>
<id>c1ab6ddc9a6fa228caa5d26b118b54855051279c</id>
<content type='text'>
When an object becomes "too complex" (in other words it has too many
variations in the shape tree), we transition it to use a "too complex"
shape and use a hash for storing instance variables.

Without this patch, there were rare cases where shape tree growth could
"explode" and cause performance degradation on what would otherwise have
been cached fast paths.

This patch puts a limit on shape tree growth, and gracefully degrades in
the rare case where there could be a factorial growth in the shape tree.

For example:

```ruby
class NG; end

HUGE_NUMBER.times do
  NG.new.instance_variable_set(:"@unique_ivar_#{_1}", 1)
end
```

We consider objects to be "too complex" when the object's class has more
than SHAPE_MAX_VARIATIONS (currently 8) leaf nodes in the shape tree and
the object introduces a new variation (a new leaf node) associated with
that class.

For example, new variations on instances of the following class would be
considered "too complex" because those instances create more than 8
leaves in the shape tree:

```ruby
class Foo; end
9.times { Foo.new.instance_variable_set(":@uniq_#{_1}", 1) }
```

However, the following class is *not* too complex because it only has
one leaf in the shape tree:

```ruby
class Foo
  def initialize
    @a = @b = @c = @d = @e = @f = @g = @h = @i = nil
  end
end
9.times { Foo.new }
``

This case is rare, so we don't expect this change to impact performance
of most applications, but it needs to be handled.

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 an object becomes "too complex" (in other words it has too many
variations in the shape tree), we transition it to use a "too complex"
shape and use a hash for storing instance variables.

Without this patch, there were rare cases where shape tree growth could
"explode" and cause performance degradation on what would otherwise have
been cached fast paths.

This patch puts a limit on shape tree growth, and gracefully degrades in
the rare case where there could be a factorial growth in the shape tree.

For example:

```ruby
class NG; end

HUGE_NUMBER.times do
  NG.new.instance_variable_set(:"@unique_ivar_#{_1}", 1)
end
```

We consider objects to be "too complex" when the object's class has more
than SHAPE_MAX_VARIATIONS (currently 8) leaf nodes in the shape tree and
the object introduces a new variation (a new leaf node) associated with
that class.

For example, new variations on instances of the following class would be
considered "too complex" because those instances create more than 8
leaves in the shape tree:

```ruby
class Foo; end
9.times { Foo.new.instance_variable_set(":@uniq_#{_1}", 1) }
```

However, the following class is *not* too complex because it only has
one leaf in the shape tree:

```ruby
class Foo
  def initialize
    @a = @b = @c = @d = @e = @f = @g = @h = @i = nil
  end
end
9.times { Foo.new }
``

This case is rare, so we don't expect this change to impact performance
of most applications, but it needs to be handled.

Co-Authored-By: Aaron Patterson &lt;tenderlove@ruby-lang.org&gt;
</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>
<entry>
<title>Refactor macros of array.c</title>
<updated>2022-07-21T13:02:45+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2022-07-20T19:30:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=1c9acb6bb1822f9d914b40dcea0b3ead849165cd'/>
<id>1c9acb6bb1822f9d914b40dcea0b3ead849165cd</id>
<content type='text'>
Move some macros in array.c to internal/array.h so that other files
can also access these macros.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Move some macros in array.c to internal/array.h so that other files
can also access these macros.
</pre>
</div>
</content>
</entry>
<entry>
<title>`USE_RUBY_DEBUG_LOG` doesn't check `RUBY_DEVEL`</title>
<updated>2021-12-28T15:22:02+00:00</updated>
<author>
<name>Koichi Sasada</name>
<email>ko1@atdot.net</email>
</author>
<published>2021-12-28T08:58:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=c9af8a32a05b26d45c5c8967902b3a724f3c1be6'/>
<id>c9af8a32a05b26d45c5c8967902b3a724f3c1be6</id>
<content type='text'>
`USE_RUBY_DEBUG_LOG` was only defined when `RUBY_DEVEL` is defined.
This patch removes this dependency (`USE_RUBY_DEBUG_LOG` is defined
independently from `RUBY_DEVEL`).

Do not commit a patch which enables `USE_RUBY_DEBUG_LOG`.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
`USE_RUBY_DEBUG_LOG` was only defined when `RUBY_DEVEL` is defined.
This patch removes this dependency (`USE_RUBY_DEBUG_LOG` is defined
independently from `RUBY_DEVEL`).

Do not commit a patch which enables `USE_RUBY_DEBUG_LOG`.
</pre>
</div>
</content>
</entry>
<entry>
<title>Suppress undef warnings for USE_RUBY_DEBUG_LOG</title>
<updated>2021-12-25T09:04:25+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2021-12-25T08:09:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=975a6efd7ea144275d4774d18ff0f568c1a1dc97'/>
<id>975a6efd7ea144275d4774d18ff0f568c1a1dc97</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Allow configuring TRANSIENT_HEAP_TOTAL_SIZE</title>
<updated>2021-12-10T08:15:17+00:00</updated>
<author>
<name>Yuta Saito</name>
<email>kateinoigakukun@gmail.com</email>
</author>
<published>2021-12-06T02:26:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=787daea6d2199c34d951aa3de0f3048829a8ea13'/>
<id>787daea6d2199c34d951aa3de0f3048829a8ea13</id>
<content type='text'>
Some platforms have memory resource limits, but theap's memory area is
too large for such situations. So allow configuring the size at
build-time.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Some platforms have memory resource limits, but theap's memory area is
too large for such situations. So allow configuring the size at
build-time.
</pre>
</div>
</content>
</entry>
<entry>
<title>Supress `warning: data argument not used by format string [-Wformat-extra-args]`</title>
<updated>2021-10-19T22:48:30+00:00</updated>
<author>
<name>Kazuhiro NISHIYAMA</name>
<email>zn@mbf.nifty.com</email>
</author>
<published>2021-09-28T09:00:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=9b18f1bffe056f9f3e0c37b7c847ecb3ca942307'/>
<id>9b18f1bffe056f9f3e0c37b7c847ecb3ca942307</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>cancel theap on multi-ractors</title>
<updated>2020-12-06T23:28:36+00:00</updated>
<author>
<name>Koichi Sasada</name>
<email>ko1@atdot.net</email>
</author>
<published>2020-12-04T21:15:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=307732ccee7f9f28f8422bab2f839da021d8cdec'/>
<id>307732ccee7f9f28f8422bab2f839da021d8cdec</id>
<content type='text'>
accessing theap needs complicating synchronization but it reduce
performance on multi-ractor mode. So simply stop using theap
on multi-ractor mode. In future, theap should be replaced with
more cleaver memory strategy.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
accessing theap needs complicating synchronization but it reduce
performance on multi-ractor mode. So simply stop using theap
on multi-ractor mode. In future, theap should be replaced with
more cleaver memory strategy.
</pre>
</div>
</content>
</entry>
<entry>
<title>should stop other ractors on transient_heap_evacuate</title>
<updated>2020-11-25T07:14:01+00:00</updated>
<author>
<name>Koichi Sasada</name>
<email>ko1@atdot.net</email>
</author>
<published>2020-11-25T07:14:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=7aaf6676c416e773b0b3053de2e250a73c2b2e77'/>
<id>7aaf6676c416e773b0b3053de2e250a73c2b2e77</id>
<content type='text'>
transient_heap_evacuate() evacuates all living objects from theap
to malloc mangaed memory. This evacuation can run in any ractors
in parallel with other ractor's execution and it is danger.

To stop such danger parallel execution, use rb_vm_barrier() to
stop all other ractors.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
transient_heap_evacuate() evacuates all living objects from theap
to malloc mangaed memory. This evacuation can run in any ractors
in parallel with other ractor's execution and it is danger.

To stop such danger parallel execution, use rb_vm_barrier() to
stop all other ractors.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix USE_TRANSIENT_HEAP macro usage in hash.c</title>
<updated>2020-11-18T22:11:36+00:00</updated>
<author>
<name>Cristian Greco</name>
<email>cristian@regolo.cc</email>
</author>
<published>2020-11-18T18:04:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=ce3c9a34379015473ad6559e75c59e93159894e5'/>
<id>ce3c9a34379015473ad6559e75c59e93159894e5</id>
<content type='text'>
Additionally fix some typos in transient heap.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Additionally fix some typos in transient heap.
</pre>
</div>
</content>
</entry>
</feed>
