Age | Commit message (Collapse) | Author |
|
This provides a significant speedup for symbol, true, false,
nil, and 0-9, class/module, and a small speedup in most other cases.
Speedups (using included benchmarks):
:symbol :: 60%
0-9 :: 50%
Class/Module :: 50%
nil/true/false :: 20%
integer :: 10%
[] :: 10%
"" :: 3%
One reason this approach is faster is it reduces the number of
VM instructions for each interpolated value.
Initial idea, approach, and benchmarks from Eric Wong. I applied
the same approach against the master branch, updating it to handle
the significant internal changes since this was first proposed 4
years ago (such as CALL_INFO/CALL_CACHE -> CALL_DATA). I also
expanded it to optimize true/false/nil/0-9/class/module, and added
handling of missing methods, refined methods, and RUBY_DEBUG.
This renames the tostring insn to anytostring, and adds an
objtostring insn that implements the optimization. This requires
making a few functions non-static, and adding some non-static
functions.
This disables 4 YJIT tests. Those tests should be reenabled after
YJIT optimizes the new objtostring insn.
Implements [Feature #13715]
Co-authored-by: Eric Wong <e@80x24.org>
Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
Co-authored-by: Yusuke Endoh <mame@ruby-lang.org>
Co-authored-by: Koichi Sasada <ko1@atdot.net>
Notes:
Merged: https://github.com/ruby/ruby/pull/5002
Merged-By: jeremyevans <code@jeremyevans.net>
|
|
It reports "opt_regexpmatch2 insn is not included", but actually it is
included. This is due to a known bug of ISeq#to_a on which this check
depends.
https://bugs.ruby-lang.org/issues/18269
|
|
|
|
Otherwise, the hint is printed whenever fork is called.
http://rubyci.s3.amazonaws.com/debian9/ruby-master/log/20211025T093004Z.log.html.gz
```
[20244/21156] TestThread#test_fork_while_lockedyou may want to add tests for following insns, when you have a chance: checkmatch
you may want to add tests for following insns, when you have a chance: checkmatch
you may want to add tests for following insns, when you have a chance: checkmatch
= 0.19 s
```
|
|
events get enabled
|
|
|
|
The checkmatch instruction with VM_CHECKMATCH_TYPE_CASE calls
=== without a call cache. Emit a send instruction to make the call
instead. It includes a call cache.
The call cache improves throughput of using when statements to check the
class of a given object. This is useful for say, JSON serialization.
Use of a regular send instead of checkmatch also avoids taking the VM
lock every time, which is good for multi-ractor workloads.
Calculating -------------------------------------
master post
vm_case_classes 11.013M 16.172M i/s - 6.000M times in 0.544795s 0.371009s
vm_case_lit 2.296 2.263 i/s - 1.000 times in 0.435606s 0.441826s
vm_case 74.098M 64.338M i/s - 6.000M times in 0.080974s 0.093257s
Comparison:
vm_case_classes
post: 16172114.4 i/s
master: 11013316.9 i/s - 1.47x slower
vm_case_lit
master: 2.3 i/s
post: 2.3 i/s - 1.01x slower
vm_case
master: 74097858.6 i/s
post: 64338333.9 i/s - 1.15x slower
The vm_case benchmark is a bit slower post patch, possibily due to the
larger instruction sequence. The benchmark dispatches using
opt_case_dispatch so was not running checkmatch and does not make the
=== call post patch.
Notes:
Merged: https://github.com/ruby/ruby/pull/4468
|
|
since 5512353d97250e85c13bf10b9b32e750478cf474
|
|
|
|
http://rubyci.s3.amazonaws.com/ubuntu2004/ruby-master/log/20210119T033003Z.log.html.gz
```
/home/chkbuild/chkbuild/tmp/build/20210119T033003Z/ruby/test/ruby/test_jit.rb:781:
warning: -e:5: warning: possibly useless use of -@ in void context
```
|
|
forgotten in https://github.com/ruby/ruby/pull/4018
|
|
because the name "MJIT" is an internal code name, it's inconsistent with
--jit while they are related to each other, and I want to discourage future
JIT implementation-specific (e.g. MJIT-specific) APIs by this rename.
[Feature #17490]
|
|
e7fc353f04 reverted vm_ic_hit_p's signature change made in 53babf35ef,
which broke JIT compilation of getinlinecache.
To make sure it doesn't happen again, I separated vm_inlined_ic_hit_p to
make the intention clear.
|
|
When a worker is stopped, nobody will JIT a method for you.
|
|
This speeds up all instance variable access, even when not in
verbose mode. Uninitialized instance variable warnings were
rarely helpful, and resulted in slower code if you wanted to
avoid warnings when run in verbose mode.
Implements [Feature #17055]
Notes:
Merged: https://github.com/ruby/ruby/pull/3879
|
|
096f54428d changes the behavior for this kind of cases.
|
|
Sorry, I forgot to add this in 122cd35939 while I said I did something
for it.
|
|
instead of just unloading worst 10% methods.
|
|
to avoid "Too many JIT code, but skipped unloading units for JIT compaction".
Now we can forget the `in_compact` locking.
Moving some functions from mjit.c to mjit_worker.c because mjit_worker.c
should have functions executed in the JIT worker.
|
|
to prevent failures like
http://ci.rvm.jp/logfiles/brlog.trunk-mjit.20201126-182515.
Since fa1250a506e9b6a1bcbf664f6b7b9c06e045d9b9, it should be safe to do
this.
|
|
* Remove freezestring instruction since this was the only usage for it.
* [Feature #17104]
Notes:
Merged: https://github.com/ruby/ruby/pull/3488
|
|
|
|
|
|
which is checked by the first guard. When JIT-inlined cc and operand
cd->cc are different, the JIT-ed code might wrongly dispatch cd->cc even
while class check is done with another cc inlined by JIT.
This fixes SEGV on railsbench.
|
|
Fix CI failure like
http://ci.rvm.jp/results/trunk-mjit-wait@silicon-docker/3043247
introduced by a69dd699ee630dd1086627dbca15a218a8538b6f
|
|
* Make Kernel#then, #yield_self, #frozen? builtin
* Fix test_jit
Notes:
Merged-By: k0kubun <takashikkbn@gmail.com>
|
|
to make sure :opt_invokebuiltin_delegate_leave doesn't become
:(trace_)opt_invokebuiltin_delegate.
This is to prevent a warning like
> /tmp/ruby/v3/src/trunk-test/test/ruby/test_jit.rb:618: warning:
'opt_invokebuiltin_delegate_leave' insn is not included in the script.
Actual insns are: opt_invokebuiltin_delegate leave
|
|
It's probably not worth it because there's nothing we can optimize in
such builtin methods. It's worth JIT only when inlined.
|
|
|
|
Either 95b0fed371 or 7561db8c00 started to cause
https://rubyci.org/logs/rubyci.s3.amazonaws.com/rhel_zlinux/ruby-master/log/20200621T053303Z.fail.html.gz
But so far no idea why it's happening. Until I get direct ssh access to
debug the details, let me skip this as it's essentially not ruby's fault.
|
|
A prerequisite to fix https://bugs.ruby-lang.org/issues/15589 with JIT.
This commit alone doesn't make a significant difference yet, but I thought
this commit should be committed independently.
This method override was discussed in [Misc #16961].
Notes:
Merged-By: k0kubun <takashikkbn@gmail.com>
|
|
* Remove obsoleted opt_call_c_function insn
* Keep opt_call_c_function with DEFINE_INSN_IF
Notes:
Merged-By: k0kubun <takashikkbn@gmail.com>
|
|
I think 9aa5fe1bf89db8cd215b24d8ddfb668714681b83 helps this issue too.
|
|
It turned out that the pdb corruption happens on Visual Studio 2015 as
well.
https://ci.appveyor.com/project/ruby/ruby/builds/32602953/job/3gj43q18wqeiy729
|
|
Fix https://github.com/ruby/ruby/runs/636020145 without skipping too
many tests.
It seems that .c -> .o with debug flags and .o -> .so without debug
flags did not generate .dSYM but now .c -> .so with debug flags seems to
generate a .dSYM directory. As --jit-debug should not be used by normal
users, let me skip implementing the removal for now.
|
|
to improve code locality.
Using benchmark-driver/sinatra with 100 methods JIT-ed,
[Before] 12149.97 rps
1.3M /tmp/_ruby_mjit_p31171u145.so
[After] 12818.83 rps
260K /tmp/_ruby_mjit_p32155u145.so
(VM is 13714.89 rps)
|
|
because we support JIT compaction on it
|
|
Running C compiler for JIT compaction inside a critical section may lock
main thread for a long time when it triggers GC. As I'm planning to
increase this duration a bit, I'd like to make sure this doesn't stop
the world.
For now, I chose to give up unloading units when it's during JIT
compaction, assuming other calls may unload them later.
|
|
on stack when local_stack_p is enabled.
This fixes `RB_FL_TEST_RAW:"RB_FL_ABLE(obj)"` assertion failure
on power_assert's test with JIT enabled.
|
|
JIT support of dd723771c11.
$ benchmark-driver -v --rbenv 'before;before --jit;after --jit' benchmark/mjit_exivar.yml --repeat-count=4
before: ruby 2.8.0dev (2020-03-30T12:32:26Z master e5db3da9d3) [x86_64-linux]
before --jit: ruby 2.8.0dev (2020-03-30T12:32:26Z master e5db3da9d3) +JIT [x86_64-linux]
after --jit: ruby 2.8.0dev (2020-03-31T05:57:24Z mjit-exivar 128625baec) +JIT [x86_64-linux]
Calculating -------------------------------------
before before --jit after --jit
mjit_exivar 57.944M 53.579M 54.471M i/s - 200.000M times in 3.451588s 3.732772s 3.671687s
Comparison:
mjit_exivar
before: 57944345.1 i/s
after --jit: 54470876.7 i/s - 1.06x slower
before --jit: 53579483.4 i/s - 1.08x slower
|
|
|
|
|
|
|
|
Fixing SEGVs like:
http://ci.rvm.jp/results/trunk-mjit-wait@silicon-docker/2744905
http://ci.rvm.jp/results/trunk-mjit-wait@silicon-docker/2744420
http://ci.rvm.jp/results/trunk-mjit-wait@silicon-docker/2741400
Notes:
Merged-By: k0kubun <takashikkbn@gmail.com>
|
|
|
|
when the next insn is already compiled by former branches.
|
|
to fix test failure on trunk-no-mjit
https://gist.github.com/ko1/32ab982ffd7555988818773c08f97123
|
|
|
|
This reverts commit 67c574736912003c377218153f9d3b9c0c96a17b.
[Feature #16275]
|
|
|