<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/zjit.rb, branch v4.0.4</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>ZJIT: Avoid runtime exceptions from RubyVM::ZJIT.stats_string (#16139)</title>
<updated>2026-02-10T18:46:40+00:00</updated>
<author>
<name>Takashi Kokubun</name>
<email>takashikkbn@gmail.com</email>
</author>
<published>2026-02-10T18:46:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=f3bfffe8565b08b3426003aebbe328a0ecedad26'/>
<id>f3bfffe8565b08b3426003aebbe328a0ecedad26</id>
<content type='text'>
Before this it would raise if zjit wasn't enabled
and raise a different exception if zjit was but extended stats were
not (_some_ stats are available).

Co-authored-by: Randy Stauner &lt;randy@r4s6.net&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Before this it would raise if zjit wasn't enabled
and raise a different exception if zjit was but extended stats were
not (_some_ stats are available).

Co-authored-by: Randy Stauner &lt;randy@r4s6.net&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>ZJIT: Add dump to file for --zjit-stats (#15414)</title>
<updated>2025-12-09T23:14:49+00:00</updated>
<author>
<name>Aiden Fox Ivey</name>
<email>aiden@aidenfoxivey.com</email>
</author>
<published>2025-12-09T23:14:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=29c29c2b7e972359ab83038c5dc27a7e53ae65c7'/>
<id>29c29c2b7e972359ab83038c5dc27a7e53ae65c7</id>
<content type='text'>
* ZJIT: Add dump to file for --zjit-stats

* ZJIT: Rename --zjit-stats=quiet to --zjit-stats-quiet</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* ZJIT: Add dump to file for --zjit-stats

* ZJIT: Rename --zjit-stats=quiet to --zjit-stats-quiet</pre>
</div>
</content>
</entry>
<entry>
<title>ZJIT: Count fallback reasons for set/get/definedivar (#15324)</title>
<updated>2025-11-26T23:36:00+00:00</updated>
<author>
<name>Max Bernstein</name>
<email>rubybugs@bernsteinbear.com</email>
</author>
<published>2025-11-26T23:36:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=db94a79da432bcdb9d48517733f11ccf03c7cd5d'/>
<id>db94a79da432bcdb9d48517733f11ccf03c7cd5d</id>
<content type='text'>
lobsters:

```
Top-4 setivar fallback reasons (100.0% of total 7,789,008):
  shape_transition: 6,074,085 (78.0%)
   not_monomorphic: 1,484,013 (19.1%)
      not_t_object:   172,629 ( 2.2%)
       too_complex:    58,281 ( 0.7%)
Top-3 getivar fallback reasons (100.0% of total 9,348,832):
     not_t_object: 4,658,833 (49.8%)
  not_monomorphic: 4,542,316 (48.6%)
      too_complex:   147,683 ( 1.6%)
Top-3 definedivar fallback reasons (100.0% of total 366,383):
  not_monomorphic: 361,389 (98.6%)
      too_complex:   3,062 ( 0.8%)
     not_t_object:   1,932 ( 0.5%)
```

railsbench:

```
Top-3 setivar fallback reasons (100.0% of total 15,119,057):
  shape_transition: 13,760,763 (91.0%)
   not_monomorphic:    982,368 ( 6.5%)
      not_t_object:    375,926 ( 2.5%)
Top-2 getivar fallback reasons (100.0% of total 14,438,747):
     not_t_object: 7,643,870 (52.9%)
  not_monomorphic: 6,794,877 (47.1%)
Top-2 definedivar fallback reasons (100.0% of total 209,613):
  not_monomorphic: 209,526 (100.0%)
     not_t_object:      87 ( 0.0%)
```

shipit:

```
Top-3 setivar fallback reasons (100.0% of total 14,516,254):
  shape_transition: 8,613,512 (59.3%)
   not_monomorphic: 5,761,398 (39.7%)
      not_t_object:   141,344 ( 1.0%)
Top-2 getivar fallback reasons (100.0% of total 21,016,444):
  not_monomorphic: 11,313,482 (53.8%)
     not_t_object:  9,702,962 (46.2%)
Top-2 definedivar fallback reasons (100.0% of total 290,382):
  not_monomorphic: 287,755 (99.1%)
     not_t_object:   2,627 ( 0.9%)
```</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
lobsters:

```
Top-4 setivar fallback reasons (100.0% of total 7,789,008):
  shape_transition: 6,074,085 (78.0%)
   not_monomorphic: 1,484,013 (19.1%)
      not_t_object:   172,629 ( 2.2%)
       too_complex:    58,281 ( 0.7%)
Top-3 getivar fallback reasons (100.0% of total 9,348,832):
     not_t_object: 4,658,833 (49.8%)
  not_monomorphic: 4,542,316 (48.6%)
      too_complex:   147,683 ( 1.6%)
Top-3 definedivar fallback reasons (100.0% of total 366,383):
  not_monomorphic: 361,389 (98.6%)
      too_complex:   3,062 ( 0.8%)
     not_t_object:   1,932 ( 0.5%)
```

railsbench:

```
Top-3 setivar fallback reasons (100.0% of total 15,119,057):
  shape_transition: 13,760,763 (91.0%)
   not_monomorphic:    982,368 ( 6.5%)
      not_t_object:    375,926 ( 2.5%)
Top-2 getivar fallback reasons (100.0% of total 14,438,747):
     not_t_object: 7,643,870 (52.9%)
  not_monomorphic: 6,794,877 (47.1%)
Top-2 definedivar fallback reasons (100.0% of total 209,613):
  not_monomorphic: 209,526 (100.0%)
     not_t_object:      87 ( 0.0%)
```

shipit:

```
Top-3 setivar fallback reasons (100.0% of total 14,516,254):
  shape_transition: 8,613,512 (59.3%)
   not_monomorphic: 5,761,398 (39.7%)
      not_t_object:   141,344 ( 1.0%)
Top-2 getivar fallback reasons (100.0% of total 21,016,444):
  not_monomorphic: 11,313,482 (53.8%)
     not_t_object:  9,702,962 (46.2%)
Top-2 definedivar fallback reasons (100.0% of total 290,382):
  not_monomorphic: 287,755 (99.1%)
     not_t_object:   2,627 ( 0.9%)
```</pre>
</div>
</content>
</entry>
<entry>
<title>ZJIT: Count all calls to C functions from generated code (#15240)</title>
<updated>2025-11-19T20:58:24+00:00</updated>
<author>
<name>Max Bernstein</name>
<email>rubybugs@bernsteinbear.com</email>
</author>
<published>2025-11-19T20:58:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=4a1af72a13d41dcc38af7d69ea1f44856265d43f'/>
<id>4a1af72a13d41dcc38af7d69ea1f44856265d43f</id>
<content type='text'>
lobsters:

```
Top-20 calls to C functions from JIT code (79.9% of total 97,004,883):
                             rb_vm_opt_send_without_block: 19,874,212 (20.5%)
                                rb_vm_setinstancevariable:  9,774,841 (10.1%)
                                              rb_ivar_get:  9,358,866 ( 9.6%)
                                             rb_hash_aref:  6,828,948 ( 7.0%)
                                               rb_vm_send:  6,441,551 ( 6.6%)
                                          rb_vm_env_write:  5,375,989 ( 5.5%)
                                        rb_vm_invokesuper:  3,037,836 ( 3.1%)
                                               Module#===:  2,562,446 ( 2.6%)
                                             rb_ary_entry:  2,354,546 ( 2.4%)
                                             Kernel#is_a?:  1,424,092 ( 1.5%)
                               rb_vm_opt_getconstant_path:  1,344,923 ( 1.4%)
                                           Thread.current:  1,300,822 ( 1.3%)
                                     rb_zjit_defined_ivar:  1,222,613 ( 1.3%)
                                        rb_vm_invokeblock:  1,184,555 ( 1.2%)
                                                 Hash#[]=:  1,061,969 ( 1.1%)
                                              rb_ary_push:  1,024,987 ( 1.1%)
                                          rb_ary_new_capa:    904,003 ( 0.9%)
                                        rb_str_buf_append:    833,782 ( 0.9%)
                               rb_class_allocate_instance:    822,626 ( 0.8%)
                                               Hash#fetch:    755,913 ( 0.8%)
```

railsbench:

```
Top-20 calls to C functions from JIT code (74.8% of total 189,170,268):
               rb_vm_opt_send_without_block: 29,870,307 (15.8%)
                  rb_vm_setinstancevariable: 17,631,199 ( 9.3%)
                               rb_hash_aref: 16,928,890 ( 8.9%)
                                rb_ivar_get: 14,441,240 ( 7.6%)
                            rb_vm_env_write: 11,571,001 ( 6.1%)
                                 rb_vm_send: 11,153,457 ( 5.9%)
                          rb_vm_invokesuper:  7,568,267 ( 4.0%)
                                 Module#===:  6,065,923 ( 3.2%)
                                   Hash#[]=:  2,842,990 ( 1.5%)
                               rb_ary_entry:  2,766,125 ( 1.5%)
                                rb_ary_push:  2,722,079 ( 1.4%)
                          rb_vm_invokeblock:  2,594,398 ( 1.4%)
                             Thread.current:  2,560,129 ( 1.4%)
                             rb_str_getbyte:  1,965,627 ( 1.0%)
                               Kernel#is_a?:  1,961,815 ( 1.0%)
                 rb_vm_opt_getconstant_path:  1,863,678 ( 1.0%)
                      rb_hash_new_with_size:  1,796,456 ( 0.9%)
                 rb_class_allocate_instance:  1,785,043 ( 0.9%)
                              String#empty?:  1,713,414 ( 0.9%)
                            rb_ary_new_capa:  1,678,834 ( 0.9%)
```

shipit:

```
Top-20 calls to C functions from JIT code (83.4% of total 182,402,821):
                             rb_vm_opt_send_without_block: 45,753,484 (25.1%)
                                              rb_ivar_get: 21,020,650 (11.5%)
                                rb_vm_setinstancevariable: 17,528,603 ( 9.6%)
                                             rb_hash_aref: 11,892,856 ( 6.5%)
                                               rb_vm_send: 11,723,471 ( 6.4%)
                                          rb_vm_env_write: 10,434,452 ( 5.7%)
                                               Module#===:  4,225,048 ( 2.3%)
                                        rb_vm_invokesuper:  3,705,906 ( 2.0%)
                                           Thread.current:  3,337,603 ( 1.8%)
                                             rb_ary_entry:  3,114,378 ( 1.7%)
                                                 Hash#[]=:  2,509,912 ( 1.4%)
                                             Array#empty?:  2,282,994 ( 1.3%)
                                        rb_vm_invokeblock:  2,210,511 ( 1.2%)
                                               Hash#fetch:  2,017,960 ( 1.1%)
                                                    _bi20:  1,975,147 ( 1.1%)
                                     rb_zjit_defined_ivar:  1,897,127 ( 1.0%)
                               rb_vm_opt_getconstant_path:  1,813,294 ( 1.0%)
                                          rb_ary_new_capa:  1,615,406 ( 0.9%)
                                             Kernel#is_a?:  1,567,854 ( 0.9%)
                               rb_class_allocate_instance:  1,560,035 ( 0.9%)
```

Thanks to @eregon for the idea.

Co-authored-by: Jacob Denbeaux &lt;jacob.denbeaux@shopify.com&gt;
Co-authored-by: Alan Wu &lt;XrXr@users.noreply.github.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
lobsters:

```
Top-20 calls to C functions from JIT code (79.9% of total 97,004,883):
                             rb_vm_opt_send_without_block: 19,874,212 (20.5%)
                                rb_vm_setinstancevariable:  9,774,841 (10.1%)
                                              rb_ivar_get:  9,358,866 ( 9.6%)
                                             rb_hash_aref:  6,828,948 ( 7.0%)
                                               rb_vm_send:  6,441,551 ( 6.6%)
                                          rb_vm_env_write:  5,375,989 ( 5.5%)
                                        rb_vm_invokesuper:  3,037,836 ( 3.1%)
                                               Module#===:  2,562,446 ( 2.6%)
                                             rb_ary_entry:  2,354,546 ( 2.4%)
                                             Kernel#is_a?:  1,424,092 ( 1.5%)
                               rb_vm_opt_getconstant_path:  1,344,923 ( 1.4%)
                                           Thread.current:  1,300,822 ( 1.3%)
                                     rb_zjit_defined_ivar:  1,222,613 ( 1.3%)
                                        rb_vm_invokeblock:  1,184,555 ( 1.2%)
                                                 Hash#[]=:  1,061,969 ( 1.1%)
                                              rb_ary_push:  1,024,987 ( 1.1%)
                                          rb_ary_new_capa:    904,003 ( 0.9%)
                                        rb_str_buf_append:    833,782 ( 0.9%)
                               rb_class_allocate_instance:    822,626 ( 0.8%)
                                               Hash#fetch:    755,913 ( 0.8%)
```

railsbench:

```
Top-20 calls to C functions from JIT code (74.8% of total 189,170,268):
               rb_vm_opt_send_without_block: 29,870,307 (15.8%)
                  rb_vm_setinstancevariable: 17,631,199 ( 9.3%)
                               rb_hash_aref: 16,928,890 ( 8.9%)
                                rb_ivar_get: 14,441,240 ( 7.6%)
                            rb_vm_env_write: 11,571,001 ( 6.1%)
                                 rb_vm_send: 11,153,457 ( 5.9%)
                          rb_vm_invokesuper:  7,568,267 ( 4.0%)
                                 Module#===:  6,065,923 ( 3.2%)
                                   Hash#[]=:  2,842,990 ( 1.5%)
                               rb_ary_entry:  2,766,125 ( 1.5%)
                                rb_ary_push:  2,722,079 ( 1.4%)
                          rb_vm_invokeblock:  2,594,398 ( 1.4%)
                             Thread.current:  2,560,129 ( 1.4%)
                             rb_str_getbyte:  1,965,627 ( 1.0%)
                               Kernel#is_a?:  1,961,815 ( 1.0%)
                 rb_vm_opt_getconstant_path:  1,863,678 ( 1.0%)
                      rb_hash_new_with_size:  1,796,456 ( 0.9%)
                 rb_class_allocate_instance:  1,785,043 ( 0.9%)
                              String#empty?:  1,713,414 ( 0.9%)
                            rb_ary_new_capa:  1,678,834 ( 0.9%)
```

shipit:

```
Top-20 calls to C functions from JIT code (83.4% of total 182,402,821):
                             rb_vm_opt_send_without_block: 45,753,484 (25.1%)
                                              rb_ivar_get: 21,020,650 (11.5%)
                                rb_vm_setinstancevariable: 17,528,603 ( 9.6%)
                                             rb_hash_aref: 11,892,856 ( 6.5%)
                                               rb_vm_send: 11,723,471 ( 6.4%)
                                          rb_vm_env_write: 10,434,452 ( 5.7%)
                                               Module#===:  4,225,048 ( 2.3%)
                                        rb_vm_invokesuper:  3,705,906 ( 2.0%)
                                           Thread.current:  3,337,603 ( 1.8%)
                                             rb_ary_entry:  3,114,378 ( 1.7%)
                                                 Hash#[]=:  2,509,912 ( 1.4%)
                                             Array#empty?:  2,282,994 ( 1.3%)
                                        rb_vm_invokeblock:  2,210,511 ( 1.2%)
                                               Hash#fetch:  2,017,960 ( 1.1%)
                                                    _bi20:  1,975,147 ( 1.1%)
                                     rb_zjit_defined_ivar:  1,897,127 ( 1.0%)
                               rb_vm_opt_getconstant_path:  1,813,294 ( 1.0%)
                                          rb_ary_new_capa:  1,615,406 ( 0.9%)
                                             Kernel#is_a?:  1,567,854 ( 0.9%)
                               rb_class_allocate_instance:  1,560,035 ( 0.9%)
```

Thanks to @eregon for the idea.

Co-authored-by: Jacob Denbeaux &lt;jacob.denbeaux@shopify.com&gt;
Co-authored-by: Alan Wu &lt;XrXr@users.noreply.github.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>ZJIT: Skip empty counter sections in stats</title>
<updated>2025-11-18T21:57:47+00:00</updated>
<author>
<name>Shannon Skipper</name>
<email>shannonskipper@gmail.com</email>
</author>
<published>2025-11-16T17:01:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=cbe65ebbc3f2b77316d50b94e84df1c00822d0f2'/>
<id>cbe65ebbc3f2b77316d50b94e84df1c00822d0f2</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>ZJIT: Avoid `NaN%` ratio appearing in stats</title>
<updated>2025-11-18T21:57:47+00:00</updated>
<author>
<name>Shannon Skipper</name>
<email>shannonskipper@gmail.com</email>
</author>
<published>2025-11-16T16:21:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=656600371239a4a62e7a26e148af70e98d0fa979'/>
<id>656600371239a4a62e7a26e148af70e98d0fa979</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>ZJIT: add support for lazy `RubyVM::ZJIT.enable`</title>
<updated>2025-11-18T16:35:09+00:00</updated>
<author>
<name>Godfrey Chan</name>
<email>godfreykfc@gmail.com</email>
</author>
<published>2025-11-17T16:15:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=f84bbb423836d9d0d018b8ab71ecceb5868fd5be'/>
<id>f84bbb423836d9d0d018b8ab71ecceb5868fd5be</id>
<content type='text'>
This implements Shopify#854:

- Splits boot-time and enable-time initialization,
  tracks progress with `InitializationState` enum

- Introduces `RubyVM::ZJIT.enable` Ruby method for
  enabling the JIT lazily, if not already enabled

- Introduces `--zjit-disable` flag, which can be
  used alongside the other `--zjit-*` flags but
  prevents enabling the JIT at boot time

- Adds ZJIT infra to support JIT hooks, but this
  is not currently exercised (Shopify/ruby#667)

Left for future enhancements:

- Support kwargs for overriding the CLI flags in
  `RubyVM::ZJIT.enable`

Closes Shopify#854
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This implements Shopify#854:

- Splits boot-time and enable-time initialization,
  tracks progress with `InitializationState` enum

- Introduces `RubyVM::ZJIT.enable` Ruby method for
  enabling the JIT lazily, if not already enabled

- Introduces `--zjit-disable` flag, which can be
  used alongside the other `--zjit-*` flags but
  prevents enabling the JIT at boot time

- Adds ZJIT infra to support JIT hooks, but this
  is not currently exercised (Shopify/ruby#667)

Left for future enhancements:

- Support kwargs for overriding the CLI flags in
  `RubyVM::ZJIT.enable`

Closes Shopify#854
</pre>
</div>
</content>
</entry>
<entry>
<title>ZJIT: Revert patch_point_count counter (#15160)</title>
<updated>2025-11-13T01:06:47+00:00</updated>
<author>
<name>Takashi Kokubun</name>
<email>takashi.kokubun@shopify.com</email>
</author>
<published>2025-11-13T01:06:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=3dd32fdf784dac5769f6a352fa16c42e2c60edf7'/>
<id>3dd32fdf784dac5769f6a352fa16c42e2c60edf7</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>ZJIT: Split unhandled_hir_insn and unknown_newarray_send stats (#15127)</title>
<updated>2025-11-11T00:29:50+00:00</updated>
<author>
<name>Takashi Kokubun</name>
<email>takashi.kokubun@shopify.com</email>
</author>
<published>2025-11-11T00:29:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=d268a551865977160aba99429c29f61c8d7c0eb0'/>
<id>d268a551865977160aba99429c29f61c8d7c0eb0</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>ZJIT: Rename not_optimized_instruction to uncategorized_instruction (#15130)</title>
<updated>2025-11-10T23:16:31+00:00</updated>
<author>
<name>Randy Stauner</name>
<email>randy@r4s6.net</email>
</author>
<published>2025-11-10T23:16:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=f95aa5b2a9d559d6deda1b0aa53aee8198ab3168'/>
<id>f95aa5b2a9d559d6deda1b0aa53aee8198ab3168</id>
<content type='text'>
Make it more obvious that this hasn't been handled and could be
broken down more.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Make it more obvious that this hasn't been handled and could be
broken down more.</pre>
</div>
</content>
</entry>
</feed>
