summaryrefslogtreecommitdiff
path: root/test/ruby/test_jit.rb
AgeCommit message (Collapse)Author
2022-05-20Rename test_jit to test_mjitTakashi Kokubun
to avoid confusion with YJIT
2022-01-04Use omit instead of skip: test/ruby/**/*.rbHiroshi SHIBATA
2021-12-13Prepare for removing RubyVM::JIT (#5262)Takashi Kokubun
Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2021-12-13Rename --jit to --mjit (#5248)Takashi Kokubun
* Rename --jit to --mjit [Feature #18349] * Fix a few more --jit references * Fix MJIT Actions * More s/jit/mjit/ and re-introduce --disable-jit * Update NEWS.md * Fix test_bug_reporter_add Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2021-11-18Optimize dynamic string interpolation for symbol/true/false/nil/0-9Jeremy Evans
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>
2021-11-12test/ruby/test_jit.rb: suppress a false-positive warningYusuke Endoh
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
2021-10-25test/ruby/test_jit.rb: Add a test for checkmatch insnYusuke Endoh
2021-10-25test/ruby/test_jit.rb: Print a hint at exit of the original processYusuke Endoh
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 ```
2021-08-12Don't cancel JIT-ed code on TracePoint :classTakashi Kokubun
events get enabled
2021-08-12Print JIT cancel when all JIT-ed code is cancelledTakashi Kokubun
2021-05-28compile.c: Emit send for === calls in when statementsAlan Wu
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
2021-04-26Remove test of removed reverse VM instructionKazuhiro NISHIYAMA
since 5512353d97250e85c13bf10b9b32e750478cf474
2021-01-18Avoid suppressing unrelated warningsTakashi Kokubun
2021-01-19test/ruby/test_jit.rb: Avoid a warningYusuke Endoh
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 ```
2021-01-18Fix JIT link failuresTakashi Kokubun
forgotten in https://github.com/ruby/ruby/pull/4018
2021-01-13Rename RubyVM::MJIT to RubyVM::JITTakashi Kokubun
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]
2021-01-04Fix broken JIT of getinlinecacheTakashi Kokubun
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.
2021-01-03Avoid hanging on --jit-wait after MJIT.pauseTakashi Kokubun
When a worker is stopped, nobody will JIT a method for you.
2020-12-10Remove the uninitialized instance variable verbose mode warningJeremy Evans
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
2020-11-27Fix compactions.size for throttlingTakashi Kokubun
096f54428d changes the behavior for this kind of cases.
2020-11-27Try to fix the mswin CI failureTakashi Kokubun
Sorry, I forgot to add this in 122cd35939 while I said I did something for it.
2020-11-27Avoid unloading units which have enough total_callsTakashi Kokubun
instead of just unloading worst 10% methods.
2020-11-27Run unload_units in the JIT worker threadTakashi Kokubun
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.
2020-11-26Always clean up leftovers at ci.rvm.jpTakashi Kokubun
to prevent failures like http://ci.rvm.jp/logfiles/brlog.trunk-mjit.20201126-182515. Since fa1250a506e9b6a1bcbf664f6b7b9c06e045d9b9, it should be safe to do this.
2020-09-15Interpolated strings are no longer frozen with frozen-string-literal: trueBenoit Daloze
* Remove freezestring instruction since this was the only usage for it. * [Feature #17104] Notes: Merged: https://github.com/ruby/ruby/pull/3488
2020-08-11Enable s390x invokebuiltin JIT test againTakashi Kokubun
2020-07-10Fix an inaccurate comment in test_jitTakashi Kokubun
2020-07-10Make sure vm_call_cfunc uses inlined ccTakashi Kokubun
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.
2020-07-04Check ROBJECT_EMBED on guards-merged ivar accessTakashi Kokubun
Fix CI failure like http://ci.rvm.jp/results/trunk-mjit-wait@silicon-docker/3043247 introduced by a69dd699ee630dd1086627dbca15a218a8538b6f
2020-07-03Make Kernel#then, #yield_self, #frozen? builtin (#3283)Takashi Kokubun
* Make Kernel#then, #yield_self, #frozen? builtin * Fix test_jit Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2020-06-25Collect insns from a child processTakashi Kokubun
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
2020-06-24Do not JIT inline builtin methodsTakashi Kokubun
It's probably not worth it because there's nothing we can optimize in such builtin methods. It's worth JIT only when inlined.
2020-06-21test/ruby/test_jit.rb: Change the condition to detect RHEL 7.1 s390xYusuke Endoh
2020-06-20Skip a test_jit with builtin for rhel_zlinuxTakashi Kokubun
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.
2020-06-20Make Integer#zero? a separated method and builtin (#3226)Takashi Kokubun
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>
2020-06-17Remove obsoleted opt_call_c_function insn (#3232)Takashi Kokubun
* Remove obsoleted opt_call_c_function insn * Keep opt_call_c_function with DEFINE_INSN_IF Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2020-05-03Test no .dSYM on macOSTakashi Kokubun
I think 9aa5fe1bf89db8cd215b24d8ddfb668714681b83 helps this issue too.
2020-05-03Skip pdb corruption on Visual Studio 2015 as wellTakashi Kokubun
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
2020-05-03Skip only .dSYM cleanup on macOSTakashi Kokubun
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.
2020-05-01Deduplicate functions in compacted JIT codeTakashi Kokubun
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)
2020-04-30Switch test_unload_units_and_compaction on mswinTakashi Kokubun
because we support JIT compaction on it
2020-04-30Do not stop the world during JIT compactionTakashi Kokubun
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.
2020-04-18Make sure newarraykwsplat accesses a correct indexTakashi Kokubun
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.
2020-03-30Optimize exivar access on JIT-ed getivarTakashi Kokubun
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
2020-03-28Clean up /tmp leftovers in ci.rvm.jpTakashi Kokubun
2020-03-06Propagate JIT skip to all testsTakashi Kokubun
2020-03-06Skip jit_test on some new RubyCI envs for nowTakashi Kokubun
2020-02-28Prevent unloading methods used in root_fiber while calling another Fiber (#2939)Takashi Kokubun
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>
2020-02-28Avoid infinite loop on --jit-waitTakashi Kokubun
2020-02-18Avoid jumping to a wrong destinationTakashi Kokubun
when the next insn is already compiled by former branches.