94528 Commits

Author SHA1 Message Date
Kevin Newton
aa2d3cd513 [ruby/prism] Bump to v1.6.0
https://github.com/ruby/prism/commit/b72fcc6183
2025-10-16 12:43:49 +00:00
Earlopain
f5d3b6e626 [ruby/prism] Add support for Prism.parse(foo, version: "current")
The docs currently say to use `Prism.parse(foo, version: RUBY_VERSION)` for this.
By specifying "current" instead, we can have prism raise a more specifc error.

Note: Does not use `ruby_version` from `ruby/version.h` because writing a test for that is not really possible.
`RUBY_VERSION` is nicely stubbable for both the c-ext and FFI backend.

https://github.com/ruby/prism/commit/9c5cd205cf
2025-10-16 12:34:14 +00:00
Max Bernstein
1d95d75c3f
ZJIT: Profile opt_succ and inline Integer#succ for Fixnum (#14846)
This is only really called a lot in the benchmark harness, as far as I
can tell.
2025-10-15 23:40:45 -04:00
Max Bernstein
7a474e1fbd
ZJIT: Inline String#getbyte (#14842) 2025-10-16 02:01:00 +00:00
John Hawthorn
45c016866c Use explicit memory orders in concurrent_set
The atomic load/store operations here should mostly be using
release/acquire semantics. This may lead to better performance than what
we had under the default seq_cst.

On x86 this may make the atomic store of hash faster, as it can avoid
xchg. On ARM the loads may be faster (depending on target CPU for the
compiler).

Reference for comparison of atomic operations
https://godbolt.org/z/6EdaMa5rG
2025-10-15 18:21:52 -07:00
John Hawthorn
9e4a756963 Use BUILTIN_TYPE in gc_mark_check_t_none 2025-10-15 17:13:19 -07:00
Peter Zhu
5a9fac6939 Fix assert_equal order in test_namespace.rb
The expected value is the first parameter and the actual value is the
second in assert_equal.
2025-10-15 19:29:30 -04:00
Aiden Fox Ivey
d272a81f42 ZJIT: Rewrite arm64_split_with_scratch_reg for clarity
* The while loop pattern can be rewritten to be more idiomatic, which
  also allows the iterator to no longer be mutable.
2025-10-15 17:24:51 -04:00
Alan Wu
4c426e98a8 ZJIT: Use rb_gc_disable() over rb_gc_disable_no_rest()
no_rest() trips an assert inside the GC when we allocate with the GC
disabled this way:

    (gc_continue) ../src/gc/default/default.c:2029
    (newobj_cache_miss+0x128) [0x105040048] ../src/gc/default/default.c:2370
    (rb_gc_impl_new_obj+0x7c) [0x105036374] ../src/gc/default/default.c:2482
    (newobj_of) ../src/gc.c:995
    (rb_method_entry_alloc+0x40) [0x1051e6c64] ../src/vm_method.c:1102
    (rb_method_entry_complement_defined_class) ../src/vm_method.c:1180
    (prepare_callable_method_entry+0x14c) [0x1051e87b8] ../src/vm_method.c:1728
    (callable_method_entry_or_negative+0x1e8) [0x1051e809c] ../src/vm_method.c:1874

It's tries to continue the GC because it was out of space. Looks like
it's not safe to allocate new objects after using
rb_gc_disable_no_rest(); existing usages use it for malloc calls.
2025-10-15 16:36:46 -04:00
Nathan Froyd
b052d706a5 [ruby/prism] explicitly cast constants in initializers as well
https://github.com/ruby/prism/commit/e7db2b06ab
2025-10-15 18:34:43 +00:00
Nathan Froyd
829b1884c0 [ruby/prism] explicitly cast shifted constant to unsigned to avoid undefined behavior
https://github.com/ruby/prism/commit/0b2710a6c9
2025-10-15 18:34:43 +00:00
Aiden Fox Ivey
6a94632d4a
ZJIT: Add HashAref to HIR and inline Hash#[] to HashAref (#14838)
Fixes https://github.com/Shopify/ruby/issues/793

## Testing on `liquid-render`:

<details>

<summary>Before patch:</summary>

```
***ZJIT: Printing ZJIT statistics on exit***
Top-20 not inlined C methods (96.8% of total 20,222,783):
         Kernel#respond_to?: 9,725,886 (48.1%)
                  Hash#key?: 4,589,528 (22.7%)
               Set#include?: 1,493,789 ( 7.4%)
                 String#===:   616,183 ( 3.0%)
                    Hash#[]:   453,675 ( 2.2%)
                  String#<<:   386,831 ( 1.9%)
                 Integer#<<:   319,768 ( 1.6%)
               Kernel#is_a?:   312,176 ( 1.5%)
                  Integer#/:   238,502 ( 1.2%)
              Kernel#format:   238,502 ( 1.2%)
                   Array#<<:   220,724 ( 1.1%)
           Class#last_match:   179,182 ( 0.9%)
                   Hash#[]=:   167,728 ( 0.8%)
  CGI::EscapeExt#escapeHTML:   106,471 ( 0.5%)
                Array#shift:    98,030 ( 0.5%)
              Array#unshift:    90,851 ( 0.4%)
                  String#=~:    90,637 ( 0.4%)
         String#start_with?:    88,122 ( 0.4%)
                 Regexp#===:    85,648 ( 0.4%)
              String#empty?:    80,950 ( 0.4%)
Top-20 not annotated C methods (97.0% of total 20,268,253):
         Kernel#respond_to?: 9,725,886 (48.0%)
                  Hash#key?: 4,589,528 (22.6%)
               Set#include?: 1,493,789 ( 7.4%)
                 String#===:   616,183 ( 3.0%)
                    Hash#[]:   453,675 ( 2.2%)
               Kernel#is_a?:   397,366 ( 2.0%)
                  String#<<:   386,831 ( 1.9%)
                 Integer#<<:   319,768 ( 1.6%)
                  Integer#/:   238,502 ( 1.2%)
              Kernel#format:   238,502 ( 1.2%)
                   Array#<<:   220,724 ( 1.1%)
           Class#last_match:   179,182 ( 0.9%)
                   Hash#[]=:   167,728 ( 0.8%)
  CGI::EscapeExt#escapeHTML:   106,471 ( 0.5%)
                Array#shift:    98,030 ( 0.5%)
              Array#unshift:    90,851 ( 0.4%)
                  String#=~:    90,637 ( 0.4%)
         String#start_with?:    88,122 ( 0.4%)
                 Regexp#===:    85,648 ( 0.4%)
              String#empty?:    80,950 ( 0.4%)
Top-2 not optimized method types for send (100.0% of total 1,180):
   iseq: 602 (51.0%)
  cfunc: 578 (49.0%)
Top-3 not optimized method types for send_without_block (100.0% of total 4,896,785):
       iseq: 4,669,764 (95.4%)
  optimized:   227,001 ( 4.6%)
      alias:        20 ( 0.0%)
Top-9 not optimized instructions (100.0% of total 1,255,287):
             invokeblock: 430,174 (34.3%)
                 opt_neq: 319,471 (25.5%)
                 opt_and: 319,471 (25.5%)
                  opt_eq: 127,926 (10.2%)
                  opt_le:  31,238 ( 2.5%)
             invokesuper:  23,409 ( 1.9%)
               opt_minus:   2,934 ( 0.2%)
  opt_send_without_block:     562 ( 0.0%)
                  opt_or:     102 ( 0.0%)
Top-7 send fallback reasons (100.0% of total 17,930,659):
                              send_no_profiles: 6,145,096 (34.3%)
                send_without_block_polymorphic: 5,459,600 (30.4%)
  send_without_block_not_optimized_method_type: 4,896,785 (27.3%)
                     not_optimized_instruction: 1,255,287 ( 7.0%)
                send_without_block_no_profiles:   170,037 ( 0.9%)
                      obj_to_string_not_string:     2,674 ( 0.0%)
                send_not_optimized_method_type:     1,180 ( 0.0%)
Top-3 unhandled YARV insns (100.0% of total 157,831):
  getclassvariable: 157,694 (99.9%)
              once:     121 ( 0.1%)
       getconstant:      16 ( 0.0%)
Top-2 compile error reasons (100.0% of total 8,905,991):
  register_spill_on_alloc: 8,905,891 (100.0%)
  register_spill_on_ccall:       100 ( 0.0%)
Top-9 side exit reasons (100.0% of total 26,549,652):
                        compile_error: 8,905,991 (33.5%)
                  guard_shape_failure: 6,590,116 (24.8%)
                   guard_type_failure: 4,882,217 (18.4%)
                      unhandled_splat: 4,150,547 (15.6%)
                      unhandled_kwarg: 1,827,728 ( 6.9%)
                  unhandled_yarv_insn:   157,831 ( 0.6%)
                   unhandled_hir_insn:    34,072 ( 0.1%)
                           patchpoint:     1,100 ( 0.0%)
  block_param_proxy_not_iseq_or_ifunc:        50 ( 0.0%)
                             send_count: 72,944,863
                     dynamic_send_count: 17,930,659 (24.6%)
                   optimized_send_count: 55,014,204 (75.4%)
              iseq_optimized_send_count: 26,520,888 (36.4%)
      inline_cfunc_optimized_send_count:  8,270,533 (11.3%)
non_variadic_cfunc_optimized_send_count:  9,344,065 (12.8%)
    variadic_cfunc_optimized_send_count: 10,878,718 (14.9%)
dynamic_getivar_count:                        2,171,396
dynamic_setivar_count:                        1,737,553
compiled_iseq_count:                                383
failed_iseq_count:                                   46
compile_time:                                     820ms
profile_time:                                       4ms
gc_time:                                           22ms
invalidation_time:                                  0ms
vm_write_pc_count:                           71,973,068
vm_write_sp_count:                           71,544,492
vm_write_locals_count:                       71,544,492
vm_write_stack_count:                        71,544,492
vm_write_to_parent_iseq_local_count:          1,070,897
vm_read_from_parent_iseq_local_count:        27,449,010
code_region_bytes:                            2,113,536
side_exit_count:                             26,549,652
total_insn_count:                           908,528,764
vm_insn_count:                              484,633,128
zjit_insn_count:                            423,895,636
ratio_in_zjit:                                    46.7%
```

</details>




<details>

<summary>after patch:</summary>
```
***ZJIT: Printing ZJIT statistics on exit***
Top-20 not inlined C methods (97.2% of total 19,769,108):
         Kernel#respond_to?: 9,725,886 (49.2%)
                  Hash#key?: 4,589,528 (23.2%)
               Set#include?: 1,493,789 ( 7.6%)
                 String#===:   616,183 ( 3.1%)
                  String#<<:   386,831 ( 2.0%)
                 Integer#<<:   319,768 ( 1.6%)
               Kernel#is_a?:   312,176 ( 1.6%)
                  Integer#/:   238,502 ( 1.2%)
              Kernel#format:   238,502 ( 1.2%)
                   Array#<<:   220,724 ( 1.1%)
           Class#last_match:   179,182 ( 0.9%)
                   Hash#[]=:   167,728 ( 0.8%)
  CGI::EscapeExt#escapeHTML:   106,471 ( 0.5%)
                Array#shift:    98,030 ( 0.5%)
              Array#unshift:    90,851 ( 0.5%)
                  String#=~:    90,637 ( 0.5%)
         String#start_with?:    88,122 ( 0.4%)
                 Regexp#===:    85,648 ( 0.4%)
              String#empty?:    80,950 ( 0.4%)
                 Array#push:    78,615 ( 0.4%)
Top-20 not annotated C methods (97.4% of total 19,814,578):
         Kernel#respond_to?: 9,725,886 (49.1%)
                  Hash#key?: 4,589,528 (23.2%)
               Set#include?: 1,493,789 ( 7.5%)
                 String#===:   616,183 ( 3.1%)
               Kernel#is_a?:   397,366 ( 2.0%)
                  String#<<:   386,831 ( 2.0%)
                 Integer#<<:   319,768 ( 1.6%)
                  Integer#/:   238,502 ( 1.2%)
              Kernel#format:   238,502 ( 1.2%)
                   Array#<<:   220,724 ( 1.1%)
           Class#last_match:   179,182 ( 0.9%)
                   Hash#[]=:   167,728 ( 0.8%)
  CGI::EscapeExt#escapeHTML:   106,471 ( 0.5%)
                Array#shift:    98,030 ( 0.5%)
              Array#unshift:    90,851 ( 0.5%)
                  String#=~:    90,637 ( 0.5%)
         String#start_with?:    88,122 ( 0.4%)
                 Regexp#===:    85,648 ( 0.4%)
              String#empty?:    80,950 ( 0.4%)
                 Array#push:    78,615 ( 0.4%)
Top-2 not optimized method types for send (100.0% of total 1,180):
   iseq: 602 (51.0%)
  cfunc: 578 (49.0%)
Top-3 not optimized method types for send_without_block (100.0% of total 4,896,785):
       iseq: 4,669,764 (95.4%)
  optimized:   227,001 ( 4.6%)
      alias:        20 ( 0.0%)
Top-9 not optimized instructions (100.0% of total 1,255,287):
             invokeblock: 430,174 (34.3%)
                 opt_neq: 319,471 (25.5%)
                 opt_and: 319,471 (25.5%)
                  opt_eq: 127,926 (10.2%)
                  opt_le:  31,238 ( 2.5%)
             invokesuper:  23,409 ( 1.9%)
               opt_minus:   2,934 ( 0.2%)
  opt_send_without_block:     562 ( 0.0%)
                  opt_or:     102 ( 0.0%)
Top-7 send fallback reasons (100.0% of total 17,930,659):
                              send_no_profiles: 6,145,096 (34.3%)
                send_without_block_polymorphic: 5,459,600 (30.4%)
  send_without_block_not_optimized_method_type: 4,896,785 (27.3%)
                     not_optimized_instruction: 1,255,287 ( 7.0%)
                send_without_block_no_profiles:   170,037 ( 0.9%)
                      obj_to_string_not_string:     2,674 ( 0.0%)
                send_not_optimized_method_type:     1,180 ( 0.0%)
Top-3 unhandled YARV insns (100.0% of total 157,831):
  getclassvariable: 157,694 (99.9%)
              once:     121 ( 0.1%)
       getconstant:      16 ( 0.0%)
Top-2 compile error reasons (100.0% of total 8,905,991):
  register_spill_on_alloc: 8,905,891 (100.0%)
  register_spill_on_ccall:       100 ( 0.0%)
Top-9 side exit reasons (100.0% of total 26,549,652):
                        compile_error: 8,905,991 (33.5%)
                  guard_shape_failure: 6,590,116 (24.8%)
                   guard_type_failure: 4,882,217 (18.4%)
                      unhandled_splat: 4,150,547 (15.6%)
                      unhandled_kwarg: 1,827,728 ( 6.9%)
                  unhandled_yarv_insn:   157,831 ( 0.6%)
                   unhandled_hir_insn:    34,072 ( 0.1%)
                           patchpoint:     1,100 ( 0.0%)
  block_param_proxy_not_iseq_or_ifunc:        50 ( 0.0%)
                             send_count: 72,491,188
                     dynamic_send_count: 17,930,659 (24.7%)
                   optimized_send_count: 54,560,529 (75.3%)
              iseq_optimized_send_count: 26,520,888 (36.6%)
      inline_cfunc_optimized_send_count:  8,270,533 (11.4%)
non_variadic_cfunc_optimized_send_count:  8,890,390 (12.3%)
    variadic_cfunc_optimized_send_count: 10,878,718 (15.0%)
dynamic_getivar_count:                        2,171,396
dynamic_setivar_count:                        1,737,553
compiled_iseq_count:                                383
failed_iseq_count:                                   46
compile_time:                                     808ms
profile_time:                                       4ms
gc_time:                                           21ms
invalidation_time:                                  0ms
vm_write_pc_count:                           71,973,068
vm_write_sp_count:                           71,544,492
vm_write_locals_count:                       71,544,492
vm_write_stack_count:                        71,544,492
vm_write_to_parent_iseq_local_count:          1,070,897
vm_read_from_parent_iseq_local_count:        27,449,010
code_region_bytes:                            2,097,152
side_exit_count:                             26,549,652
total_insn_count:                           908,528,764
vm_insn_count:                              484,633,128
zjit_insn_count:                            423,895,636
ratio_in_zjit:                                    46.7% 
```
</details>

## Testing on `lobsters`:

<details>

<summary>Before patch:</summary>

```
***ZJIT: Printing ZJIT statistics on exit***
Top-20 not inlined C methods (71.0% of total 28,729,305):
                                    Hash#[]: 8,490,837 (29.6%)
                               Kernel#is_a?: 1,861,955 ( 6.5%)
                                  String#<<: 1,773,932 ( 6.2%)
                                   Hash#[]=: 1,159,328 ( 4.0%)
                              Regexp#match?:   775,654 ( 2.7%)
                              String#empty?:   724,503 ( 2.5%)
                                  Hash#key?:   691,233 ( 2.4%)
                         Kernel#respond_to?:   608,714 ( 2.1%)
                              TrueClass#===:   451,557 ( 1.6%)
                             FalseClass#===:   442,907 ( 1.5%)
                             Array#include?:   429,408 ( 1.5%)
         ActiveSupport::OrderedOptions#_get:   377,468 ( 1.3%)
                         String#start_with?:   373,685 ( 1.3%)
                 ObjectSpace::WeakKeyMap#[]:   356,664 ( 1.2%)
                            Kernel#kind_of?:   349,451 ( 1.2%)
                                 Kernel#dup:   328,120 ( 1.1%)
                                  Class#new:   310,590 ( 1.1%)
                        Kernel#block_given?:   307,113 ( 1.1%)
                                  String#==:   290,654 ( 1.0%)
                                 Hash#fetch:   290,533 ( 1.0%)
Top-20 not annotated C methods (71.7% of total 29,033,802):
                                    Hash#[]: 8,490,847 (29.2%)
                               Kernel#is_a?: 2,231,950 ( 7.7%)
                                  String#<<: 1,773,932 ( 6.1%)
                                   Hash#[]=: 1,159,507 ( 4.0%)
                              Regexp#match?:   775,654 ( 2.7%)
                              String#empty?:   739,580 ( 2.5%)
                                  Hash#key?:   691,233 ( 2.4%)
                         Kernel#respond_to?:   608,714 ( 2.1%)
                              TrueClass#===:   451,557 ( 1.6%)
                             FalseClass#===:   442,907 ( 1.5%)
                             Array#include?:   429,408 ( 1.5%)
         ActiveSupport::OrderedOptions#_get:   377,468 ( 1.3%)
                         String#start_with?:   373,685 ( 1.3%)
                 ObjectSpace::WeakKeyMap#[]:   356,664 ( 1.2%)
                            Kernel#kind_of?:   349,486 ( 1.2%)
                                 Kernel#dup:   328,127 ( 1.1%)
                        Kernel#block_given?:   327,655 ( 1.1%)
                                  Class#new:   310,590 ( 1.1%)
                                  String#==:   296,624 ( 1.0%)
                                 Hash#fetch:   290,533 ( 1.0%)
Top-2 not optimized method types for send (100.0% of total 96,231):
  cfunc: 75,873 (78.8%)
   iseq: 20,358 (21.2%)
Top-6 not optimized method types for send_without_block (100.0% of total 8,044,793):
       iseq: 4,034,262 (50.1%)
    bmethod: 1,757,537 (21.8%)
  optimized: 1,647,169 (20.5%)
      alias:   596,446 ( 7.4%)
       null:     8,161 ( 0.1%)
      cfunc:     1,218 ( 0.0%)
Top-13 not optimized instructions (100.0% of total 7,507,191):
             invokesuper: 4,343,829 (57.9%)
             invokeblock: 1,323,655 (17.6%)
             sendforward:   842,491 (11.2%)
                  opt_eq:   722,952 ( 9.6%)
                opt_plus:   145,599 ( 1.9%)
               opt_minus:    52,269 ( 0.7%)
  opt_send_without_block:    39,595 ( 0.5%)
                 opt_neq:    15,048 ( 0.2%)
                opt_mult:    13,826 ( 0.2%)
                  opt_or:     7,452 ( 0.1%)
                  opt_lt:       348 ( 0.0%)
                  opt_ge:        91 ( 0.0%)
                  opt_gt:        36 ( 0.0%)
Top-9 send fallback reasons (100.0% of total 45,075,567):
                send_without_block_polymorphic: 17,072,731 (37.9%)
                              send_no_profiles: 10,490,735 (23.3%)
  send_without_block_not_optimized_method_type:  8,044,793 (17.8%)
                     not_optimized_instruction:  7,507,191 (16.7%)
                send_without_block_no_profiles:  1,816,853 ( 4.0%)
                send_not_optimized_method_type:     96,231 ( 0.2%)
       send_without_block_cfunc_array_variadic:     31,156 ( 0.1%)
                      obj_to_string_not_string:     15,303 ( 0.0%)
       send_without_block_direct_too_many_args:        574 ( 0.0%)
Top-9 unhandled YARV insns (100.0% of total 1,279,306):
         expandarray: 660,222 (51.6%)
        checkkeyword: 316,124 (24.7%)
    getclassvariable: 119,678 ( 9.4%)
       getblockparam:  88,485 ( 6.9%)
  invokesuperforward:  78,843 ( 6.2%)
   opt_duparray_send:  14,149 ( 1.1%)
         getconstant:   1,496 ( 0.1%)
          checkmatch:     290 ( 0.0%)
                once:      19 ( 0.0%)
Top-2 compile error reasons (100.0% of total 6,508,618):
  register_spill_on_alloc: 6,162,701 (94.7%)
  register_spill_on_ccall:   345,917 ( 5.3%)
Top-14 side exit reasons (100.0% of total 19,988,958):
                        compile_error: 6,508,618 (32.6%)
                   guard_type_failure: 5,255,050 (26.3%)
                  guard_shape_failure: 3,698,481 (18.5%)
                  unhandled_yarv_insn: 1,279,306 ( 6.4%)
  block_param_proxy_not_iseq_or_ifunc:   990,585 ( 5.0%)
                      unhandled_kwarg:   801,146 ( 4.0%)
                unknown_newarray_send:   539,110 ( 2.7%)
                           patchpoint:   496,826 ( 2.5%)
                      unhandled_splat:   242,104 ( 1.2%)
                   unhandled_hir_insn:   147,346 ( 0.7%)
           block_param_proxy_modified:    29,122 ( 0.1%)
                            interrupt:     1,072 ( 0.0%)
               obj_to_string_fallback:       170 ( 0.0%)
               guard_type_not_failure:        22 ( 0.0%)
                             send_count: 118,969,379
                     dynamic_send_count:  45,075,567 (37.9%)
                   optimized_send_count:  73,893,812 (62.1%)
              iseq_optimized_send_count:  32,439,432 (27.3%)
      inline_cfunc_optimized_send_count:  12,725,075 (10.7%)
non_variadic_cfunc_optimized_send_count:  24,121,279 (20.3%)
    variadic_cfunc_optimized_send_count:   4,608,026 ( 3.9%)
dynamic_getivar_count:                      13,002,365
dynamic_setivar_count:                      12,402,229
compiled_iseq_count:                             4,817
failed_iseq_count:                                 466
compile_time:                                  8,961ms
profile_time:                                     68ms
gc_time:                                          41ms
invalidation_time:                               288ms
vm_write_pc_count:                         113,940,194
vm_write_sp_count:                         111,595,088
vm_write_locals_count:                     111,595,088
vm_write_stack_count:                      111,595,088
vm_write_to_parent_iseq_local_count:           514,997
vm_read_from_parent_iseq_local_count:       11,288,600
code_region_bytes:                          22,970,368
side_exit_count:                            19,988,958
total_insn_count:                          928,321,939
vm_insn_count:                             297,374,855
zjit_insn_count:                           630,947,084
ratio_in_zjit:                                   68.0%
```

</details>




<details>

<summary>after patch:</summary>

```
***ZJIT: Printing ZJIT statistics on exit***
Top-20 not inlined C methods (60.9% of total 19,827,919):
                               Kernel#is_a?: 1,827,297 ( 9.2%)
                                  String#<<: 1,764,393 ( 8.9%)
                                   Hash#[]=: 1,159,637 ( 5.8%)
                              Regexp#match?:   775,625 ( 3.9%)
                              String#empty?:   723,469 ( 3.6%)
                                  Hash#key?:   691,214 ( 3.5%)
                         Kernel#respond_to?:   602,389 ( 3.0%)
                              TrueClass#===:   447,671 ( 2.3%)
                             FalseClass#===:   439,274 ( 2.2%)
                             Array#include?:   425,491 ( 2.1%)
                                 Hash#fetch:   382,294 ( 1.9%)
                         String#start_with?:   373,684 ( 1.9%)
                 ObjectSpace::WeakKeyMap#[]:   356,654 ( 1.8%)
                            Kernel#kind_of?:   340,341 ( 1.7%)
                                 Kernel#dup:   328,108 ( 1.7%)
                                  Class#new:   309,571 ( 1.6%)
                        Kernel#block_given?:   307,098 ( 1.5%)
                                  String#==:   286,539 ( 1.4%)
                             BasicObject#!=:   284,640 ( 1.4%)
                              String#length:   256,345 ( 1.3%)
Top-20 not annotated C methods (62.1% of total 20,127,933):
                               Kernel#is_a?: 2,205,849 (11.0%)
                                  String#<<: 1,764,393 ( 8.8%)
                                   Hash#[]=: 1,159,816 ( 5.8%)
                              Regexp#match?:   775,625 ( 3.9%)
                              String#empty?:   738,546 ( 3.7%)
                                  Hash#key?:   691,214 ( 3.4%)
                         Kernel#respond_to?:   602,389 ( 3.0%)
                              TrueClass#===:   447,671 ( 2.2%)
                             FalseClass#===:   439,274 ( 2.2%)
                             Array#include?:   425,491 ( 2.1%)
                                 Hash#fetch:   382,294 ( 1.9%)
                         String#start_with?:   373,684 ( 1.9%)
                 ObjectSpace::WeakKeyMap#[]:   356,654 ( 1.8%)
                            Kernel#kind_of?:   340,375 ( 1.7%)
                                 Kernel#dup:   328,115 ( 1.6%)
                        Kernel#block_given?:   327,640 ( 1.6%)
                                  Class#new:   309,571 ( 1.5%)
                                  String#==:   292,509 ( 1.5%)
                             BasicObject#!=:   284,824 ( 1.4%)
                              String#length:   256,345 ( 1.3%)
Top-2 not optimized method types for send (100.0% of total 113,430):
  cfunc: 75,863 (66.9%)
   iseq: 37,567 (33.1%)
Top-6 not optimized method types for send_without_block (100.0% of total 8,005,732):
       iseq: 4,007,647 (50.1%)
    bmethod: 1,750,263 (21.9%)
  optimized: 1,647,088 (20.6%)
      alias:   591,356 ( 7.4%)
       null:     8,161 ( 0.1%)
      cfunc:     1,217 ( 0.0%)
Top-13 not optimized instructions (100.0% of total 7,569,803):
             invokesuper: 4,320,589 (57.1%)
             invokeblock: 1,321,548 (17.5%)
             sendforward:   841,452 (11.1%)
                  opt_eq:   811,601 (10.7%)
                opt_plus:   142,565 ( 1.9%)
               opt_minus:    52,268 ( 0.7%)
  opt_send_without_block:    42,982 ( 0.6%)
                 opt_neq:    15,047 ( 0.2%)
                opt_mult:    13,824 ( 0.2%)
                  opt_or:     7,452 ( 0.1%)
                  opt_lt:       348 ( 0.0%)
                  opt_ge:        91 ( 0.0%)
                  opt_gt:        36 ( 0.0%)
Top-9 send fallback reasons (100.0% of total 45,409,745):
                send_without_block_polymorphic: 17,360,049 (38.2%)
                              send_no_profiles: 10,502,130 (23.1%)
  send_without_block_not_optimized_method_type:  8,005,732 (17.6%)
                     not_optimized_instruction:  7,569,803 (16.7%)
                send_without_block_no_profiles:  1,811,570 ( 4.0%)
                send_not_optimized_method_type:    113,430 ( 0.2%)
       send_without_block_cfunc_array_variadic:     31,154 ( 0.1%)
                      obj_to_string_not_string:     15,303 ( 0.0%)
       send_without_block_direct_too_many_args:        574 ( 0.0%)
Top-9 unhandled YARV insns (100.0% of total 1,241,241):
         expandarray: 622,183 (50.1%)
        checkkeyword: 316,113 (25.5%)
    getclassvariable: 119,668 ( 9.6%)
       getblockparam:  88,481 ( 7.1%)
  invokesuperforward:  78,842 ( 6.4%)
   opt_duparray_send:  14,149 ( 1.1%)
         getconstant:   1,496 ( 0.1%)
          checkmatch:     290 ( 0.0%)
                once:      19 ( 0.0%)
Top-2 compile error reasons (100.0% of total 6,521,426):
  register_spill_on_alloc: 6,175,519 (94.7%)
  register_spill_on_ccall:   345,907 ( 5.3%)
Top-14 side exit reasons (100.0% of total 19,869,193):
                        compile_error: 6,521,426 (32.8%)
                   guard_type_failure: 5,167,727 (26.0%)
                  guard_shape_failure: 3,708,529 (18.7%)
                  unhandled_yarv_insn: 1,241,241 ( 6.2%)
  block_param_proxy_not_iseq_or_ifunc:   990,130 ( 5.0%)
                      unhandled_kwarg:   800,104 ( 4.0%)
                unknown_newarray_send:   539,105 ( 2.7%)
                           patchpoint:   494,790 ( 2.5%)
                      unhandled_splat:   229,423 ( 1.2%)
                   unhandled_hir_insn:   147,342 ( 0.7%)
           block_param_proxy_modified:    28,111 ( 0.1%)
                            interrupt:     1,073 ( 0.0%)
               obj_to_string_fallback:       170 ( 0.0%)
               guard_type_not_failure:        22 ( 0.0%)
                             send_count: 109,972,903
                     dynamic_send_count:  45,409,745 (41.3%)
                   optimized_send_count:  64,563,158 (58.7%)
              iseq_optimized_send_count:  32,205,906 (29.3%)
      inline_cfunc_optimized_send_count:  12,529,333 (11.4%)
non_variadic_cfunc_optimized_send_count:  15,123,197 (13.8%)
    variadic_cfunc_optimized_send_count:   4,704,722 ( 4.3%)
dynamic_getivar_count:                       12,973,226
dynamic_setivar_count:                       12,381,984
compiled_iseq_count:                              4,816
failed_iseq_count:                                  467
compile_time:                                   8,116ms
profile_time:                                      59ms
gc_time:                                           35ms
invalidation_time:                                289ms
vm_write_pc_count:                          113,616,123
vm_write_sp_count:                          111,273,109
vm_write_locals_count:                      111,273,109
vm_write_stack_count:                       111,273,109
vm_write_to_parent_iseq_local_count:            516,816
vm_read_from_parent_iseq_local_count:        11,255,225
code_region_bytes:                           22,872,064
side_exit_count:                             19,869,193
total_insn_count:                           924,733,475
vm_insn_count:                              296,183,588
zjit_insn_count:                            628,549,887
ratio_in_zjit:                                    68.0%
```
</details>
2025-10-15 18:00:44 +00:00
Luke Gruber
27ff586152 We can't grab the VM Lock in free functions
This is due to the way MMTK frees objects, which is on another native thread.
Due to this, there's no `ec` so we can't grab the VM Lock.

This was causing issues in release builds of MMTK on CI like:

```
  /home/runner/work/ruby/ruby/build/ruby(sigsegv+0x46) [0x557905117ef6] ../src/signal.c:948
  /lib/x86_64-linux-gnu/libc.so.6(0x7f555f845330) [0x7f555f845330]
  /home/runner/work/ruby/ruby/build/ruby(rb_ec_thread_ptr+0x0) [0x5579051d59d5] ../src/vm_core.h:2087
  /home/runner/work/ruby/ruby/build/ruby(rb_ec_ractor_ptr) ../src/vm_core.h:2036
  /home/runner/work/ruby/ruby/build/ruby(rb_current_execution_context) ../src/vm_core.h:2105
  /home/runner/work/ruby/ruby/build/ruby(rb_current_ractor_raw) ../src/vm_core.h:2104
  /home/runner/work/ruby/ruby/build/ruby(rb_current_ractor) ../src/vm_core.h:2112
  /home/runner/work/ruby/ruby/build/ruby(rb_current_ractor) ../src/vm_core.h:2110
  /home/runner/work/ruby/ruby/build/ruby(vm_locked) ../src/vm_sync.c:15
  /home/runner/work/ruby/ruby/build/ruby(rb_vm_lock_enter_body) ../src/vm_sync.c:141
  /home/runner/work/ruby/ruby/build/ruby(rb_vm_lock_enter+0xa) [0x557905390a5a] ../src/vm_sync.h:76
  /home/runner/work/ruby/ruby/build/ruby(fiber_pool_stack_release) ../src/cont.c:777
  /home/runner/work/ruby/ruby/build/ruby(fiber_stack_release+0xe) [0x557905392075] ../src/cont.c:919
  /home/runner/work/ruby/ruby/build/ruby(cont_free) ../src/cont.c:1087
  /home/runner/work/ruby/ruby/build/ruby(fiber_free) ../src/cont.c:1180
```

This would have ran into an assertion error in a debug build but we don't run debug builds of MMTK on Github's CI.

Co-authored-by: john.hawthorn@shopify.com
2025-10-15 10:49:37 -07:00
Alan Wu
31a1a39ace ZJIT: Never yield to the GC while compiling
This fixes a reliable "ZJIT saw a dead object" repro on my machine, and should
fix the flaky ones on CI. The code for disabling the GC is the same as
the code in newobj_of().

See: https://github.com/ruby/ruby/actions/runs/18511676257/job/52753782036
2025-10-15 13:27:30 -04:00
Max Bernstein
63a58c7943
ZJIT: Don't const-fold Array#[] on non-frozen array (#14841)
Accidentally added in https://github.com/ruby/ruby/pull/14679
2025-10-15 14:24:10 +00:00
Aiden Fox Ivey
bb4526b9b1
ZJIT: Add trace exit counter (#14831) 2025-10-15 17:56:31 +08:00
Edouard CHIN
dce202d6d6 [rubygems/rubygems] Add checksum of gems hosted on private servers:
- ### Problem

  Running `bundle lock --add-checksums` doesn't add the checksum of
  gems hosted on server that don't implement the compact index API.

  This result in a lockfile which is unusable in production as
  some checksums will be missing and Bundler raising an error.
  Users can work around this problem by running:

  `BUNDLE_LOCKFILE_CHECKSUMS=true bundle install --force`

  But this means redownloading and installing all gems which isn't
  great and slow on large apps.

  ### Context

  Bundler uses the Compact Index API to get the checksum of gems,
  but most private gem servers don't implement the compact index API
  (such as cloudsmith or packagecloud). This results in a soft failure
  on bundler side, and bundler leaving out blank checksum for those
  gems.

  ### Solution

  For gems that are hosted on private servers that don't send back
  the checksum of the gem, I'd like to fallback to the
  `bundle install` mechanism, which don't rely on an external API but
  instead compute the checksum of the package installed on disk.

  This patch goes through the spec that didn't return a checksum,
  and compute one if the package exists on disk.
  This solution makes the  `bundle lock --add-checksums` command
  actually usable in real world scenarios while keeping the
  `bundle lock` command fast enough.

https://github.com/rubygems/rubygems/commit/8e9abb5472
2025-10-15 09:54:50 +00:00
Hiroshi SHIBATA
51b2c5a4cd [rubygems/rubygems] Removed obsoleted option from bundle-exec manpages
https://github.com/rubygems/rubygems/commit/6a3342541a
2025-10-15 07:15:50 +00:00
Hiroshi SHIBATA
6c9acb533f [rubygems/rubygems] Added example for global path with Gemfile
https://github.com/rubygems/rubygems/commit/cd1493eec4
2025-10-15 07:15:49 +00:00
Hiroshi SHIBATA
c3e6e65591 [rubygems/rubygems] Removed duplicated examples with bundle install
https://github.com/rubygems/rubygems/commit/59b909fa74
2025-10-15 07:15:49 +00:00
David Rodríguez
a60b56c33d [rubygems/rubygems] Use default_cache_path helper for brevity
https://github.com/rubygems/rubygems/commit/29a12c3d46
2025-10-15 07:15:49 +00:00
David Rodríguez
92cbd7ec33 [rubygems/rubygems] Test current clean after bundle update behavior
https://github.com/rubygems/rubygems/commit/c43e35c3ea
2025-10-15 07:15:48 +00:00
Hiroshi SHIBATA
d99a4295a8 [rubygems/rubygems] Restore an accidentally changes of cache_spec.rb
https://github.com/rubygems/rubygems/commit/06508374aa
2025-10-15 07:15:48 +00:00
Hiroshi SHIBATA
fdc37df3d3 [rubygems/rubygems] Removed deprecated settings methods
https://github.com/rubygems/rubygems/commit/89bcdfc941
2025-10-15 07:15:48 +00:00
Hiroshi SHIBATA
8104c833ef [rubygems/rubygems] Fixed wrong option message
https://github.com/rubygems/rubygems/commit/15be905c44
2025-10-15 07:15:47 +00:00
Marino Bonetti
1142abb1de
[DOC] Update making_changes_to_stdlibs.md mirror Example
CSV is no more part of the standard lib, but the documentation was not
updated (the example link was broken for the master branch)

Selected ERB that has the dedicated directory, like CSV.
2025-10-15 13:58:24 +09:00
Hiroshi SHIBATA
26d1e6947e [rubygems/rubygems] Replaced Bundler::SharedHelpers.major_deprecation to feature_removed! or feature_deprecated!
https://github.com/rubygems/rubygems/commit/b1b963b34a

Co-authored-by: David Rodríguez <2887858+deivid-rodriguez@users.noreply.github.com>
2025-10-15 02:40:13 +00:00
Alan Wu
5bda42e4de ZJIT: Include GC object dump when seeing dead objects
Strictly more info than just the builtin_type from `assert_ne!`.

Old:

    assertion `left != right` failed: ZJIT should only see live objects
      left: 0
     right: 0

New:

    ZJIT saw a dead object. T_type=0, out-of-heap:0x0000000110d4bb40

Also, the new `VALUE::obj_info` is more flexible for print debugging than the
dump_info() it replaces. It now allows you to use it as part of a `format!`
string instead of always printing to stderr for you.
2025-10-14 22:34:50 -04:00
Aaron Patterson
8d43867802 [rubygems/rubygems] remove some memoization
I don't think these methods are hotspots, and since gem specifications
are sometimes serialized to yaml / marshal, I think we should remove as
many instance variables as possible

https://github.com/rubygems/rubygems/commit/40490d918b
2025-10-15 02:05:45 +00:00
Peter Zhu
df5d63cfa2 [DOC] Fix typo in String#partition 2025-10-14 18:26:08 -04:00
Alan Wu
57bb726884 YJIT: Use mem::take over drain(..).collect() 2025-10-14 18:16:07 -04:00
Takashi Kokubun
ed94e54351
ZJIT: Centralize the allocation of scratch registers (#14815) 2025-10-15 04:36:47 +08:00
Max Bernstein
de9298635d
ZJIT: Profile opt_size, opt_length, opt_regexpmatch2 (#14837)
These bring `send_without_block_no_profiles` numbers down more.

On lobsters:
  Before:  send_without_block_no_profiles: 1,293,375
  After:   send_without_block_no_profiles: 998,724

all stats before:

```
***ZJIT: Printing ZJIT statistics on exit***
Top-20 not inlined C methods (71.1% of total 15,575,335):
                                    Hash#[]: 4,519,774 (29.0%)
                               Kernel#is_a?: 1,030,758 ( 6.6%)
                                  String#<<:   851,929 ( 5.5%)
                                   Hash#[]=:   742,941 ( 4.8%)
                              Regexp#match?:   399,889 ( 2.6%)
                              String#empty?:   353,775 ( 2.3%)
                                  Hash#key?:   349,129 ( 2.2%)
                         String#start_with?:   334,961 ( 2.2%)
                         Kernel#respond_to?:   316,527 ( 2.0%)
                 ObjectSpace::WeakKeyMap#[]:   238,978 ( 1.5%)
                              TrueClass#===:   235,771 ( 1.5%)
                             FalseClass#===:   231,144 ( 1.5%)
                             Array#include?:   211,381 ( 1.4%)
                                 Hash#fetch:   204,702 ( 1.3%)
                        Kernel#block_given?:   181,792 ( 1.2%)
         ActiveSupport::OrderedOptions#_get:   181,272 ( 1.2%)
                                 Kernel#dup:   179,340 ( 1.2%)
                             BasicObject#!=:   175,997 ( 1.1%)
                                  Class#new:   168,078 ( 1.1%)
                            Kernel#kind_of?:   165,600 ( 1.1%)
Top-20 not annotated C methods (71.6% of total 15,737,478):
                                    Hash#[]: 4,519,784 (28.7%)
                               Kernel#is_a?: 1,212,649 ( 7.7%)
                                  String#<<:   851,929 ( 5.4%)
                                   Hash#[]=:   743,120 ( 4.7%)
                              Regexp#match?:   399,889 ( 2.5%)
                              String#empty?:   361,013 ( 2.3%)
                                  Hash#key?:   349,129 ( 2.2%)
                         String#start_with?:   334,961 ( 2.1%)
                         Kernel#respond_to?:   316,527 ( 2.0%)
                 ObjectSpace::WeakKeyMap#[]:   238,978 ( 1.5%)
                              TrueClass#===:   235,771 ( 1.5%)
                             FalseClass#===:   231,144 ( 1.5%)
                             Array#include?:   211,381 ( 1.3%)
                                 Hash#fetch:   204,702 ( 1.3%)
                        Kernel#block_given?:   191,661 ( 1.2%)
         ActiveSupport::OrderedOptions#_get:   181,272 ( 1.2%)
                                 Kernel#dup:   179,347 ( 1.1%)
                             BasicObject#!=:   176,181 ( 1.1%)
                                  Class#new:   168,078 ( 1.1%)
                            Kernel#kind_of?:   165,634 ( 1.1%)
Top-2 not optimized method types for send (100.0% of total 72,318):
  cfunc: 48,055 (66.4%)
   iseq: 24,263 (33.6%)
Top-6 not optimized method types for send_without_block (100.0% of total 4,523,648):
       iseq: 2,271,904 (50.2%)
    bmethod:   985,636 (21.8%)
  optimized:   949,702 (21.0%)
      alias:   310,746 ( 6.9%)
       null:     5,106 ( 0.1%)
      cfunc:       554 ( 0.0%)
Top-13 not optimized instructions (100.0% of total 4,293,096):
             invokesuper: 2,373,391 (55.3%)
             invokeblock:   811,872 (18.9%)
             sendforward:   505,448 (11.8%)
                  opt_eq:   451,754 (10.5%)
                opt_plus:    74,403 ( 1.7%)
               opt_minus:    36,225 ( 0.8%)
  opt_send_without_block:    21,792 ( 0.5%)
                 opt_neq:     7,231 ( 0.2%)
                opt_mult:     6,752 ( 0.2%)
                  opt_or:     3,753 ( 0.1%)
                  opt_lt:       348 ( 0.0%)
                  opt_ge:        91 ( 0.0%)
                  opt_gt:        36 ( 0.0%)
Top-9 send fallback reasons (100.0% of total 25,824,463):
                send_without_block_polymorphic: 9,721,727 (37.6%)
                              send_no_profiles: 5,894,760 (22.8%)
  send_without_block_not_optimized_method_type: 4,523,648 (17.5%)
                     not_optimized_instruction: 4,293,096 (16.6%)
                send_without_block_no_profiles: 1,293,386 ( 5.0%)
                send_not_optimized_method_type:    72,318 ( 0.3%)
       send_without_block_cfunc_array_variadic:    15,134 ( 0.1%)
                      obj_to_string_not_string:     9,765 ( 0.0%)
       send_without_block_direct_too_many_args:       629 ( 0.0%)
Top-9 unhandled YARV insns (100.0% of total 690,482):
         expandarray: 328,490 (47.6%)
        checkkeyword: 190,694 (27.6%)
    getclassvariable:  59,901 ( 8.7%)
  invokesuperforward:  49,503 ( 7.2%)
       getblockparam:  48,651 ( 7.0%)
   opt_duparray_send:  11,978 ( 1.7%)
         getconstant:     952 ( 0.1%)
          checkmatch:     290 ( 0.0%)
                once:      23 ( 0.0%)
Top-3 compile error reasons (100.0% of total 3,752,502):
  register_spill_on_alloc: 3,457,791 (92.1%)
  register_spill_on_ccall:   176,348 ( 4.7%)
        exception_handler:   118,363 ( 3.2%)
Top-14 side exit reasons (100.0% of total 10,860,787):
                        compile_error: 3,752,502 (34.6%)
                   guard_type_failure: 2,638,903 (24.3%)
                  guard_shape_failure: 1,917,195 (17.7%)
                  unhandled_yarv_insn:   690,482 ( 6.4%)
  block_param_proxy_not_iseq_or_ifunc:   535,787 ( 4.9%)
                      unhandled_kwarg:   421,943 ( 3.9%)
                           patchpoint:   370,449 ( 3.4%)
                unknown_newarray_send:   314,785 ( 2.9%)
                      unhandled_splat:   122,060 ( 1.1%)
                   unhandled_hir_insn:    76,396 ( 0.7%)
           block_param_proxy_modified:    19,193 ( 0.2%)
               obj_to_string_fallback:       566 ( 0.0%)
                            interrupt:       504 ( 0.0%)
               guard_type_not_failure:        22 ( 0.0%)
                             send_count: 66,945,801
                     dynamic_send_count: 25,824,463 (38.6%)
                   optimized_send_count: 41,121,338 (61.4%)
              iseq_optimized_send_count: 18,587,368 (27.8%)
      inline_cfunc_optimized_send_count:  6,958,635 (10.4%)
non_variadic_cfunc_optimized_send_count: 12,911,155 (19.3%)
    variadic_cfunc_optimized_send_count:  2,664,180 ( 4.0%)
dynamic_getivar_count:                        7,365,975
dynamic_setivar_count:                        7,245,897
compiled_iseq_count:                              4,794
failed_iseq_count:                                  450
compile_time:                                     760ms
profile_time:                                       9ms
gc_time:                                            8ms
invalidation_time:                                 55ms
vm_write_pc_count:                           64,284,053
vm_write_sp_count:                           62,940,297
vm_write_locals_count:                       62,940,297
vm_write_stack_count:                        62,940,297
vm_write_to_parent_iseq_local_count:            292,446
vm_read_from_parent_iseq_local_count:         6,470,923
code_region_bytes:                           23,019,520
side_exit_count:                             10,860,787
total_insn_count:                           517,576,320
vm_insn_count:                              163,188,910
zjit_insn_count:                            354,387,410
ratio_in_zjit:                                    68.5%
```

all stats after:

```
***ZJIT: Printing ZJIT statistics on exit***
Top-20 not inlined C methods (70.4% of total 15,740,856):
                                    Hash#[]: 4,519,792 (28.7%)
                               Kernel#is_a?: 1,030,776 ( 6.5%)
                                  String#<<:   851,940 ( 5.4%)
                                   Hash#[]=:   742,914 ( 4.7%)
                              Regexp#match?:   399,887 ( 2.5%)
                              String#empty?:   353,775 ( 2.2%)
                                  Hash#key?:   349,139 ( 2.2%)
                         String#start_with?:   334,961 ( 2.1%)
                         Kernel#respond_to?:   316,529 ( 2.0%)
                 ObjectSpace::WeakKeyMap#[]:   238,978 ( 1.5%)
                              TrueClass#===:   235,771 ( 1.5%)
                             FalseClass#===:   231,144 ( 1.5%)
                             Array#include?:   211,381 ( 1.3%)
                                 Hash#fetch:   204,702 ( 1.3%)
                        Kernel#block_given?:   181,788 ( 1.2%)
         ActiveSupport::OrderedOptions#_get:   181,272 ( 1.2%)
                                 Kernel#dup:   179,341 ( 1.1%)
                             BasicObject#!=:   175,996 ( 1.1%)
                                  Class#new:   168,079 ( 1.1%)
                            Kernel#kind_of?:   165,600 ( 1.1%)
Top-20 not annotated C methods (70.9% of total 15,902,999):
                                    Hash#[]: 4,519,802 (28.4%)
                               Kernel#is_a?: 1,212,667 ( 7.6%)
                                  String#<<:   851,940 ( 5.4%)
                                   Hash#[]=:   743,093 ( 4.7%)
                              Regexp#match?:   399,887 ( 2.5%)
                              String#empty?:   361,013 ( 2.3%)
                                  Hash#key?:   349,139 ( 2.2%)
                         String#start_with?:   334,961 ( 2.1%)
                         Kernel#respond_to?:   316,529 ( 2.0%)
                 ObjectSpace::WeakKeyMap#[]:   238,978 ( 1.5%)
                              TrueClass#===:   235,771 ( 1.5%)
                             FalseClass#===:   231,144 ( 1.5%)
                             Array#include?:   211,381 ( 1.3%)
                                 Hash#fetch:   204,702 ( 1.3%)
                        Kernel#block_given?:   191,657 ( 1.2%)
         ActiveSupport::OrderedOptions#_get:   181,272 ( 1.1%)
                                 Kernel#dup:   179,348 ( 1.1%)
                             BasicObject#!=:   176,180 ( 1.1%)
                                  Class#new:   168,079 ( 1.1%)
                            Kernel#kind_of?:   165,634 ( 1.0%)
Top-2 not optimized method types for send (100.0% of total 72,318):
  cfunc: 48,055 (66.4%)
   iseq: 24,263 (33.6%)
Top-6 not optimized method types for send_without_block (100.0% of total 4,523,637):
       iseq: 2,271,900 (50.2%)
    bmethod:   985,636 (21.8%)
  optimized:   949,695 (21.0%)
      alias:   310,746 ( 6.9%)
       null:     5,106 ( 0.1%)
      cfunc:       554 ( 0.0%)
Top-13 not optimized instructions (100.0% of total 4,293,128):
             invokesuper: 2,373,401 (55.3%)
             invokeblock:   811,890 (18.9%)
             sendforward:   505,449 (11.8%)
                  opt_eq:   451,754 (10.5%)
                opt_plus:    74,403 ( 1.7%)
               opt_minus:    36,228 ( 0.8%)
  opt_send_without_block:    21,792 ( 0.5%)
                 opt_neq:     7,231 ( 0.2%)
                opt_mult:     6,752 ( 0.2%)
                  opt_or:     3,753 ( 0.1%)
                  opt_lt:       348 ( 0.0%)
                  opt_ge:        91 ( 0.0%)
                  opt_gt:        36 ( 0.0%)
Top-9 send fallback reasons (100.0% of total 25,530,605):
                send_without_block_polymorphic: 9,722,499 (38.1%)
                              send_no_profiles: 5,894,763 (23.1%)
  send_without_block_not_optimized_method_type: 4,523,637 (17.7%)
                     not_optimized_instruction: 4,293,128 (16.8%)
                send_without_block_no_profiles:   998,732 ( 3.9%)
                send_not_optimized_method_type:    72,318 ( 0.3%)
       send_without_block_cfunc_array_variadic:    15,134 ( 0.1%)
                      obj_to_string_not_string:     9,765 ( 0.0%)
       send_without_block_direct_too_many_args:       629 ( 0.0%)
Top-9 unhandled YARV insns (100.0% of total 690,482):
         expandarray: 328,490 (47.6%)
        checkkeyword: 190,694 (27.6%)
    getclassvariable:  59,901 ( 8.7%)
  invokesuperforward:  49,503 ( 7.2%)
       getblockparam:  48,651 ( 7.0%)
   opt_duparray_send:  11,978 ( 1.7%)
         getconstant:     952 ( 0.1%)
          checkmatch:     290 ( 0.0%)
                once:      23 ( 0.0%)
Top-3 compile error reasons (100.0% of total 3,752,500):
  register_spill_on_alloc: 3,457,792 (92.1%)
  register_spill_on_ccall:   176,348 ( 4.7%)
        exception_handler:   118,360 ( 3.2%)
Top-14 side exit reasons (100.0% of total 10,860,797):
                        compile_error: 3,752,500 (34.6%)
                   guard_type_failure: 2,638,909 (24.3%)
                  guard_shape_failure: 1,917,203 (17.7%)
                  unhandled_yarv_insn:   690,482 ( 6.4%)
  block_param_proxy_not_iseq_or_ifunc:   535,784 ( 4.9%)
                      unhandled_kwarg:   421,947 ( 3.9%)
                           patchpoint:   370,474 ( 3.4%)
                unknown_newarray_send:   314,786 ( 2.9%)
                      unhandled_splat:   122,067 ( 1.1%)
                   unhandled_hir_insn:    76,395 ( 0.7%)
           block_param_proxy_modified:    19,193 ( 0.2%)
               obj_to_string_fallback:       566 ( 0.0%)
                            interrupt:       469 ( 0.0%)
               guard_type_not_failure:        22 ( 0.0%)
                             send_count: 66,945,326
                     dynamic_send_count: 25,530,605 (38.1%)
                   optimized_send_count: 41,414,721 (61.9%)
              iseq_optimized_send_count: 18,587,439 (27.8%)
      inline_cfunc_optimized_send_count:  7,086,426 (10.6%)
non_variadic_cfunc_optimized_send_count: 13,076,682 (19.5%)
    variadic_cfunc_optimized_send_count:  2,664,174 ( 4.0%)
dynamic_getivar_count:                       7,365,985
dynamic_setivar_count:                       7,245,954
compiled_iseq_count:                             4,794
failed_iseq_count:                                 450
compile_time:                                    748ms
profile_time:                                      9ms
gc_time:                                           8ms
invalidation_time:                                58ms
vm_write_pc_count:                          64,155,801
vm_write_sp_count:                          62,812,041
vm_write_locals_count:                      62,812,041
vm_write_stack_count:                       62,812,041
vm_write_to_parent_iseq_local_count:           292,448
vm_read_from_parent_iseq_local_count:        6,470,939
code_region_bytes:                          23,052,288
side_exit_count:                            10,860,797
total_insn_count:                          517,576,915
vm_insn_count:                             163,192,099
zjit_insn_count:                           354,384,816
ratio_in_zjit:                                   68.5%
```
2025-10-14 16:17:54 -04:00
Max Bernstein
d75207d004
ZJIT: Profile opt_ltlt and opt_aset (#14834)
These bring `send_without_block_no_profiles` numbers down dramatically.

On lobsters:
  Before: send_without_block_no_profiles: 3,466,375
  After:  send_without_block_no_profiles: 1,293,375

all stats before:

```
***ZJIT: Printing ZJIT statistics on exit***
Top-20 not inlined C methods (70.4% of total 14,174,061):
                                    Hash#[]: 4,519,771 (31.9%)
                               Kernel#is_a?: 1,030,757 ( 7.3%)
                              Regexp#match?:   399,885 ( 2.8%)
                              String#empty?:   353,775 ( 2.5%)
                                  Hash#key?:   349,125 ( 2.5%)
                                   Hash#[]=:   344,348 ( 2.4%)
                         String#start_with?:   334,961 ( 2.4%)
                         Kernel#respond_to?:   316,527 ( 2.2%)
                 ObjectSpace::WeakKeyMap#[]:   238,978 ( 1.7%)
                              TrueClass#===:   235,770 ( 1.7%)
                             FalseClass#===:   231,143 ( 1.6%)
                             Array#include?:   211,383 ( 1.5%)
                                 Hash#fetch:   204,702 ( 1.4%)
                        Kernel#block_given?:   181,793 ( 1.3%)
         ActiveSupport::OrderedOptions#_get:   181,272 ( 1.3%)
                                 Kernel#dup:   179,341 ( 1.3%)
                             BasicObject#!=:   175,996 ( 1.2%)
                                  Class#new:   168,079 ( 1.2%)
                            Kernel#kind_of?:   165,600 ( 1.2%)
                                  String#==:   157,734 ( 1.1%)
Top-20 not annotated C methods (71.1% of total 14,336,035):
                                    Hash#[]: 4,519,781 (31.5%)
                               Kernel#is_a?: 1,212,647 ( 8.5%)
                              Regexp#match?:   399,885 ( 2.8%)
                              String#empty?:   361,013 ( 2.5%)
                                  Hash#key?:   349,125 ( 2.4%)
                                   Hash#[]=:   344,348 ( 2.4%)
                         String#start_with?:   334,961 ( 2.3%)
                         Kernel#respond_to?:   316,527 ( 2.2%)
                 ObjectSpace::WeakKeyMap#[]:   238,978 ( 1.7%)
                              TrueClass#===:   235,770 ( 1.6%)
                             FalseClass#===:   231,143 ( 1.6%)
                             Array#include?:   211,383 ( 1.5%)
                                 Hash#fetch:   204,702 ( 1.4%)
                        Kernel#block_given?:   191,662 ( 1.3%)
         ActiveSupport::OrderedOptions#_get:   181,272 ( 1.3%)
                                 Kernel#dup:   179,348 ( 1.3%)
                             BasicObject#!=:   176,180 ( 1.2%)
                                  Class#new:   168,079 ( 1.2%)
                            Kernel#kind_of?:   165,634 ( 1.2%)
                                  String#==:   163,666 ( 1.1%)
Top-2 not optimized method types for send (100.0% of total 72,318):
  cfunc: 48,055 (66.4%)
   iseq: 24,263 (33.6%)
Top-6 not optimized method types for send_without_block (100.0% of total 4,536,895):
       iseq: 2,281,897 (50.3%)
    bmethod:   985,679 (21.7%)
  optimized:   952,914 (21.0%)
      alias:   310,745 ( 6.8%)
       null:     5,106 ( 0.1%)
      cfunc:       554 ( 0.0%)
Top-13 not optimized instructions (100.0% of total 4,293,123):
             invokesuper: 2,373,396 (55.3%)
             invokeblock:   811,891 (18.9%)
             sendforward:   505,449 (11.8%)
                  opt_eq:   451,754 (10.5%)
                opt_plus:    74,403 ( 1.7%)
               opt_minus:    36,227 ( 0.8%)
  opt_send_without_block:    21,792 ( 0.5%)
                 opt_neq:     7,231 ( 0.2%)
                opt_mult:     6,752 ( 0.2%)
                  opt_or:     3,753 ( 0.1%)
                  opt_lt:       348 ( 0.0%)
                  opt_ge:        91 ( 0.0%)
                  opt_gt:        36 ( 0.0%)
Top-9 send fallback reasons (100.0% of total 27,795,022):
                send_without_block_polymorphic: 9,505,835 (34.2%)
                              send_no_profiles: 5,894,763 (21.2%)
  send_without_block_not_optimized_method_type: 4,536,895 (16.3%)
                     not_optimized_instruction: 4,293,123 (15.4%)
                send_without_block_no_profiles: 3,466,407 (12.5%)
                send_not_optimized_method_type:    72,318 ( 0.3%)
       send_without_block_cfunc_array_variadic:    15,134 ( 0.1%)
                      obj_to_string_not_string:     9,918 ( 0.0%)
       send_without_block_direct_too_many_args:       629 ( 0.0%)
Top-9 unhandled YARV insns (100.0% of total 690,482):
         expandarray: 328,490 (47.6%)
        checkkeyword: 190,694 (27.6%)
    getclassvariable:  59,901 ( 8.7%)
  invokesuperforward:  49,503 ( 7.2%)
       getblockparam:  48,651 ( 7.0%)
   opt_duparray_send:  11,978 ( 1.7%)
         getconstant:     952 ( 0.1%)
          checkmatch:     290 ( 0.0%)
                once:      23 ( 0.0%)
Top-3 compile error reasons (100.0% of total 3,752,391):
  register_spill_on_alloc: 3,457,680 (92.1%)
  register_spill_on_ccall:   176,348 ( 4.7%)
        exception_handler:   118,363 ( 3.2%)
Top-14 side exit reasons (100.0% of total 10,852,021):
                        compile_error: 3,752,391 (34.6%)
                   guard_type_failure: 2,630,877 (24.2%)
                  guard_shape_failure: 1,917,208 (17.7%)
                  unhandled_yarv_insn:   690,482 ( 6.4%)
  block_param_proxy_not_iseq_or_ifunc:   535,784 ( 4.9%)
                      unhandled_kwarg:   421,989 ( 3.9%)
                           patchpoint:   369,799 ( 3.4%)
                unknown_newarray_send:   314,786 ( 2.9%)
                      unhandled_splat:   122,062 ( 1.1%)
                   unhandled_hir_insn:    76,394 ( 0.7%)
           block_param_proxy_modified:    19,193 ( 0.2%)
               obj_to_string_fallback:       566 ( 0.0%)
                            interrupt:       468 ( 0.0%)
               guard_type_not_failure:        22 ( 0.0%)
                             send_count: 66,989,407
                     dynamic_send_count: 27,795,022 (41.5%)
                   optimized_send_count: 39,194,385 (58.5%)
              iseq_optimized_send_count: 18,060,194 (27.0%)
      inline_cfunc_optimized_send_count:  6,960,130 (10.4%)
non_variadic_cfunc_optimized_send_count: 11,523,682 (17.2%)
    variadic_cfunc_optimized_send_count:  2,650,379 ( 4.0%)
dynamic_getivar_count:                        7,365,982
dynamic_setivar_count:                        7,245,929
compiled_iseq_count:                              4,795
failed_iseq_count:                                  449
compile_time:                                     846ms
profile_time:                                      12ms
gc_time:                                            9ms
invalidation_time:                                 61ms
vm_write_pc_count:                           64,326,442
vm_write_sp_count:                           62,982,524
vm_write_locals_count:                       62,982,524
vm_write_stack_count:                        62,982,524
vm_write_to_parent_iseq_local_count:            292,448
vm_read_from_parent_iseq_local_count:         6,471,353
code_region_bytes:                           22,708,224
side_exit_count:                             10,852,021
total_insn_count:                           517,550,288
vm_insn_count:                              162,946,459
zjit_insn_count:                            354,603,829
ratio_in_zjit:                                    68.5%
```

all stats after:

```
***ZJIT: Printing ZJIT statistics on exit***
Top-20 not inlined C methods (71.1% of total 15,575,343):
                                    Hash#[]: 4,519,778 (29.0%)
                               Kernel#is_a?: 1,030,758 ( 6.6%)
                                  String#<<:   851,931 ( 5.5%)
                                   Hash#[]=:   742,938 ( 4.8%)
                              Regexp#match?:   399,886 ( 2.6%)
                              String#empty?:   353,775 ( 2.3%)
                                  Hash#key?:   349,127 ( 2.2%)
                         String#start_with?:   334,961 ( 2.2%)
                         Kernel#respond_to?:   316,529 ( 2.0%)
                 ObjectSpace::WeakKeyMap#[]:   238,978 ( 1.5%)
                              TrueClass#===:   235,771 ( 1.5%)
                             FalseClass#===:   231,144 ( 1.5%)
                             Array#include?:   211,380 ( 1.4%)
                                 Hash#fetch:   204,701 ( 1.3%)
                        Kernel#block_given?:   181,792 ( 1.2%)
         ActiveSupport::OrderedOptions#_get:   181,272 ( 1.2%)
                                 Kernel#dup:   179,341 ( 1.2%)
                             BasicObject#!=:   175,997 ( 1.1%)
                                  Class#new:   168,079 ( 1.1%)
                            Kernel#kind_of?:   165,600 ( 1.1%)
Top-20 not annotated C methods (71.6% of total 15,737,486):
                                    Hash#[]: 4,519,788 (28.7%)
                               Kernel#is_a?: 1,212,649 ( 7.7%)
                                  String#<<:   851,931 ( 5.4%)
                                   Hash#[]=:   743,117 ( 4.7%)
                              Regexp#match?:   399,886 ( 2.5%)
                              String#empty?:   361,013 ( 2.3%)
                                  Hash#key?:   349,127 ( 2.2%)
                         String#start_with?:   334,961 ( 2.1%)
                         Kernel#respond_to?:   316,529 ( 2.0%)
                 ObjectSpace::WeakKeyMap#[]:   238,978 ( 1.5%)
                              TrueClass#===:   235,771 ( 1.5%)
                             FalseClass#===:   231,144 ( 1.5%)
                             Array#include?:   211,380 ( 1.3%)
                                 Hash#fetch:   204,701 ( 1.3%)
                        Kernel#block_given?:   191,661 ( 1.2%)
         ActiveSupport::OrderedOptions#_get:   181,272 ( 1.2%)
                                 Kernel#dup:   179,348 ( 1.1%)
                             BasicObject#!=:   176,181 ( 1.1%)
                                  Class#new:   168,079 ( 1.1%)
                            Kernel#kind_of?:   165,634 ( 1.1%)
Top-2 not optimized method types for send (100.0% of total 72,318):
  cfunc: 48,055 (66.4%)
   iseq: 24,263 (33.6%)
Top-6 not optimized method types for send_without_block (100.0% of total 4,523,650):
       iseq: 2,271,911 (50.2%)
    bmethod:   985,636 (21.8%)
  optimized:   949,696 (21.0%)
      alias:   310,747 ( 6.9%)
       null:     5,106 ( 0.1%)
      cfunc:       554 ( 0.0%)
Top-13 not optimized instructions (100.0% of total 4,293,126):
             invokesuper: 2,373,395 (55.3%)
             invokeblock:   811,894 (18.9%)
             sendforward:   505,449 (11.8%)
                  opt_eq:   451,754 (10.5%)
                opt_plus:    74,403 ( 1.7%)
               opt_minus:    36,228 ( 0.8%)
  opt_send_without_block:    21,792 ( 0.5%)
                 opt_neq:     7,231 ( 0.2%)
                opt_mult:     6,752 ( 0.2%)
                  opt_or:     3,753 ( 0.1%)
                  opt_lt:       348 ( 0.0%)
                  opt_ge:        91 ( 0.0%)
                  opt_gt:        36 ( 0.0%)
Top-9 send fallback reasons (100.0% of total 25,824,512):
                send_without_block_polymorphic: 9,721,725 (37.6%)
                              send_no_profiles: 5,894,761 (22.8%)
  send_without_block_not_optimized_method_type: 4,523,650 (17.5%)
                     not_optimized_instruction: 4,293,126 (16.6%)
                send_without_block_no_profiles: 1,293,404 ( 5.0%)
                send_not_optimized_method_type:    72,318 ( 0.3%)
       send_without_block_cfunc_array_variadic:    15,134 ( 0.1%)
                      obj_to_string_not_string:     9,765 ( 0.0%)
       send_without_block_direct_too_many_args:       629 ( 0.0%)
Top-9 unhandled YARV insns (100.0% of total 690,482):
         expandarray: 328,490 (47.6%)
        checkkeyword: 190,694 (27.6%)
    getclassvariable:  59,901 ( 8.7%)
  invokesuperforward:  49,503 ( 7.2%)
       getblockparam:  48,651 ( 7.0%)
   opt_duparray_send:  11,978 ( 1.7%)
         getconstant:     952 ( 0.1%)
          checkmatch:     290 ( 0.0%)
                once:      23 ( 0.0%)
Top-3 compile error reasons (100.0% of total 3,752,504):
  register_spill_on_alloc: 3,457,793 (92.1%)
  register_spill_on_ccall:   176,348 ( 4.7%)
        exception_handler:   118,363 ( 3.2%)
Top-14 side exit reasons (100.0% of total 10,860,754):
                        compile_error: 3,752,504 (34.6%)
                   guard_type_failure: 2,638,901 (24.3%)
                  guard_shape_failure: 1,917,198 (17.7%)
                  unhandled_yarv_insn:   690,482 ( 6.4%)
  block_param_proxy_not_iseq_or_ifunc:   535,785 ( 4.9%)
                      unhandled_kwarg:   421,947 ( 3.9%)
                           patchpoint:   370,447 ( 3.4%)
                unknown_newarray_send:   314,786 ( 2.9%)
                      unhandled_splat:   122,065 ( 1.1%)
                   unhandled_hir_insn:    76,395 ( 0.7%)
           block_param_proxy_modified:    19,193 ( 0.2%)
               obj_to_string_fallback:       566 ( 0.0%)
                            interrupt:       463 ( 0.0%)
               guard_type_not_failure:        22 ( 0.0%)
                             send_count: 66,945,926
                     dynamic_send_count: 25,824,512 (38.6%)
                   optimized_send_count: 41,121,414 (61.4%)
              iseq_optimized_send_count: 18,587,430 (27.8%)
      inline_cfunc_optimized_send_count:  6,958,641 (10.4%)
non_variadic_cfunc_optimized_send_count: 12,911,166 (19.3%)
    variadic_cfunc_optimized_send_count:  2,664,177 ( 4.0%)
dynamic_getivar_count:                        7,365,985
dynamic_setivar_count:                        7,245,942
compiled_iseq_count:                              4,794
failed_iseq_count:                                  450
compile_time:                                     852ms
profile_time:                                      13ms
gc_time:                                           11ms
invalidation_time:                                 63ms
vm_write_pc_count:                           64,284,194
vm_write_sp_count:                           62,940,427
vm_write_locals_count:                       62,940,427
vm_write_stack_count:                        62,940,427
vm_write_to_parent_iseq_local_count:            292,447
vm_read_from_parent_iseq_local_count:         6,470,931
code_region_bytes:                           23,019,520
side_exit_count:                             10,860,754
total_insn_count:                           517,576,267
vm_insn_count:                              163,188,187
zjit_insn_count:                            354,388,080
ratio_in_zjit:                                    68.5%
```
2025-10-14 19:09:53 +00:00
Alan Wu
8baf170e93 ZJIT: mem::take instead of drain then collect
Gets rid of one transient vec copy/allocation.
2025-10-14 15:01:38 -04:00
Max Bernstein
d1442727dd
ZJIT: Don't push Ruby frame for Thread#current (#14832)
Fix https://github.com/Shopify/ruby/issues/795
2025-10-14 17:36:50 +00:00
Max Bernstein
de310176c2
ZJIT: Inline well-known C functions into HIR (#14679)
Add the ability to create a Rust function that "open-codes" HIR
implementations of specific well-known C functions, starting with
`String#to_s`. It supports emitting multiple instructions into a
temporary block, but does not support emitting *new blocks* (yet?).

Fix https://github.com/Shopify/ruby/issues/792
2025-10-14 15:13:05 +00:00
Jason Garber
55e76b4cc9 [ruby/erb] Add changelog_uri to spec metadata
(https://github.com/ruby/erb/pull/89)

This project's `NEWS.md` file appears to be the closest thing to a
changelog file that I could find. The change here links to the file in
the released version's branch. RubyGems.org will use this metadata to
display a link to this file on the gem's release pages.

https://github.com/ruby/erb/commit/85a4f10332
2025-10-14 14:45:28 +00:00
Satoshi Tagomori
cad692de63 Remove useless comments
Namespace frame exists, but it is used only for Namespace#eval now.
2025-10-14 22:59:14 +09:00
Satoshi Tagomori
29adf0bb74 Split gvar space between root and main namespaces 2025-10-14 22:59:14 +09:00
Satoshi Tagomori
d60ee6fb7c Remove a comment - we cannot remove this method now probably 2025-10-14 22:59:14 +09:00
Satoshi Tagomori
9743b51806 Define main.to_s even in namespaces
It just shows "main" just like the main object without namespace.
All main objects in namespaces will show "main" and it is impossible
to determine a main from main objects if it returns "main".
But it's not a problem because we don't define anything on main
objects usually.
2025-10-14 22:59:14 +09:00
Satoshi Tagomori
7e07a8d8f6 Remove a debug method that is useless now 2025-10-14 22:59:14 +09:00
Étienne Barrié
25a420351d [rubygems/rubygems] Fix typo
https://github.com/rubygems/rubygems/commit/e4f1772d80
2025-10-14 12:12:56 +00:00
Vincent Lin
34ee5cbf13
[DOC] Fix minor typos in YJIT comments (#14829)
[DOC] Fix typos in YJIT core
2025-10-14 19:05:18 +08:00
Hiroshi SHIBATA
2002aa3ec2 [rubygems/rubygems] Removed legacy_check option from SpecSet#for
https://github.com/rubygems/rubygems/commit/376e4ec8c7

Co-authored-by: David Rodríguez <2887858+deivid-rodriguez@users.noreply.github.com>
2025-10-14 10:41:48 +00:00
Hiroshi SHIBATA
366e9c55f5 [rubygems/rubygems] Bump up to test version for 4.0.0.dev
https://github.com/rubygems/rubygems/commit/9d70887185
2025-10-14 08:30:06 +00:00
Hiroshi SHIBATA
d0b89cab4e [rubygems/rubygems] Added example for legacy windows platform
https://github.com/rubygems/rubygems/commit/90130c0648
2025-10-14 07:55:36 +00:00
Hiroshi SHIBATA
f142d1b598 [rubygems/rubygems] Removed obsoleted examples for legacy windows platform
https://github.com/rubygems/rubygems/commit/7b0da18764
2025-10-14 07:55:36 +00:00
Hiroshi SHIBATA
e326e22eb8 [rubygems/rubygems] Removed deprecated legacy windows platform support
https://github.com/rubygems/rubygems/commit/7d910dd94c

Co-authored-by: David Rodríguez <2887858+deivid-rodriguez@users.noreply.github.com>
2025-10-14 07:55:36 +00:00