<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/mjit_c.rb, 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) 8b236e0c66da8f92e9fc33de66cfbc8e4b0c0763: [Backport #19896]</title>
<updated>2023-09-30T04:46:29+00:00</updated>
<author>
<name>nagachika</name>
<email>nagachika@ruby-lang.org</email>
</author>
<published>2023-09-30T04:46:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=97b7070ebd5493de8d3a6a9b0ecc91bef5068d3f'/>
<id>97b7070ebd5493de8d3a6a9b0ecc91bef5068d3f</id>
<content type='text'>
	[Bug #19896]

	fix memory leak in vm_method

	This introduces a unified reference_count to clarify who is referencing a method.
	This also allows us to treat the refinement method as the def owner since it counts itself as a reference

	Co-authored-by: Peter Zhu &lt;peter@peterzhu.ca&gt;
	---
	 gc.c                     |   4 +-
	 method.h                 |   6 +--
	 rjit_c.rb                |   6 +--
	 test/ruby/test_module.rb |   4 +-
	 vm_insnhelper.c          |   2 +-
	 vm_method.c              | 105 +++++++++++++++++++----------------------------
	 6 files changed, 54 insertions(+), 73 deletions(-)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	[Bug #19896]

	fix memory leak in vm_method

	This introduces a unified reference_count to clarify who is referencing a method.
	This also allows us to treat the refinement method as the def owner since it counts itself as a reference

	Co-authored-by: Peter Zhu &lt;peter@peterzhu.ca&gt;
	---
	 gc.c                     |   4 +-
	 method.h                 |   6 +--
	 rjit_c.rb                |   6 +--
	 test/ruby/test_module.rb |   4 +-
	 vm_insnhelper.c          |   2 +-
	 vm_method.c              | 105 +++++++++++++++++++----------------------------
	 6 files changed, 54 insertions(+), 73 deletions(-)
</pre>
</div>
</content>
</entry>
<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='https://git.ruby-lang.org/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>Remove MJIT's private constants from docs [ci skip]</title>
<updated>2022-12-22T19:35:46+00:00</updated>
<author>
<name>Takashi Kokubun</name>
<email>takashikkbn@gmail.com</email>
</author>
<published>2022-12-22T19:35:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=9dcee2d80ee995e11b0fd437d4a94930ccb6db67'/>
<id>9dcee2d80ee995e11b0fd437d4a94930ccb6db67</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>MJIT: Compile methods in batches (#6900)</title>
<updated>2022-12-11T06:21:06+00:00</updated>
<author>
<name>Takashi Kokubun</name>
<email>takashikkbn@gmail.com</email>
</author>
<published>2022-12-11T06:21:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=9d59d093bd99ca7f4266dec1e9b4cd8b5efbd2d4'/>
<id>9d59d093bd99ca7f4266dec1e9b4cd8b5efbd2d4</id>
<content type='text'>
* MJIT: Compile methods in batches

* MJIT: make mjit-bindgen

* MJIT: Fix RubyVM::MJIT tests</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* MJIT: Compile methods in batches

* MJIT: make mjit-bindgen

* MJIT: Fix RubyVM::MJIT tests</pre>
</div>
</content>
</entry>
<entry>
<title>MJIT: Clarify jit_unit is only for MJIT</title>
<updated>2022-12-09T07:43:09+00:00</updated>
<author>
<name>Takashi Kokubun</name>
<email>takashikkbn@gmail.com</email>
</author>
<published>2022-12-09T07:41:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=8893913ae6da33662201d0a0e6ba2d37f50630ca'/>
<id>8893913ae6da33662201d0a0e6ba2d37f50630ca</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>MJIT: Convert compact_p flag to an enum</title>
<updated>2022-12-09T06:53:58+00:00</updated>
<author>
<name>Takashi Kokubun</name>
<email>takashikkbn@gmail.com</email>
</author>
<published>2022-12-09T06:53:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=0dc5c117a5eb8773b717ef79c4f78ccf0e3981d5'/>
<id>0dc5c117a5eb8773b717ef79c4f78ccf0e3981d5</id>
<content type='text'>
I'm gonna add another type of unit shortly.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I'm gonna add another type of unit shortly.
</pre>
</div>
</content>
</entry>
<entry>
<title>Stop transitioning to UNDEF when undefining an instance variable</title>
<updated>2022-12-07T17:57:11+00:00</updated>
<author>
<name>Aaron Patterson</name>
<email>tenderlove@ruby-lang.org</email>
</author>
<published>2022-12-06T00:48:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=edc7af48acd12666a2945f30901d16b62a39f474'/>
<id>edc7af48acd12666a2945f30901d16b62a39f474</id>
<content type='text'>
Cases like this:

```ruby
obj = Object.new
loop do
  obj.instance_variable_set(:@foo, 1)
  obj.remove_instance_variable(:@foo)
end
```

can cause us to use many more shapes than we want (and even run out).
This commit changes the code such that when an instance variable is
removed, we'll walk up the shape tree, find the shape, then rebuild any
child nodes that happened to be below the "targetted for removal" IV.

This also requires moving any instance variables so that indexes derived
from the shape tree will work correctly.

Co-Authored-By: Jemma Issroff &lt;jemmaissroff@gmail.com&gt;
Co-authored-by: John Hawthorn &lt;jhawthorn@github.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Cases like this:

```ruby
obj = Object.new
loop do
  obj.instance_variable_set(:@foo, 1)
  obj.remove_instance_variable(:@foo)
end
```

can cause us to use many more shapes than we want (and even run out).
This commit changes the code such that when an instance variable is
removed, we'll walk up the shape tree, find the shape, then rebuild any
child nodes that happened to be below the "targetted for removal" IV.

This also requires moving any instance variables so that indexes derived
from the shape tree will work correctly.

Co-Authored-By: Jemma Issroff &lt;jemmaissroff@gmail.com&gt;
Co-authored-by: John Hawthorn &lt;jhawthorn@github.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Set max_iv_count (used for object shapes) based on inline caches</title>
<updated>2022-12-06T21:43:42+00:00</updated>
<author>
<name>Jemma Issroff</name>
<email>jemmaissroff@gmail.com</email>
</author>
<published>2022-12-06T19:52:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=40a9964b893fee5680b455d0e905155be3360685'/>
<id>40a9964b893fee5680b455d0e905155be3360685</id>
<content type='text'>
With this change, we're storing the iv name on an inline cache on
setinstancevariable instructions. This allows us to check the inline
cache to count instance variables set in initialize and give us an
estimate of iv capacity for an object.

For the purpose of estimating the number of instance variables required
for an object, we're assuming that all initialize methods will call
`super`.

This change allows us to estimate the number of instance variables
required without disassembling instruction sequences.

Co-Authored-By: Aaron Patterson &lt;tenderlove@ruby-lang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
With this change, we're storing the iv name on an inline cache on
setinstancevariable instructions. This allows us to check the inline
cache to count instance variables set in initialize and give us an
estimate of iv capacity for an object.

For the purpose of estimating the number of instance variables required
for an object, we're assuming that all initialize methods will call
`super`.

This change allows us to estimate the number of instance variables
required without disassembling instruction sequences.

Co-Authored-By: Aaron Patterson &lt;tenderlove@ruby-lang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Improve packing of iseq_constant_body struct</title>
<updated>2022-12-02T00:31:54+00:00</updated>
<author>
<name>John Hawthorn</name>
<email>john@hawthorn.email</email>
</author>
<published>2022-12-01T19:51:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=def258e77544409df507c0fa153cf40e84d65082'/>
<id>def258e77544409df507c0fa153cf40e84d65082</id>
<content type='text'>
By moving the two bools into a packing gap above the mark_bits
pointer/union we can save 8 bytes in the struct and avoid an extra cache
line (328 bytes vs 320 bytes).

Co-authored-by: Adam Hess &lt;HParker@github.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
By moving the two bools into a packing gap above the mark_bits
pointer/union we can save 8 bytes in the struct and avoid an extra cache
line (328 bytes vs 320 bytes).

Co-authored-by: Adam Hess &lt;HParker@github.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Introduce `Fiber#storage` for inheritable fiber-scoped variables. (#6612)</title>
<updated>2022-12-01T10:00:33+00:00</updated>
<author>
<name>Samuel Williams</name>
<email>samuel.williams@oriontransfer.co.nz</email>
</author>
<published>2022-12-01T10:00:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=0436f1e15a8e79ffef5ea412ac1312cbf9f063e6'/>
<id>0436f1e15a8e79ffef5ea412ac1312cbf9f063e6</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
