94499 Commits

Author SHA1 Message Date
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
Nobuyoshi Nakada
e94a2f691d
[Bug #21638] Mark ractor-local $VERBOSE and $DEBUG
https://github.com/sampersand/blog/blob/master/the%20-s%20flag.md#the-segfault
2025-10-14 12:38:52 +09:00
Étienne Barrié
da3336c52b [ruby/strscan] Fix typo (https://github.com/ruby/strscan/pull/164)
https://github.com/ruby/strscan/commit/29ad49f89d
2025-10-14 00:42:32 +00:00
BurdetteLamar
25821f3438 [DOC] Tweaks for String#rjust 2025-10-13 18:14:57 -04:00
BurdetteLamar
53ca9fbb4c [DOC] Tweaks for String#rjust 2025-10-13 18:14:57 -04:00
Étienne Barrié
79b2685675 [DOC] Fix typos
Inspired by 42ba82424d908c290a4a34ced8853f0a403b734b, I looked for other
occurrences of "the the".
2025-10-13 15:21:36 -04:00
Sharon Rosner
d11df4172e [ruby/erb] html_escape: refactor redundant if
(https://github.com/ruby/erb/pull/88)

https://github.com/ruby/erb/commit/c231ced3f4
2025-10-13 14:48:58 +00:00
Nobuyoshi Nakada
f0a76f6295
ruby_defint.m4: variable names must not contain spaces 2025-10-13 22:06:11 +09:00
Satoshi Tagomori
c78895b1d6 Add "Namespace detection information" section in bug reports
* To show environments stack when the current namespace is unexpected or
  namespace detection is broken
* It is displayed only when RUBY_BUGREPORT_NAMESPACE_ENV=1 is specified
2025-10-13 17:41:36 +09:00
git
c938c11f10 Update default gems list at 226312ecd45304698f5ac74f941305 [ci skip] 2025-10-12 08:00:03 +00:00
Takashi Kokubun
226312ecd4 [ruby/erb] Version 5.1.1
https://github.com/ruby/erb/commit/3dc0bb09bf
2025-10-12 07:58:37 +00:00
Nobuyoshi Nakada
7cc3191ea1 [ruby/erb] Fix integer overflow
Fix https://github.com/ruby/erb/pull/87

https://github.com/ruby/erb/commit/75764f022b
2025-10-12 04:57:43 +00:00
Alan Wu
6be2a5104d YJIT: ZJIT: Fix rustdoc dead links 2025-10-12 00:51:59 -04:00
Alan Wu
21e81160e6 CI: Surface rustdoc warnings
Soft fails like warnings from rustc. The `rustdoc` warnings tend to be
dead links in the markup.
2025-10-12 00:51:59 -04:00
Alan Wu
32b98d71e6 YJIT: Fix unused warning from cargo test 2025-10-12 00:51:59 -04:00
git
a6f92ddd12 Update default gems list at 02d8a001eed707f8cd130f5c644f5c [ci skip] 2025-10-11 22:39:27 +00:00
Takashi Kokubun
02d8a001ee [ruby/erb] Version 5.1.0
https://github.com/ruby/erb/commit/25fdde41d6
2025-10-11 22:37:53 +00:00
Sharon Rosner
fa54a9c9e5 [ruby/erb] html_escape: Avoid buffer allocation for strings with no
escapable character
(https://github.com/ruby/erb/pull/87)

This change improves reduces allocations and makes `html_escape` ~35% faster in
a benchmark with escaped strings taken from the `test_html_escape` test in
`test/test_erb.rb`.

- Perform buffer allocation on first instance of escapable character.
- Instead of copying characters one at a time, copy unescaped segments using
  `memcpy`.

https://github.com/ruby/erb/commit/aa482890fe
2025-10-11 22:36:21 +00:00
Peter Zhu
89dc79eeba Ignore thread not suspended warning messages in LSAN
When a process with multiple threads is forked, LSAN outputs warning
messages to stderr like:

    ==276855==Running thread 276851 was not suspended. False leaks are possible.

We should ignore messages like this in tests.
2025-10-11 18:03:17 -04:00
Kevin Newton
d036dc0a79 For prism parser, do not update $_ from STDIN
Fixes [Bug #21635]
2025-10-11 15:08:07 -04:00
Stan Lo
10c0d7a839
ZJIT: Count unoptimized Send (#14801)
* ZJIT: Count unoptimized `Send`

This includes `Send` in `send fallback reasons` to guide future
optimizations.

* ZJIT: Create dedicated def_type counter for Send
2025-10-11 10:41:29 -07:00
Bilka
e8f0e1423b [DOC] Fix typo in Regexp Optimization section 2025-10-11 15:00:21 +09:00
Nobuyoshi Nakada
e500265b09 commit-email.rb: Suppress warnings
* assigned but unused variable
* literal string will be frozen in the future
2025-10-11 11:01:56 +09:00
Nobuyoshi Nakada
fa883a4de8 test_commit_email.rb: Simply use sh
`env` on macOS resets DYLD environment variables that are needed to
run ruby configured with `--enable-load-relative`.  Use simple
commands instead, and `/bin/sh` that is specified in POSIX is more
portable than `/usr/bin/env`.
2025-10-11 11:01:56 +09:00
Nobuyoshi Nakada
b868beea10 commit-email.rb: Suppres git signed commit signatures
When setting `log.showSignature=true`, `git log` and `git show`
include messages gpg verfied the commits, in addition to the message
specified by `--pretty`.
2025-10-11 11:01:56 +09:00
Peter Zhu
07b59eee6a Fix memory leak when load_from_binary raises
ibf_load_code will leak memory allocated for the code if an exception is
raised. The following script reproduces the leak:

    bin = RubyVM::InstructionSequence.of(1.method(:abs)).to_binary

    10.times do
      100_000.times do
        RubyVM::InstructionSequence.load_from_binary(bin)
      rescue ArgumentError
      end
      puts `ps -o rss= -p #{$$}`
    end

Before:

    18004
    23380
    28756
    34260
    39892
    45396
    50772
    55892
    61012
    66132

After:

    12536
    12920
    13304
    13688
    14072
    14456
    14840
    15352
    15608
    15864
2025-10-10 19:24:55 -04:00
Takashi Kokubun
d0d1246cd4 sync_default_gems.rb: Minimize the number of refs
fetched from the repository
2025-10-10 14:49:23 -07:00
Burdette Lamar
0090311db2
[DOC] String slices doc (#14740) 2025-10-10 16:39:05 -04:00
John Hawthorn
0a6cd03b3d Add ASSERT_vm_locking_with_barrier
Previously we just had a comment stating that the code required a
barrier. Turns out it's not too difficult to properly assert that.

Co-authored-by: Luke Gruber <luke.gru@gmail.com>
2025-10-10 11:09:34 -07:00
Takashi Kokubun
2de13f4d09 ZJIT: Remove an unneeded ?
https://github.com/ruby/ruby/pull/14717
2025-10-10 10:24:17 -07:00