<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/ruby.git/ractor.c, branch ruby_3_2</title>
<subtitle>github.com: ruby/ruby.git
</subtitle>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/ruby.git/'/>
<entry>
<title>MJIT: Cancel all on disastrous situations (#7019)</title>
<updated>2022-12-24T09:13:40+00:00</updated>
<author>
<name>Takashi Kokubun</name>
<email>takashikkbn@gmail.com</email>
</author>
<published>2022-12-24T09:13:40+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/ruby.git/commit/?id=b9332ac8e7126066ac4238443d63eaa4c06789f9'/>
<id>b9332ac8e7126066ac4238443d63eaa4c06789f9</id>
<content type='text'>
I noticed this while running test_yjit with --mjit-call-threshold=1, 
which redefines `Integer#&lt;`. When Ruby is monkey-patched, 
MJIT itself could be broken.

Similarly, Ruby scripts could break MJIT in many different ways. I
prepared the same set of hooks as YJIT so that we could possibly
override it and disable it on those moments. Every constant under
RubyVM::MJIT is private and thus it's an unsupported behavior though.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I noticed this while running test_yjit with --mjit-call-threshold=1, 
which redefines `Integer#&lt;`. When Ruby is monkey-patched, 
MJIT itself could be broken.

Similarly, Ruby scripts could break MJIT in many different ways. I
prepared the same set of hooks as YJIT so that we could possibly
override it and disable it on those moments. Every constant under
RubyVM::MJIT is private and thus it's an unsupported behavior though.</pre>
</div>
</content>
</entry>
<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='http://91.123.203.49/cgit/delta/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='http://91.123.203.49/cgit/delta/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>[Bug #19081] Show the caller location in warning for Ractor</title>
<updated>2022-10-26T10:43:14+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2022-10-26T10:43:14+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/ruby.git/commit/?id=131c31a9209c61f84d318aa18b61f468f48b8219'/>
<id>131c31a9209c61f84d318aa18b61f468f48b8219</id>
<content type='text'>
The internal location in ractor.rb is not usefull at all.
```
$ ruby -e 'Ractor.new {}'
&lt;internal:ractor&gt;:267: warning: Ractor is experimental, ...
```</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The internal location in ractor.rb is not usefull at all.
```
$ ruby -e 'Ractor.new {}'
&lt;internal:ractor&gt;:267: warning: Ractor is experimental, ...
```</pre>
</div>
</content>
</entry>
<entry>
<title>More precisely iterate over Object instance variables</title>
<updated>2022-10-15T17:44:10+00:00</updated>
<author>
<name>Aaron Patterson</name>
<email>tenderlove@ruby-lang.org</email>
</author>
<published>2022-10-15T16:37:44+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/ruby.git/commit/?id=f0654b1027d2f24cbb6e3cfb0c5946b70f06739b'/>
<id>f0654b1027d2f24cbb6e3cfb0c5946b70f06739b</id>
<content type='text'>
Shapes provides us with an (almost) exact count of instance variables.
We only need to check for Qundef when an IV has been "undefined"
Prefer to use ROBJECT_IV_COUNT when iterating IVs
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Shapes provides us with an (almost) exact count of instance variables.
We only need to check for Qundef when an IV has been "undefined"
Prefer to use ROBJECT_IV_COUNT when iterating IVs
</pre>
</div>
</content>
</entry>
<entry>
<title>obj_refer_only_sharables_p_i: need derefernce</title>
<updated>2022-09-21T02:44:09+00:00</updated>
<author>
<name>卜部昌平</name>
<email>shyouhei@ruby-lang.org</email>
</author>
<published>2022-09-13T06:18:46+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/ruby.git/commit/?id=406ebb25a017dba5b066a42a1c325e57fa644e95'/>
<id>406ebb25a017dba5b066a42a1c325e57fa644e95</id>
<content type='text'>
Clang says "warning: variable 'pcnt' set but not used" here.  In fact it
doesn't. The intention is clear that we want to increment cnt, not pcnt.
Adding a * mark solves everything.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Clang says "warning: variable 'pcnt' set but not used" here.  In fact it
doesn't. The intention is clear that we want to increment cnt, not pcnt.
Adding a * mark solves everything.
</pre>
</div>
</content>
</entry>
<entry>
<title>Disable Ractor check on 32bit architectures</title>
<updated>2022-08-24T17:54:27+00:00</updated>
<author>
<name>Aaron Patterson</name>
<email>tenderlove@ruby-lang.org</email>
</author>
<published>2022-08-23T20:23:40+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/ruby.git/commit/?id=28a3434634a0116a6f2b9e2df0bcbbfb0cfbd28b'/>
<id>28a3434634a0116a6f2b9e2df0bcbbfb0cfbd28b</id>
<content type='text'>
Ractor verification requires storing the ractor id in the top 32 bits of
the object header.  Unfortunately 32 bit machines only have 32 bits in
the object header.  The verification code has a 32 bit left shift which
doesn't work on i686 and will clobber existing flags.

This commit disables the verification code on i686 since i686 will crash
if it's enabled.

Co-Authored-By: John Hawthorn &lt;john@hawthorn.email&gt;
Co-Authored-By: Jemma Issroff &lt;jemmaissroff@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Ractor verification requires storing the ractor id in the top 32 bits of
the object header.  Unfortunately 32 bit machines only have 32 bits in
the object header.  The verification code has a 32 bit left shift which
doesn't work on i686 and will clobber existing flags.

This commit disables the verification code on i686 since i686 will crash
if it's enabled.

Co-Authored-By: John Hawthorn &lt;john@hawthorn.email&gt;
Co-Authored-By: Jemma Issroff &lt;jemmaissroff@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Add "rb_" prefixes to toplevel enum definitions</title>
<updated>2022-07-22T14:10:24+00:00</updated>
<author>
<name>Yusuke Endoh</name>
<email>mame@ruby-lang.org</email>
</author>
<published>2022-07-22T07:57:25+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/ruby.git/commit/?id=8f7e18882269ef3747312a390b06f02f7e2c98eb'/>
<id>8f7e18882269ef3747312a390b06f02f7e2c98eb</id>
<content type='text'>
... as per ko1's request.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
... as per ko1's request.
</pre>
</div>
</content>
</entry>
<entry>
<title>Expand tabs [ci skip]</title>
<updated>2022-07-21T16:42:04+00:00</updated>
<author>
<name>Takashi Kokubun</name>
<email>takashikkbn@gmail.com</email>
</author>
<published>2022-07-21T16:23:58+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/ruby.git/commit/?id=5b21e94bebed90180d8ff63dad03b8b948361089'/>
<id>5b21e94bebed90180d8ff63dad03b8b948361089</id>
<content type='text'>
[Misc #18891]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[Misc #18891]
</pre>
</div>
</content>
</entry>
<entry>
<title>rename thread internal naming</title>
<updated>2022-04-21T22:54:09+00:00</updated>
<author>
<name>Koichi Sasada</name>
<email>ko1@atdot.net</email>
</author>
<published>2022-04-16T18:40:23+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/ruby.git/commit/?id=1c4fc0241d125879e1e5169f267f26637772f3a7'/>
<id>1c4fc0241d125879e1e5169f267f26637772f3a7</id>
<content type='text'>
Now GVL is not process *Global* so this patch try to use
another words.

* `rb_global_vm_lock_t` -&gt; `struct rb_thread_sched`
  * `gvl-&gt;owner` -&gt; `sched-&gt;running`
  * `gvl-&gt;waitq` -&gt; `sched-&gt;readyq`
* `rb_gvl_init` -&gt; `rb_thread_sched_init`
* `gvl_destroy` -&gt; `rb_thread_sched_destroy`
* `gvl_acquire` -&gt; `thread_sched_to_running` # waiting -&gt; ready -&gt; running
* `gvl_release` -&gt; `thread_sched_to_waiting` # running -&gt; waiting
* `gvl_yield`   -&gt; `thread_sched_yield`
* `GVL_UNLOCK_BEGIN` -&gt; `THREAD_BLOCKING_BEGIN`
* `GVL_UNLOCK_END` -&gt; `THREAD_BLOCKING_END`

* removed
  * `rb_ractor_gvl`
  * `rb_vm_gvl_destroy` (not used)

There are GVL functions such as `rb_thread_call_without_gvl()` yet
but I don't have good name to replace them. Maybe GVL stands for
"Greate Valuable Lock" or something like that.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Now GVL is not process *Global* so this patch try to use
another words.

* `rb_global_vm_lock_t` -&gt; `struct rb_thread_sched`
  * `gvl-&gt;owner` -&gt; `sched-&gt;running`
  * `gvl-&gt;waitq` -&gt; `sched-&gt;readyq`
* `rb_gvl_init` -&gt; `rb_thread_sched_init`
* `gvl_destroy` -&gt; `rb_thread_sched_destroy`
* `gvl_acquire` -&gt; `thread_sched_to_running` # waiting -&gt; ready -&gt; running
* `gvl_release` -&gt; `thread_sched_to_waiting` # running -&gt; waiting
* `gvl_yield`   -&gt; `thread_sched_yield`
* `GVL_UNLOCK_BEGIN` -&gt; `THREAD_BLOCKING_BEGIN`
* `GVL_UNLOCK_END` -&gt; `THREAD_BLOCKING_END`

* removed
  * `rb_ractor_gvl`
  * `rb_vm_gvl_destroy` (not used)

There are GVL functions such as `rb_thread_call_without_gvl()` yet
but I don't have good name to replace them. Maybe GVL stands for
"Greate Valuable Lock" or something like that.
</pre>
</div>
</content>
</entry>
</feed>
