| Age | Commit message (Collapse) | Author |
|
|
|
lobsters:
```
Top-20 calls to C functions from JIT code (79.9% of total 97,004,883):
rb_vm_opt_send_without_block: 19,874,212 (20.5%)
rb_vm_setinstancevariable: 9,774,841 (10.1%)
rb_ivar_get: 9,358,866 ( 9.6%)
rb_hash_aref: 6,828,948 ( 7.0%)
rb_vm_send: 6,441,551 ( 6.6%)
rb_vm_env_write: 5,375,989 ( 5.5%)
rb_vm_invokesuper: 3,037,836 ( 3.1%)
Module#===: 2,562,446 ( 2.6%)
rb_ary_entry: 2,354,546 ( 2.4%)
Kernel#is_a?: 1,424,092 ( 1.5%)
rb_vm_opt_getconstant_path: 1,344,923 ( 1.4%)
Thread.current: 1,300,822 ( 1.3%)
rb_zjit_defined_ivar: 1,222,613 ( 1.3%)
rb_vm_invokeblock: 1,184,555 ( 1.2%)
Hash#[]=: 1,061,969 ( 1.1%)
rb_ary_push: 1,024,987 ( 1.1%)
rb_ary_new_capa: 904,003 ( 0.9%)
rb_str_buf_append: 833,782 ( 0.9%)
rb_class_allocate_instance: 822,626 ( 0.8%)
Hash#fetch: 755,913 ( 0.8%)
```
railsbench:
```
Top-20 calls to C functions from JIT code (74.8% of total 189,170,268):
rb_vm_opt_send_without_block: 29,870,307 (15.8%)
rb_vm_setinstancevariable: 17,631,199 ( 9.3%)
rb_hash_aref: 16,928,890 ( 8.9%)
rb_ivar_get: 14,441,240 ( 7.6%)
rb_vm_env_write: 11,571,001 ( 6.1%)
rb_vm_send: 11,153,457 ( 5.9%)
rb_vm_invokesuper: 7,568,267 ( 4.0%)
Module#===: 6,065,923 ( 3.2%)
Hash#[]=: 2,842,990 ( 1.5%)
rb_ary_entry: 2,766,125 ( 1.5%)
rb_ary_push: 2,722,079 ( 1.4%)
rb_vm_invokeblock: 2,594,398 ( 1.4%)
Thread.current: 2,560,129 ( 1.4%)
rb_str_getbyte: 1,965,627 ( 1.0%)
Kernel#is_a?: 1,961,815 ( 1.0%)
rb_vm_opt_getconstant_path: 1,863,678 ( 1.0%)
rb_hash_new_with_size: 1,796,456 ( 0.9%)
rb_class_allocate_instance: 1,785,043 ( 0.9%)
String#empty?: 1,713,414 ( 0.9%)
rb_ary_new_capa: 1,678,834 ( 0.9%)
```
shipit:
```
Top-20 calls to C functions from JIT code (83.4% of total 182,402,821):
rb_vm_opt_send_without_block: 45,753,484 (25.1%)
rb_ivar_get: 21,020,650 (11.5%)
rb_vm_setinstancevariable: 17,528,603 ( 9.6%)
rb_hash_aref: 11,892,856 ( 6.5%)
rb_vm_send: 11,723,471 ( 6.4%)
rb_vm_env_write: 10,434,452 ( 5.7%)
Module#===: 4,225,048 ( 2.3%)
rb_vm_invokesuper: 3,705,906 ( 2.0%)
Thread.current: 3,337,603 ( 1.8%)
rb_ary_entry: 3,114,378 ( 1.7%)
Hash#[]=: 2,509,912 ( 1.4%)
Array#empty?: 2,282,994 ( 1.3%)
rb_vm_invokeblock: 2,210,511 ( 1.2%)
Hash#fetch: 2,017,960 ( 1.1%)
_bi20: 1,975,147 ( 1.1%)
rb_zjit_defined_ivar: 1,897,127 ( 1.0%)
rb_vm_opt_getconstant_path: 1,813,294 ( 1.0%)
rb_ary_new_capa: 1,615,406 ( 0.9%)
Kernel#is_a?: 1,567,854 ( 0.9%)
rb_class_allocate_instance: 1,560,035 ( 0.9%)
```
Thanks to @eregon for the idea.
Co-authored-by: Jacob Denbeaux <jacob.denbeaux@shopify.com>
Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
|
|
This implements Shopify#854:
- Splits boot-time and enable-time initialization,
tracks progress with `InitializationState` enum
- Introduces `RubyVM::ZJIT.enable` Ruby method for
enabling the JIT lazily, if not already enabled
- Introduces `--zjit-disable` flag, which can be
used alongside the other `--zjit-*` flags but
prevents enabling the JIT at boot time
- Adds ZJIT infra to support JIT hooks, but this
is not currently exercised (Shopify/ruby#667)
Left for future enhancements:
- Support kwargs for overriding the CLI flags in
`RubyVM::ZJIT.enable`
Closes Shopify#854
|
|
|
|
|
|
|
|
* ZJIT: Add HIR for CCallWithFrame
* ZJIT: Update stats to count not inlined cfunc calls
* ZJIT: Stops optimizing SendWithoutBlock when TracePoint is activated
* ZJIT: Fallback to SendWithoutBlock when CCallWithFrame has too many args
* ZJIT: Rename cfun -> cfunc
|
|
|
|
|
|
Add side exit tracing functionality for ZJIT
|
|
|
|
* ZJIT: Add stats for cfuncs that are not optimized
* ZJIT: Add IncrCounterPtr HIR instead
From `lobsters`
```
Top-20 Unoptimized C functions (73.0% of total 15,276,688):
Kernel#is_a?: 2,052,363 (13.4%)
Class#current: 1,892,623 (12.4%)
String#to_s: 975,973 ( 6.4%)
Hash#key?: 677,623 ( 4.4%)
String#empty?: 636,468 ( 4.2%)
TrueClass#===: 457,232 ( 3.0%)
Hash#[]=: 455,908 ( 3.0%)
FalseClass#===: 448,798 ( 2.9%)
ActiveSupport::OrderedOptions#_get: 377,468 ( 2.5%)
Kernel#kind_of?: 339,551 ( 2.2%)
Kernel#dup: 329,371 ( 2.2%)
String#==: 324,286 ( 2.1%)
String#include?: 297,528 ( 1.9%)
Hash#[]: 294,561 ( 1.9%)
Array#include?: 287,145 ( 1.9%)
Kernel#block_given?: 283,633 ( 1.9%)
BasicObject#!=: 278,874 ( 1.8%)
Hash#delete: 250,951 ( 1.6%)
Set#include?: 246,447 ( 1.6%)
NilClass#===: 242,776 ( 1.6%)
```
From `liquid-render`
```
Top-20 Unoptimized C functions (99.8% of total 5,195,549):
Hash#key?: 2,459,048 (47.3%)
String#to_s: 1,119,758 (21.6%)
Set#include?: 799,469 (15.4%)
Kernel#is_a?: 214,223 ( 4.1%)
Integer#<<: 171,073 ( 3.3%)
Integer#/: 127,622 ( 2.5%)
CGI::EscapeExt#escapeHTML: 56,971 ( 1.1%)
Regexp#===: 50,008 ( 1.0%)
String#empty?: 43,990 ( 0.8%)
String#===: 36,838 ( 0.7%)
String#==: 21,309 ( 0.4%)
Time#strftime: 21,251 ( 0.4%)
String#strip: 15,271 ( 0.3%)
String#scan: 13,753 ( 0.3%)
String#+@: 12,603 ( 0.2%)
Array#include?: 8,059 ( 0.2%)
String#+: 5,295 ( 0.1%)
String#dup: 4,606 ( 0.1%)
String#-@: 3,213 ( 0.1%)
Class#generate: 3,011 ( 0.1%)
```
|
|
* ZJIT: Allow testing JIT code on zjit-test
* Resurrect TestingAllocator tests
|
|
* ZJIT: Share more code with YJIT in jit.c
* Fix ZJIT references to JIT
|
|
* Using the shared jit crate, support for a single global_allocator can
function
* Solves --zjit-mem-size
|
|
|
|
|
|
This fixes issues related to the process changing directory and not
having only a relative path.
Thanks, Alan.
|
|
|
|
|
|
* ZJIT: Add --zjit-exec-mem-size
* Add a comment about the limit
|
|
|
|
This allows us to annotate builtin functions with their return type.
|
|
|
|
|
|
Add support for `--zjit-allowed-iseqs=SomeFile` and
`--zjit-log-compiled-iseqs=SomeFile` so we can restrict and inspect
which ISEQs get compiled.
Then add `jit_bisect.rb` which we can run to try and narrow a failing
script. For example:
plum% ../tool/zjit_bisect.rb ../build-dev/miniruby "test.rb"
I, [2025-07-29T12:41:18.657177 #96899] INFO -- : Starting with JIT list of 4 items.
I, [2025-07-29T12:41:18.657229 #96899] INFO -- : Verifying items
I, [2025-07-29T12:41:18.726213 #96899] INFO -- : step fixed[0] and items[4]
I, [2025-07-29T12:41:18.726246 #96899] INFO -- : 4 candidates
I, [2025-07-29T12:41:18.797212 #96899] INFO -- : 2 candidates
Reduced JIT list:
bar@test.rb:8
plum%
We start with 4 compiled functions and shrink to just one.
|
|
|
|
|
|
Co-authored-by: Max Bernstein <max@bernsteinbear.com>
|
|
Co-authored-by: Max Bernstein <tekknolagi@gmail.com>
Notes:
Merged-By: k0kubun <takashikkbn@gmail.com>
|
|
Co-authored-by: Max Bernstein <tekknolagi@gmail.com>
Co-authored-by: Alan Wu <alansi.xingwu@shopify.com>
Notes:
Merged-By: k0kubun <takashikkbn@gmail.com>
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/13131
|
|
A new optimization pass. Also:
- Printing for `Insn::CCall`
- Wrap `ID` and add convenience method for printing, replacing calls to rb_id2name()
Notes:
Merged: https://github.com/ruby/ruby/pull/13131
|
|
(https://github.com/Shopify/zjit/pull/95)
* Remove immediately deferenced borrow operators
source: https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
* Remove unnecessary cast as i64
Since Const::CInt64 wraps i64, it is unnecessary to cast to i64.
* Remove unnecessary borrow operators
* Beautify assign operation syntax
* Use .is_null() convenience method
* Omit .into() call from u32 to u32
* Use more descriptive std::ptr::null<VALUE>()
In lieu of casting a literal as a type, opt to use the convenience type.
* Use sized integer literal
* Simplify pattern matching to explicit check
Notes:
Merged: https://github.com/ruby/ruby/pull/13131
|
|
(https://github.com/Shopify/zjit/pull/43)
Notes:
Merged: https://github.com/ruby/ruby/pull/13131
|
|
(https://github.com/Shopify/zjit/pull/40)
* Assert everything is compiled in test_zjit
* Update a comment on rb_zjit_assert_compiles
Co-authored-by: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>
* Add a comment about assert_compiles
* Actually use pipe_fd
---------
Co-authored-by: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>
Notes:
Merged: https://github.com/ruby/ruby/pull/13131
|
|
(https://github.com/Shopify/zjit/pull/39)
Notes:
Merged: https://github.com/ruby/ruby/pull/13131
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/13131
|
|
to share the initialization of other globals in the future as well
Notes:
Merged: https://github.com/ruby/ruby/pull/13131
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/13131
|
|
since it's only about ZJITState at the moment. Because it's no longer
called "CodegenGlobals", we don't have any reason to keep it in
codegen.rs.
Notes:
Merged: https://github.com/ruby/ruby/pull/13131
|