96800 Commits

Author SHA1 Message Date
Benoit Daloze
ae5efb55d1 [ruby/prism] Simplify and optimize Prism::Node#tunnel
* By comparing byte offsets which folds 3 branches into 1.
* Also avoids allocation of Location objects.

https://github.com/ruby/prism/commit/71fcb891e0
2026-01-19 12:03:33 +00:00
Benoit Daloze
e85fd7c878 [ruby/prism] Fix docs of opening_loc/closing_loc of BlockNode
https://github.com/ruby/prism/commit/0b22d9060a
2026-01-19 12:03:33 +00:00
dependabot[bot]
aa31754e56 Bump actions/cache in /.github/actions/setup/directories
Bumps [actions/cache](https://github.com/actions/cache) from 5.0.1 to 5.0.2.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](9255dc7a25...8b402f58fb)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-version: 5.0.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-01-19 18:56:44 +09:00
Earlopain
3c9ca23ba4 [ruby/prism] Remove duplicate lex tests
`RipperTest` already does this (added in https://github.com/ruby/prism/pull/3849)
Since it doesn't use the token classes, it also lists out all the excludes instead of just claiming some are passing.

https://github.com/ruby/prism/commit/e86a28263c
2026-01-19 07:46:48 +00:00
Hiroshi SHIBATA
df479f41f8 [ruby/rubygems] Added another usage of pristine command
ref. https://github.com/rubygems/guides/issues/388

https://github.com/ruby/rubygems/commit/43f3768f09
2026-01-19 07:14:33 +00:00
Sutou Kouhei
fb75e99efe [ruby/rubygems] Add missing .binmode for Gem::AtomicFileWriter
In https://github.com/ruby/rubygems/pull/9202, I commented that `temp_file.binmode` is redundant. But I
was wrong. We need `temp_file.binmode` even when we specify
`File::BINARY`. Sorry.

https://github.com/ruby/rubygems/commit/d9f1f5c6a6
2026-01-19 07:10:42 +00:00
Hiroshi SHIBATA
631bf19b37
Skip Onigmo file sync. This target is only for commit sync. 2026-01-19 12:51:30 +09:00
dependabot[bot]
ed116239c7 Bump actions/cache from 5.0.1 to 5.0.2
Bumps [actions/cache](https://github.com/actions/cache) from 5.0.1 to 5.0.2.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](9255dc7a25...8b402f58fb)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-version: 5.0.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-01-18 18:34:27 -08:00
Herwin
b4a62a1ca9
[DOC] Update docs for rb_interned_str and related functions (#15897)
Related to [Bug #21842].

* rb_interned_str: document what decides whether the returned string is
  in US-ASCII or BINARY encoding.
* rb_interned_str_cstr: include the same description as rb_interned_str
  for the encoding. This one was still missing the update for US-ASCII
  and erroneously said the returned string was alwasy in BINARY encoding
* rb_str_to_interned_str: document how the encoding of the result is
  defined.

Co-authored-by: Herwin <herwinw@users.noreply.github.com>
2026-01-19 11:16:47 +09:00
Peter Zhu
64c142770a [ruby/mmtk] Fix assertion in rb_gc_impl_ractor_cache_free for RUBY_FREE_AT_EXIT
https://github.com/ruby/mmtk/commit/e2a89d5a22
2026-01-18 21:34:57 +00:00
Peter Zhu
b7e9e66b59 [ruby/mmtk] Check RUBY_FL_FINALIZE on new location of object if moved
https://github.com/ruby/mmtk/commit/a31deee342
2026-01-18 21:34:57 +00:00
Peter Zhu
4111c5465f [ruby/mmtk] Replace RUBY_ASSERT with MMTK_ASSERT
https://github.com/ruby/mmtk/commit/e92baf15ef
2026-01-18 21:34:57 +00:00
tomoya ishida
b536c6a849
[DOC] Remove _emphasis_ in code blocks which is not handled as emphasis anymore (#15901) 2026-01-19 04:59:09 +09:00
tomoya ishida
37c7ee536d
[DOC] Replace rdoc style codeblocks with markdown style backtick codeblocks in markdown documents (#15900) 2026-01-19 02:25:02 +09:00
Jean Boussier
43d879d3ac rb_file_join_fastpath: removed useless StringValueCStr 2026-01-18 17:15:36 +01:00
Peter Zhu
19450d85d6 [DOC] Improve docs for ObjectSpace.define_finalizer 2026-01-18 10:47:13 -05:00
Jean Boussier
7e0e9984d0 rb_file_join_fastpath: optimize searching for separators
`chompdirsep` searches from the start of the string each time, which
perhaps is necessary for certain encodings (not even sure?) but for
the common encodings it's very wasteful. Instead we can start from the
back of the string and only compare one or two characters in most cases.

Also replace `StringValueCStr` for the simpler `rb_str_null_check`
as we only care about whether the string contains `NULL` bytes, we
don't care whether it is NULL terminated or not.

We also only check the final string for NULLs.

```
compare-ruby: ruby 4.1.0dev (2026-01-17T14:40:03Z master 00a3b71eaf) +PRISM [arm64-darwin25]
built-ruby: ruby 4.1.0dev (2026-01-18T12:55:15Z spedup-file-join 5948e92e03) +PRISM [arm64-darwin25]
warming up....

|              |compare-ruby|built-ruby|
|:-------------|-----------:|---------:|
|two_strings   |      2.477M|   19.317M|
|              |           -|     7.80x|
|many_strings  |    547.577k|   10.298M|
|              |           -|    18.81x|
|array         |    515.280k|  523.291k|
|              |           -|     1.02x|
|mixed         |    621.840k|  635.422k|
|              |           -|     1.02x|
```
2026-01-18 16:31:31 +01:00
Jean Boussier
6cd4549060 Optimize File.join common use case
`File.join` is a hotspot for common libraries such as Zeitwerk
and Bootsnap. It has a fairly flexible signature, but 99% of
the time it's called with just two (or a small number of) UTF-8 strings.

If we optimistically optimize for that use case we can cut down a large
number of type and encoding checks, significantly speeding up the method.

The one remaining expensive check we could try to optimize is `str_null_check`.
Given it's common to use the same base string for joining, we could memoize it.
Also we could precompute it for literal strings.

```
compare-ruby: ruby 4.1.0dev (2026-01-17T14:40:03Z master 00a3b71eaf) +PRISM [arm64-darwin25]
built-ruby: ruby 4.1.0dev (2026-01-18T12:10:38Z spedup-file-join 069bab58d4) +PRISM [arm64-darwin25]
warming up....

|              |compare-ruby|built-ruby|
|:-------------|-----------:|---------:|
|two_strings   |      2.475M|    9.444M|
|              |           -|     3.82x|
|many_strings  |    551.975k|    2.346M|
|              |           -|     4.25x|
|array         |    514.946k|  522.034k|
|              |           -|     1.01x|
|mixed         |    621.236k|  633.189k|
|              |           -|     1.02x|
```
2026-01-18 16:31:31 +01:00
Earlopain
d1dc4bdb2f [ruby/prism] Fix ripper translator for __END__
https://github.com/ruby/prism/commit/2792ac78ca
2026-01-18 14:07:06 +00:00
Peter Zhu
00a3b71eaf [DOC] Improve docs for ObjectSpace.memsize_of_all 2026-01-17 09:40:03 -05:00
Masafumi Koba
81e06e7004 [ruby/timeout] Improve Timeout.timeout documentation formatting and typos
This commit makes a few minor improvements to the documentation of the `Timeout.timeout` method.
The changes include fixing typos and enhancing formatting for better readability.

We can see the latest version of the documentation here:
https://docs.ruby-lang.org/en/master/Timeout.html#method-c-timeout

Also, we can verify this change locally by running:

```shell
rdoc
open doc/Timeout.html
```

https://github.com/ruby/timeout/commit/53ee559e15
2026-01-17 14:05:07 +00:00
Nobuyoshi Nakada
78b7646bdb
[Bug #21842] Let rb_interned_str return US-ASCII if possible 2026-01-17 14:19:15 +09:00
Nobuyoshi Nakada
8ca2f6489b
Revert "Fix rb_interned_str: create strings with BINARY (akak ASCII_8BIT) encoding"
This reverts commit 1f3c52dc155fb7fbc42fc8e146924091ba1dfa20.
2026-01-17 13:38:55 +09:00
Max Bernstein
3e13b7d4ef ZJIT: Fix land race
InvokeProc and HIR effects landed without an intermediate rebase so we
got a conflict in the form of a type checker error (not handled new
opcode in a new function).
2026-01-16 23:07:00 -05:00
Nozomi Hijikata
0e0fad1e58
ZJIT: Specialize OPTIMIZED_METHOD_TYPE_CALL (#15859)
Closes: https://github.com/Shopify/ruby/issues/865

## Benchmark 
### lobsters
- wall clock time
  - before patch: Average of last 10, non-warmup iters: 809ms
  - after patch: Average of last 10, non-warmup iters: 754ms
- zjit stats below

<details>

<summary>before patch</summary>

```
***ZJIT: Printing ZJIT statistics on exit***
Top-20 not inlined C methods (54.9% of total 18,003,698):
                                               Hash#fetch: 3,184,106 (17.7%)
                                            Regexp#match?:   707,148 ( 3.9%)
                                                Hash#key?:   689,879 ( 3.8%)
                                              String#sub!:   489,841 ( 2.7%)
                                           Array#include?:   470,648 ( 2.6%)
                                             Set#include?:   397,520 ( 2.2%)
                                                String#<<:   396,279 ( 2.2%)
                                       String#start_with?:   373,666 ( 2.1%)
                                               Kernel#dup:   352,617 ( 2.0%)
                                               Array#any?:   350,454 ( 1.9%)
                                              Hash#delete:   331,784 ( 1.8%)
                                               String.new:   307,248 ( 1.7%)
                                              Integer#===:   262,336 ( 1.5%)
                                         Symbol#end_with?:   255,538 ( 1.4%)
                                             Kernel#is_a?:   247,292 ( 1.4%)
                                    Process.clock_gettime:   221,588 ( 1.2%)
                                                Integer#>:   219,718 ( 1.2%)
                                            String#match?:   216,903 ( 1.2%)
                                          String#downcase:   213,108 ( 1.2%)
                                               Integer#<=:   202,617 ( 1.1%)
Top-20 calls to C functions from JIT code (80.3% of total 130,255,689):
                             rb_vm_opt_send_without_block: 28,329,698 (21.7%)
                                             rb_hash_aref:  8,992,191 ( 6.9%)
                                          rb_vm_env_write:  8,526,087 ( 6.5%)
                                               rb_vm_send:  8,337,448 ( 6.4%)
                     rb_zjit_writebarrier_check_immediate:  7,809,310 ( 6.0%)
                                        rb_obj_is_kind_of:  6,098,929 ( 4.7%)
                                rb_vm_getinstancevariable:  5,783,055 ( 4.4%)
                                        rb_vm_invokesuper:  5,038,443 ( 3.9%)
                           rb_ivar_get_at_no_ractor_check:  4,762,093 ( 3.7%)
                                             rb_ary_entry:  4,283,966 ( 3.3%)
                                             rb_hash_aset:  2,429,862 ( 1.9%)
                                rb_vm_setinstancevariable:  2,343,571 ( 1.8%)
                               rb_vm_opt_getconstant_path:  2,284,810 ( 1.8%)
                                               Hash#fetch:  1,778,515 ( 1.4%)
                                                    fetch:  1,405,591 ( 1.1%)
                                        rb_vm_invokeblock:  1,381,332 ( 1.1%)
                                        rb_str_buf_append:  1,362,272 ( 1.0%)
                                rb_ec_ary_new_from_values:  1,324,997 ( 1.0%)
                               rb_class_allocate_instance:  1,288,936 ( 1.0%)
                                    rb_hash_new_with_size:    998,628 ( 0.8%)
Top-2 not optimized method types for send (100.0% of total 4,896,274):
  iseq: 4,893,452 (99.9%)
  null:     2,822 ( 0.1%)
Top-4 not optimized method types for send_without_block (100.0% of total 782,296):
        optimized_send: 479,562 (61.3%)
        optimized_call: 256,609 (32.8%)
                  null:  41,967 ( 5.4%)
  optimized_block_call:   4,158 ( 0.5%)
Top-4 instructions with uncategorized fallback reason (100.0% of total 7,250,555):
             invokesuper: 5,038,443 (69.5%)
             invokeblock: 1,381,332 (19.1%)
             sendforward:   798,924 (11.0%)
  opt_send_without_block:    31,856 ( 0.4%)
Top-18 send fallback reasons (100.0% of total 43,885,845):
                          send_without_block_polymorphic: 18,533,639 (42.2%)
                                           uncategorized:  7,250,555 (16.5%)
                          send_not_optimized_method_type:  4,896,274 (11.2%)
                          send_without_block_no_profiles:  4,741,871 (10.8%)
                                        send_no_profiles:  2,865,577 ( 6.5%)
                            one_or_more_complex_arg_pass:  2,825,240 ( 6.4%)
  send_without_block_not_optimized_method_type_optimized:    740,329 ( 1.7%)
                          send_without_block_megamorphic:    709,818 ( 1.6%)
                                        send_polymorphic:    541,186 ( 1.2%)
        send_without_block_not_optimized_need_permission:    382,622 ( 0.9%)
                                   too_many_args_for_lir:    173,244 ( 0.4%)
                                     argc_param_mismatch:     50,382 ( 0.1%)
            send_without_block_not_optimized_method_type:     41,967 ( 0.1%)
                 send_without_block_cfunc_array_variadic:     36,302 ( 0.1%)
                                obj_to_string_not_string:     34,169 ( 0.1%)
              send_without_block_direct_keyword_mismatch:     32,436 ( 0.1%)
                                        send_megamorphic:     28,613 ( 0.1%)
                          ccall_with_frame_too_many_args:      1,621 ( 0.0%)
Top-4 setivar fallback reasons (100.0% of total 2,343,571):
            not_monomorphic: 2,120,856 (90.5%)
               not_t_object:   125,163 ( 5.3%)
                too_complex:    97,531 ( 4.2%)
  new_shape_needs_extension:        21 ( 0.0%)
Top-2 getivar fallback reasons (100.0% of total 5,908,168):
  not_monomorphic: 5,658,909 (95.8%)
      too_complex:   249,259 ( 4.2%)
Top-3 definedivar fallback reasons (100.0% of total 405,079):
  not_monomorphic: 397,150 (98.0%)
      too_complex:   5,122 ( 1.3%)
     not_t_object:   2,807 ( 0.7%)
Top-6 invokeblock handler (100.0% of total 1,381,332):
   monomorphic_iseq: 685,359 (49.6%)
        polymorphic: 521,992 (37.8%)
  monomorphic_other: 104,640 ( 7.6%)
  monomorphic_ifunc:  55,505 ( 4.0%)
        no_profiles:   9,164 ( 0.7%)
        megamorphic:   4,672 ( 0.3%)
Top-9 popular complex argument-parameter features not optimized (100.0% of total 3,097,538):
       param_kw_opt: 1,333,367 (43.0%)
        param_block:   632,885 (20.4%)
  param_forwardable:   600,601 (19.4%)
         param_rest:   329,020 (10.6%)
       param_kwrest:   119,971 ( 3.9%)
    caller_kw_splat:    39,001 ( 1.3%)
       caller_splat:    36,785 ( 1.2%)
    caller_blockarg:     5,798 ( 0.2%)
       caller_kwarg:       110 ( 0.0%)
Top-1 compile error reasons (100.0% of total 186,900):
  exception_handler: 186,900 (100.0%)
Top-7 unhandled YARV insns (100.0% of total 186,598):
       getblockparam: 99,414 (53.3%)
  invokesuperforward: 81,667 (43.8%)
       setblockparam:  2,837 ( 1.5%)
         getconstant:  1,537 ( 0.8%)
          checkmatch:    616 ( 0.3%)
         expandarray:    360 ( 0.2%)
                once:    167 ( 0.1%)
Top-3 unhandled HIR insns (100.0% of total 236,962):
          throw: 198,474 (83.8%)
  invokebuiltin:  35,767 (15.1%)
      array_max:   2,721 ( 1.1%)
Top-19 side exit reasons (100.0% of total 15,427,184):
                   guard_type_failure: 6,865,696 (44.5%)
                  guard_shape_failure: 6,779,586 (43.9%)
  block_param_proxy_not_iseq_or_ifunc: 1,030,319 ( 6.7%)
                   unhandled_hir_insn:   236,962 ( 1.5%)
                        compile_error:   186,900 ( 1.2%)
                  unhandled_yarv_insn:   186,598 ( 1.2%)
                 fixnum_mult_overflow:    50,739 ( 0.3%)
           block_param_proxy_modified:    28,119 ( 0.2%)
        patchpoint_no_singleton_class:    14,903 ( 0.1%)
         unhandled_newarray_send_pack:    14,481 ( 0.1%)
               fixnum_lshift_overflow:    10,085 ( 0.1%)
     patchpoint_stable_constant_names:     9,198 ( 0.1%)
              patchpoint_no_ep_escape:     7,815 ( 0.1%)
                  expandarray_failure:     4,533 ( 0.0%)
          patchpoint_method_redefined:       662 ( 0.0%)
               obj_to_string_fallback:       277 ( 0.0%)
                   guard_less_failure:       163 ( 0.0%)
                            interrupt:       128 ( 0.0%)
             guard_greater_eq_failure:        20 ( 0.0%)
                             send_count: 151,233,937
                     dynamic_send_count:  43,885,845 (29.0%)
                   optimized_send_count: 107,348,092 (71.0%)
                  dynamic_setivar_count:   2,343,571 ( 1.5%)
                  dynamic_getivar_count:   5,908,168 ( 3.9%)
              dynamic_definedivar_count:     405,079 ( 0.3%)
              iseq_optimized_send_count:  37,324,023 (24.7%)
      inline_cfunc_optimized_send_count:  46,056,028 (30.5%)
       inline_iseq_optimized_send_count:   3,756,875 ( 2.5%)
non_variadic_cfunc_optimized_send_count:  11,618,909 ( 7.7%)
    variadic_cfunc_optimized_send_count:   8,592,257 ( 5.7%)
compiled_iseq_count:                              5,289
failed_iseq_count:                                    0
compile_time:                                   1,664ms
profile_time:                                      13ms
gc_time:                                           20ms
invalidation_time:                                479ms
vm_write_pc_count:                          127,571,422
vm_write_sp_count:                          127,571,422
vm_write_locals_count:                      122,781,971
vm_write_stack_count:                       122,781,971
vm_write_to_parent_iseq_local_count:            689,945
vm_read_from_parent_iseq_local_count:        14,721,820
guard_type_count:                           167,633,896
guard_type_exit_ratio:                             4.1%
guard_shape_count:                                    0
code_region_bytes:                           38,912,000
zjit_alloc_bytes:                            40,542,102
total_mem_bytes:                             79,454,102
side_exit_count:                             15,427,184
total_insn_count:                           927,373,567
vm_insn_count:                              156,976,359
zjit_insn_count:                            770,397,208
ratio_in_zjit:                                    83.1%
```

</details>

<details>

<summary>after patch</summary>

```
***ZJIT: Printing ZJIT statistics on exit***
Top-20 not inlined C methods (55.0% of total 18,012,630):
                                               Hash#fetch: 3,184,101 (17.7%)
                                            Regexp#match?:   707,150 ( 3.9%)
                                                Hash#key?:   689,871 ( 3.8%)
                                              String#sub!:   489,841 ( 2.7%)
                                           Array#include?:   470,648 ( 2.6%)
                                             Set#include?:   397,520 ( 2.2%)
                                                String#<<:   396,279 ( 2.2%)
                                       String#start_with?:   382,538 ( 2.1%)
                                               Kernel#dup:   352,617 ( 2.0%)
                                               Array#any?:   350,454 ( 1.9%)
                                              Hash#delete:   331,802 ( 1.8%)
                                               String.new:   307,248 ( 1.7%)
                                              Integer#===:   262,336 ( 1.5%)
                                         Symbol#end_with?:   255,540 ( 1.4%)
                                             Kernel#is_a?:   247,292 ( 1.4%)
                                    Process.clock_gettime:   221,588 ( 1.2%)
                                                Integer#>:   219,718 ( 1.2%)
                                            String#match?:   216,905 ( 1.2%)
                                          String#downcase:   213,107 ( 1.2%)
                                               Integer#<=:   202,617 ( 1.1%)
Top-20 calls to C functions from JIT code (80.1% of total 130,218,934):
                             rb_vm_opt_send_without_block: 28,073,153 (21.6%)
                                             rb_hash_aref:  8,992,167 ( 6.9%)
                                          rb_vm_env_write:  8,526,089 ( 6.5%)
                                               rb_vm_send:  8,337,453 ( 6.4%)
                     rb_zjit_writebarrier_check_immediate:  7,786,426 ( 6.0%)
                                        rb_obj_is_kind_of:  6,098,927 ( 4.7%)
                                rb_vm_getinstancevariable:  5,783,053 ( 4.4%)
                                        rb_vm_invokesuper:  5,038,444 ( 3.9%)
                           rb_ivar_get_at_no_ractor_check:  4,762,093 ( 3.7%)
                                             rb_ary_entry:  4,283,965 ( 3.3%)
                                             rb_hash_aset:  2,429,864 ( 1.9%)
                                rb_vm_setinstancevariable:  2,343,573 ( 1.8%)
                               rb_vm_opt_getconstant_path:  2,284,809 ( 1.8%)
                                               Hash#fetch:  1,778,510 ( 1.4%)
                                                    fetch:  1,405,591 ( 1.1%)
                                        rb_vm_invokeblock:  1,381,329 ( 1.1%)
                                        rb_str_buf_append:  1,362,272 ( 1.0%)
                                rb_ec_ary_new_from_values:  1,325,005 ( 1.0%)
                               rb_class_allocate_instance:  1,288,944 ( 1.0%)
                                    rb_hash_new_with_size:    998,629 ( 0.8%)
Top-2 not optimized method types for send (100.0% of total 4,896,276):
  iseq: 4,893,454 (99.9%)
  null:     2,822 ( 0.1%)
Top-3 not optimized method types for send_without_block (100.0% of total 525,687):
        optimized_send: 479,562 (91.2%)
                  null:  41,967 ( 8.0%)
  optimized_block_call:   4,158 ( 0.8%)
Top-4 instructions with uncategorized fallback reason (100.0% of total 7,250,556):
             invokesuper: 5,038,444 (69.5%)
             invokeblock: 1,381,329 (19.1%)
             sendforward:   798,924 (11.0%)
  opt_send_without_block:    31,859 ( 0.4%)
Top-18 send fallback reasons (100.0% of total 43,629,303):
                          send_without_block_polymorphic: 18,533,669 (42.5%)
                                           uncategorized:  7,250,556 (16.6%)
                          send_not_optimized_method_type:  4,896,276 (11.2%)
                          send_without_block_no_profiles:  4,741,899 (10.9%)
                                        send_no_profiles:  2,865,579 ( 6.6%)
                            one_or_more_complex_arg_pass:  2,825,242 ( 6.5%)
                          send_without_block_megamorphic:    709,818 ( 1.6%)
                                        send_polymorphic:    541,187 ( 1.2%)
  send_without_block_not_optimized_method_type_optimized:    483,720 ( 1.1%)
        send_without_block_not_optimized_need_permission:    382,623 ( 0.9%)
                                   too_many_args_for_lir:    173,244 ( 0.4%)
                                     argc_param_mismatch:     50,382 ( 0.1%)
            send_without_block_not_optimized_method_type:     41,967 ( 0.1%)
                 send_without_block_cfunc_array_variadic:     36,302 ( 0.1%)
                                obj_to_string_not_string:     34,169 ( 0.1%)
              send_without_block_direct_keyword_mismatch:     32,436 ( 0.1%)
                                        send_megamorphic:     28,613 ( 0.1%)
                          ccall_with_frame_too_many_args:      1,621 ( 0.0%)
Top-4 setivar fallback reasons (100.0% of total 2,343,573):
            not_monomorphic: 2,120,858 (90.5%)
               not_t_object:   125,163 ( 5.3%)
                too_complex:    97,531 ( 4.2%)
  new_shape_needs_extension:        21 ( 0.0%)
Top-2 getivar fallback reasons (100.0% of total 5,908,165):
  not_monomorphic: 5,658,912 (95.8%)
      too_complex:   249,253 ( 4.2%)
Top-3 definedivar fallback reasons (100.0% of total 405,079):
  not_monomorphic: 397,150 (98.0%)
      too_complex:   5,122 ( 1.3%)
     not_t_object:   2,807 ( 0.7%)
Top-6 invokeblock handler (100.0% of total 1,381,329):
   monomorphic_iseq: 685,363 (49.6%)
        polymorphic: 521,984 (37.8%)
  monomorphic_other: 104,640 ( 7.6%)
  monomorphic_ifunc:  55,505 ( 4.0%)
        no_profiles:   9,164 ( 0.7%)
        megamorphic:   4,673 ( 0.3%)
Top-9 popular complex argument-parameter features not optimized (100.0% of total 3,094,719):
       param_kw_opt: 1,333,367 (43.1%)
        param_block:   632,886 (20.5%)
  param_forwardable:   600,605 (19.4%)
         param_rest:   329,019 (10.6%)
       param_kwrest:   119,971 ( 3.9%)
    caller_kw_splat:    39,001 ( 1.3%)
       caller_splat:    33,962 ( 1.1%)
    caller_blockarg:     5,798 ( 0.2%)
       caller_kwarg:       110 ( 0.0%)
Top-1 compile error reasons (100.0% of total 186,917):
  exception_handler: 186,917 (100.0%)
Top-7 unhandled YARV insns (100.0% of total 186,598):
       getblockparam: 99,414 (53.3%)
  invokesuperforward: 81,667 (43.8%)
       setblockparam:  2,837 ( 1.5%)
         getconstant:  1,537 ( 0.8%)
          checkmatch:    616 ( 0.3%)
         expandarray:    360 ( 0.2%)
                once:    167 ( 0.1%)
Top-3 unhandled HIR insns (100.0% of total 236,969):
          throw: 198,475 (83.8%)
  invokebuiltin:  35,773 (15.1%)
      array_max:   2,721 ( 1.1%)
Top-19 side exit reasons (100.0% of total 15,450,102):
                   guard_type_failure: 6,888,596 (44.6%)
                  guard_shape_failure: 6,779,586 (43.9%)
  block_param_proxy_not_iseq_or_ifunc: 1,030,319 ( 6.7%)
                   unhandled_hir_insn:   236,969 ( 1.5%)
                        compile_error:   186,917 ( 1.2%)
                  unhandled_yarv_insn:   186,598 ( 1.2%)
                 fixnum_mult_overflow:    50,739 ( 0.3%)
           block_param_proxy_modified:    28,119 ( 0.2%)
        patchpoint_no_singleton_class:    14,903 ( 0.1%)
         unhandled_newarray_send_pack:    14,481 ( 0.1%)
               fixnum_lshift_overflow:    10,085 ( 0.1%)
     patchpoint_stable_constant_names:     9,198 ( 0.1%)
              patchpoint_no_ep_escape:     7,815 ( 0.1%)
                  expandarray_failure:     4,533 ( 0.0%)
          patchpoint_method_redefined:       662 ( 0.0%)
               obj_to_string_fallback:       277 ( 0.0%)
                   guard_less_failure:       163 ( 0.0%)
                            interrupt:       122 ( 0.0%)
             guard_greater_eq_failure:        20 ( 0.0%)
                             send_count: 150,986,368
                     dynamic_send_count:  43,629,303 (28.9%)
                   optimized_send_count: 107,357,065 (71.1%)
                  dynamic_setivar_count:   2,343,573 ( 1.6%)
                  dynamic_getivar_count:   5,908,165 ( 3.9%)
              dynamic_definedivar_count:     405,079 ( 0.3%)
              iseq_optimized_send_count:  37,324,039 (24.7%)
      inline_cfunc_optimized_send_count:  46,056,046 (30.5%)
       inline_iseq_optimized_send_count:   3,756,881 ( 2.5%)
non_variadic_cfunc_optimized_send_count:  11,618,958 ( 7.7%)
    variadic_cfunc_optimized_send_count:   8,601,141 ( 5.7%)
compiled_iseq_count:                              5,289
failed_iseq_count:                                    0
compile_time:                                   1,700ms
profile_time:                                      13ms
gc_time:                                           21ms
invalidation_time:                                519ms
vm_write_pc_count:                          127,557,549
vm_write_sp_count:                          127,557,549
vm_write_locals_count:                      122,768,084
vm_write_stack_count:                       122,768,084
vm_write_to_parent_iseq_local_count:            689,953
vm_read_from_parent_iseq_local_count:        14,730,705
guard_type_count:                           167,853,730
guard_type_exit_ratio:                             4.1%
guard_shape_count:                                    0
code_region_bytes:                           38,928,384
zjit_alloc_bytes:                            41,103,415
total_mem_bytes:                             80,031,799
side_exit_count:                             15,450,102
total_insn_count:                           927,432,364
vm_insn_count:                              157,182,251
zjit_insn_count:                            770,250,113
ratio_in_zjit:                                    83.1%
```

</details>
2026-01-16 21:19:54 -05:00
Peter Zhu
8a586af33b Don't force major GC when there are allocatable slots
[Bug #21838]

When we have allocatable slots, we can grow the heap instead of forcing
a major GC. This prevents major GC to be ran very often in certain situations.
See the ticket for more details.

On ruby-bench, we can see that this patch doesn't cause any significant
regressions:

    --------------  -----------  ----------  ---------  -----------  ----------  ---------  --------------  -------------
    bench           master (ms)  stddev (%)  RSS (MiB)  branch (ms)  stddev (%)  RSS (MiB)  branch 1st itr  master/branch
    activerecord    148.2        0.3         59.2       150.0        0.8         69.7       1.015           0.988
    chunky-png      435.2        0.3         72.9       438.8        0.1         66.7       0.993           0.992
    erubi-rails     733.8        1.2         118.7      704.8        0.2         98.3       1.077           1.041
    hexapdf         1400.4       1.1         247.0      1405.0       0.9         223.7      0.986           0.997
    liquid-c        32.5         3.3         32.8       32.5         2.1         30.7       1.042           0.999
    liquid-compile  31.0         1.7         35.1       33.4         3.9         32.8       0.938           0.928
    liquid-render   84.7         0.4         30.8       86.3         0.4         30.8       0.981           0.982
    lobsters        594.7        0.6         310.5      596.6        0.4         306.0      1.057           0.997
    mail            75.6         2.8         53.3       76.9         0.7         53.2       0.968           0.982
    psych-load      1122.8       1.2         29.2       1145.1       0.4         31.7       0.964           0.981
    railsbench      1244.7       0.3         115.5      1254.8       1.1         115.2      0.939           0.992
    rubocop         103.7        0.5         94.1       104.3        0.5         92.4       0.985           0.994
    ruby-lsp        88.3         0.6         78.5       88.5         1.2         77.9       0.992           0.997
    sequel          26.9         0.9         33.6       28.3         1.4         32.1       0.954           0.952
    shipit          1119.3       1.5         171.4      1075.7       2.1         162.5      1.873           1.040
    --------------  -----------  ----------  ---------  -----------  ----------  ---------  --------------  -------------
2026-01-16 17:02:03 -05:00
Jean Boussier
1f3c52dc15 Fix rb_interned_str: create strings with BINARY (akak ASCII_8BIT) encoding
[Bug #21842]

The documentation always stated as much, and it's consistent with the
rb_str_* family of functions.
2026-01-16 22:44:38 +01:00
John Hawthorn
c56ce8a6c1 Remove objspace->flags.has_newobj_hook
We aren't using this anymore and the hook is called in gc.c
2026-01-16 12:46:20 -08:00
Earlopain
87147ba5e9 [ruby/prism] Make the ripper shim work with rdoc
The filter class is a 1:1 copy of ruby.

rdoc has 32 test failures. It seems to expect `on_sp` in some cases to render code as written.

https://github.com/ruby/prism/commit/74bb12c825
2026-01-16 20:19:26 +00:00
Jean Boussier
1c7e19f961 rb_free_tmp_buffer: use ruby_sized_xfree
We know the buffer length, we might as well feed that information
back to the GC.
2026-01-16 21:11:17 +01:00
Jean Boussier
3164d4e8a2 [ruby/json] Extract json_fast_memcpy16 for readability
https://github.com/ruby/json/commit/1b276c8623
2026-01-16 17:52:54 +00:00
Scott Myron
456ef9140a [ruby/json] Use __builtin_memcpy, if available, to copy overlapping byte ranges in copy_remaining_bytes to avoid a branch to MEMCPY. Additionally use a space as padding byte instead of an 'X' so it can be represented diretly on AArch64 with a single instruction.
https://github.com/ruby/json/commit/643ee11fed
2026-01-16 17:52:54 +00:00
Jacob
bc6c895d7b
ZJIT: Create HIR effect system (#15359)
**Progress**
I've added a new directory, `zjit/src/hir_effect`. It follows the same structure as `zjit/src/hir_type` and includes:
- a ruby script to generate a rust file containing a bitset of effects we want to track
- a modified `hir.rs` to include an `effects_of` function that catalogs effects for each HIR instruction, similar to `infer_type`. Right now these effects are not specialized, all instructions currently return the top of the lattice (any effect)
- a module file for effects at `zjit/src/hir_effect/mod.rs` that again, mirrors `zjit/src/hir_type/mod.rs`. This contains a lot of helper functions and lattice operations like union and intersection

**Design Idea**
The effect system is bitset-based rather than range-based. This is the first kind of effect system described in [Max's blog post](https://bernsteinbear.com/blog/compiler-effects/).
Practically, having effects defined for each HIR instruction should allow us to have better generalization than the implicit effect system we have for c functions that we annotation as elidable, leaf, etc. Additionally, this could allow us to reason about the effects of multiple HIR instructions unioned together, something I don't believe currently exists.

**Practical Goals**
This PR replaces `has_effects` with a new effects-based `is_elidable` function. This has no behavior change to the JIT, but will make it easier to reason about effects of basic blocks and CCalls with the new design. We may be able to accomplish other quality of life improvements, such as consolidation of `nogc`, `leaf`, and other annotations.
2026-01-16 17:08:20 +00:00
Nobuyoshi Nakada
91744cd202
Include abi.h in the dependency of rubyspec-capiext 2026-01-17 00:15:20 +09:00
Earlopain
074a23ab77 [ruby/prism] Add Ripper.tokenize to translation layer
It's public API and trivial to implement.

https://github.com/ruby/prism/commit/e77545f8b5
2026-01-16 12:07:41 +00:00
Andrii Furmanets
f872901bb2
MatchData: Avoid large stack allocations in MatchData (GH-15872) 2026-01-16 19:52:16 +09:00
Nobuyoshi Nakada
16cd9daa39
Rust interface is out of our scope 2026-01-16 18:27:17 +09:00
Nobuyoshi Nakada
67d4ceb525
Expand rb_data_type_t::reserved for future use 2026-01-16 16:52:32 +09:00
Nobuyoshi Nakada
a797561e25
Update Typed Data dump on debuggers [ci skip] 2026-01-16 16:47:34 +09:00
Nobuyoshi Nakada
f7d3f675fe
Win32: refine handing of missing-baseruby failure
`exit` in `cmd.exe` ignores non-option, non-digits argument, and exits with the current %ERRORLEVEL%.
2026-01-16 11:12:32 +09:00
Nobuyoshi Nakada
8c39d8d343
Win32: fix baseruby at reconfig
Get rid of the built `ruby.exe` in the current directory.
2026-01-16 11:08:53 +09:00
Nobuyoshi Nakada
81420d6e13
Win32: split -basic-vars- step 2026-01-16 11:01:27 +09:00
Peter Zhu
5d2fd5088d Fix duplicate static assert names in imemo.h 2026-01-15 17:57:27 -05:00
Peter Zhu
f7ae32ed3b Pin ID symbols
Symbols with a corresponding ID should be pinned because they can be used
by things that don't support compaction.
2026-01-15 17:57:27 -05:00
Peter Zhu
6e480e6714 Allow symbols to move in compaction 2026-01-15 17:57:27 -05:00
Earlopain
c34c7def5a [ruby/prism] Fix locations for invalid syntax when using expect1_opening
Followup to https://github.com/ruby/prism/pull/3827

It sets the start to the opening but it should instead just
continue on as usual.
Fixes https://github.com/ruby/prism/issues/3851

Notice how the AST actually contains "123" in both the body and end keyword.

https://github.com/ruby/prism/commit/8f69c5af08
2026-01-15 21:15:34 +00:00
Earlopain
15939e3c30 [ruby/prism] Make irb work with the ripper shim
This is everything that `irb` uses. It works in their test-suite, but there are 20 failures when using the shim that I haven't looked into at all.

`parse` is not used by `irb`. `scan` is, and it's basically `parse` but also including errors. `irb` doesn't seem to care about the errors, so I didn't implement that.

https://github.com/ruby/prism/commit/2c5826b39f
2026-01-15 21:03:55 +00:00
nozomemein
ce390f1995 ZJIT: Remove redundant unboxing 2026-01-15 09:00:53 -08:00
nozomemein
844f072ce1 ZJIT: Inline ArrayAref 2026-01-15 09:00:53 -08:00
nozomemein
256c806a1d ZJIT: Write the result of UnboxFixnum HIR as type spec so that we can make use of it later (e.g. fold_constants for ArrayAref) 2026-01-15 09:00:53 -08:00