summaryrefslogtreecommitdiff
path: root/test/ruby/test_jit.rb
AgeCommit message (Collapse)Author
2019-08-29Revert "Remove warnings of flip-flop deprecation from tests and specs"Nobuyoshi Nakada
This reverts commit bf7a32d22079cc44eb19794e41d82b886d5d17b3. flip-flop is no longer deprecated. [Feature #5400]
2019-08-12Add another test for frame omitted inliningTakashi Kokubun
2019-08-02Revert "Remove opt_nil_p test to remove warning for now"Yusuke Endoh
This reverts commit a1727e43af18c122c4d7adfa603f895fdc8f3df1.
2019-08-02Remove opt_nil_p test to remove warning for nowTakashi Kokubun
2019-08-02Fix uplevelNobuyoshi Nakada
2019-08-01Add a test for opt_nil_pTakashi Kokubun
2019-07-14MJIT Support for getblockparamproxyTakashi Kokubun
2019-07-09Restore support library for only test files.Hiroshi SHIBATA
2019-07-03Just disable inlining with local varaible for nowTakashi Kokubun
This partially reverts commit 712a66b0741605f5b2db670a292b9bb352f8a716. The previous fix made CI strange like: http://ci.rvm.jp/results/trunk-vm-asserts@silicon-docker/2124178 Let me just downgrade the behavior for now and deal with it later. [Bug #15971]
2019-07-03Revert "Avoid corrupting VM stack on inlined setlocal"Koichi Sasada
This reverts commit ea30dd702512ff9df34fe8c71c825f8f901bf5b1. because it fails when VM_CHECK_MODE=1.
2019-07-02Avoid corrupting VM stack on inlined setlocalTakashi Kokubun
setlocal relies on cfp->ep, and frame-omitted method inlining introduced in Ruby 2.7 kept it wrong. This change might slow down frame-omitted method inlining for cfp->ep manipulation, and it obviously complicates the implementaion more. By introducing an optimization that changes Ruby's local variable to C local variable, we could optimize it and simplify the cfp->ep manipulation later. [Bug #15971]
2019-07-02Adjust jit_support file path.Hiroshi SHIBATA
2019-04-14Prefer uintptr_t over ptrdiff_t for i686k0kubun
as debugged in PR [close https://github.com/ruby/ruby/pull/2130] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67549 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-14Revert "Try to set false explicitly"k0kubun
This reverts commit a1b5d20068a9b1859b383b249e510cd33d196e4a. Revert "Revert "Skip recompiling tests on i686 Linux"" This reverts commit 7b88a9207b97b94bc3c3be35084c742296f4aff2. Revert "Simplify matrix for debugging" This reverts commit e85d6c5c5e62dde37c6f6ffdb7125b9008b9ebfa. Sorry, these 3 commits were under debugging in https://github.com/ruby/ruby/pull/2129 but accidentally merged by using `git svn dcommit` instead of `git push` to the topic branch :bow: git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67538 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-14Revert "Skip recompiling tests on i686 Linux"k0kubun
This reverts commit 19513c88d5f923abb7f226520192aef9f3fcc1c7. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-14Fix typo in platform matcherk0kubun
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-14Skip recompiling tests on i686 Linuxk0kubun
somehow they are filing like https://travis-ci.org/ruby/ruby/jobs/519830085 but they are not so fatal. Let me just skip them for now and fix tests afterwards. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-14Recompile JIT-ed code without optimizationk0kubun
based on inline cache when JIT cancel happens by that. This feature was in the original MJIT implementation by Vladimir, but on merging MJIT to Ruby it was removed for simplification. This commit adds the functionality again for the following benchmark: https://github.com/benchmark-driver/misc/blob/52f05781f65467baf895bf6ba79d172c9b0826fd/concurrent-map/bench.rb (shown float is duration seconds. shorter is better) * Before ``` $ INHERIT=0 ruby -v bench.rb ruby 2.7.0dev (2019-04-13 trunk 67523) [x86_64-linux] -- 1.6507579649914987 $ INHERIT=0 ruby -v --jit bench.rb ruby 2.7.0dev (2019-04-13 trunk 67523) +JIT [x86_64-linux] -- 1.5091587850474752 $ INHERIT=1 ruby -v bench.rb ruby 2.7.0dev (2019-04-13 trunk 67523) [x86_64-linux] -- 1.6124781150138006 $ INHERIT=1 ruby --jit -v bench.rb ruby 2.7.0dev (2019-04-13 trunk 67523) +JIT [x86_64-linux] -- 1.7495657080435194 # <-- this ``` * After ``` $ INHERIT=0 ruby -v bench.rb ruby 2.7.0dev (2019-04-13 trunk 67523) [x86_64-linux] last_commit=Recompile JIT-ed code without optimization -- 1.653559010999743 $ INHERIT=0 ruby --jit -v bench.rb ruby 2.7.0dev (2019-04-13 trunk 67523) +JIT [x86_64-linux] last_commit=Recompile JIT-ed code without optimization -- 1.4738391840364784 $ INHERIT=1 ruby -v bench.rb ruby 2.7.0dev (2019-04-13 trunk 67523) [x86_64-linux] last_commit=Recompile JIT-ed code without optimization -- 1.645227018976584 $ INHERIT=1 ruby --jit -v bench.rb ruby 2.7.0dev (2019-04-13 trunk 67523) +JIT [x86_64-linux] last_commit=Recompile JIT-ed code without optimization -- 1.523708809982054 # <-- this ``` git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67530 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-06Cover all insns in test_jit againk0kubun
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67458 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-06Suppress unnecessary warnings in test_jitk0kubun
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-06Resurrect a test dropped in r67442k0kubun
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67456 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-05add definemethod/definesmethod insn.ko1
* insns.def: add definemethod and definesmethod (singleton method) instructions. Old YARV contains these instructions, but it is moved to methods of FrozenCore class because remove number of instructions can improve performance for some techniques (static stack caching and so on). However, we don't employ these technique and it is hard to optimize/analysis definition sequence. So I decide to introduce them (and remove definition methods). `putiseq` insn is also removed. * vm_method.c (rb_scope_visibility_get): renamed to `vm_scope_visibility_get()` and make it accept `ec`. Same for `vm_scope_module_func_check()`. These fixes are result of refactoring `vm_define_method`. * vm_insnhelper.c (rb_vm_get_cref): renamed to `vm_get_cref` because of consistency with other functions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67442 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-21Show retry's stdout as wellk0kubun
because stderr did not have sufficient information https://ci.appveyor.com/project/ruby/ruby/builds/23242505/job/dirugxujk70nnhp6 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67325 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-21Explain why cl.exe needs --jit-verbose=2 [ci skip]k0kubun
I forgot to explain it in the previous commit git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67323 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-21Insert --jit-verbose=2 logs for mswin debuggingk0kubun
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-10test_jit.rb: change format of test error outputk0kubun
to avoid breaking redmine quote like https://bugs.ruby-lang.org/issues/15522 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-01test_jit.rb: test methodref insnk0kubun
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66679 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-29test_jit.rb: suppress random test failurek0kubun
on mswin RubyCI by Permission Denied. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66634 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-29test_jit.rb: prevent mixing outputs by race conditionk0kubun
to avoid random failures like https://rubyci.org/logs/rubyci.s3.amazonaws.com/unstable11s/ruby-trunk/log/20181229T032506Z.fail.html.gz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66629 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-28test_jit.rb: suppress random failure on RubyCIk0kubun
This failure is a known issue that exists mainly on CI environments. We should address this at some moment, but making CI red by this would be just a false-positive alarm for now. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66606 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-21test_jit.rb: show debug info for success_count testk0kubun
to investigate https://rubyci.org/logs/rubyci.s3.amazonaws.com/unstable11s/ruby-trunk/log/20181221T092505Z.fail.html.gz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66479 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-06Speed up hash literals by dupingtenderlove
This commit replaces the `newhashfromarray` instruction with a `duphash` instruction. Instead of allocating a new hash from an array stored in the Instruction Sequences, store a hash directly in the instruction sequences and dup it on execution. == Instruction sequence changes == ```ruby code = <<-eorby { "foo" => "bar", "baz" => "lol" } eorby insns = RubyVM::InstructionSequence.compile(code, __FILE__, nil, 0, frozen_string_literal: true) puts insns.disasm ``` On Ruby 2.5: ``` == disasm: #<ISeq:<compiled>@test.rb:0 (0,0)-(0,36)>==================== 0000 putobject "foo" 0002 putobject "bar" 0004 putobject "baz" 0006 putobject "lol" 0008 newhash 4 0010 leave ``` Ruby 2.6@r66174 3b6321083a2e3525da3b34d08a0b68bac094bd7f: ``` $ ./ruby test.rb == disasm: #<ISeq:<compiled>@test.rb:0 (0,0)-(0,36)> (catch: FALSE) 0000 newhashfromarray 2, ["foo", "bar", "baz", "lol"] 0003 leave ``` Ruby 2.6 + This commit: ``` $ ./ruby test.rb == disasm: #<ISeq:<compiled>@test.rb:0 (0,0)-(0,36)> (catch: FALSE) 0000 duphash {"foo"=>"bar", "baz"=>"lol"} 0002 leave ``` == Benchmark Results == Compared to 2.5.3: ``` $ make benchmark ITEM=hash_literal_small COMPARE_RUBY=/Users/aaron/.rbenv/versions/2.5.3/bin/ruby generating known_errors.inc known_errors.inc unchanged ./revision.h unchanged /Users/aaron/.rbenv/shims/ruby --disable=gems -rrubygems -I./benchmark/lib ./benchmark/benchmark-driver/exe/benchmark-driver \ --executables="compare-ruby::/Users/aaron/.rbenv/versions/2.5.3/bin/ruby -I.ext/common --disable-gem" \ --executables="built-ruby::./miniruby -I./lib -I. -I.ext/common -r./prelude --disable-gem" \ $(find ./benchmark -maxdepth 1 -name '*hash_literal_small*.yml' -o -name '*hash_literal_small*.rb' | sort) Calculating ------------------------------------- compare-ruby built-ruby hash_literal_small2 1.498 1.877 i/s - 1.000 times in 0.667581s 0.532656s hash_literal_small4 1.197 1.642 i/s - 1.000 times in 0.835375s 0.609160s hash_literal_small8 0.620 1.215 i/s - 1.000 times in 1.611638s 0.823090s Comparison: hash_literal_small2 built-ruby: 1.9 i/s compare-ruby: 1.5 i/s - 1.25x slower hash_literal_small4 built-ruby: 1.6 i/s compare-ruby: 1.2 i/s - 1.37x slower hash_literal_small8 built-ruby: 1.2 i/s compare-ruby: 0.6 i/s - 1.96x slower ``` Compared to r66255 ``` $ make benchmark ITEM=hash_literal_small COMPARE_RUBY=/Users/aaron/.rbenv/versions/ruby-trunk/bin/ruby generating known_errors.inc known_errors.inc unchanged ./revision.h unchanged /Users/aaron/.rbenv/shims/ruby --disable=gems -rrubygems -I./benchmark/lib ./benchmark/benchmark-driver/exe/benchmark-driver \ --executables="compare-ruby::/Users/aaron/.rbenv/versions/ruby-trunk/bin/ruby -I.ext/common --disable-gem" \ --executables="built-ruby::./miniruby -I./lib -I. -I.ext/common -r./prelude --disable-gem" \ $(find ./benchmark -maxdepth 1 -name '*hash_literal_small*.yml' -o -name '*hash_literal_small*.rb' | sort) Calculating ------------------------------------- compare-ruby built-ruby hash_literal_small2 1.567 1.831 i/s - 1.000 times in 0.638056s 0.546039s hash_literal_small4 1.298 1.652 i/s - 1.000 times in 0.770214s 0.605182s hash_literal_small8 0.873 1.216 i/s - 1.000 times in 1.145304s 0.822047s Comparison: hash_literal_small2 built-ruby: 1.8 i/s compare-ruby: 1.6 i/s - 1.17x slower hash_literal_small4 built-ruby: 1.7 i/s compare-ruby: 1.3 i/s - 1.27x slower hash_literal_small8 built-ruby: 1.2 i/s compare-ruby: 0.9 i/s - 1.39x slower ``` git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66258 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-26test_jit.rb: skip a test for Windows for nowk0kubun
https://ci.appveyor.com/project/ruby/ruby/builds/20558412 removing CloseHandle disallows us to remove the DLL. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66002 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-26process.c: finish MJIT prior to #execk0kubun
to prevent ruby from leaving MJIT-related files. test_jit.rb: add a test to prevent that git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65994 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-18test_jit.rb: loosen output checkk0kubun
for interleaving between processes https://gist.github.com/ko1/ace0374825377b41628d4590b7377601 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65788 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-18test_jit.rb: dump information to debug test failurek0kubun
debugging http://ci.rvm.jp/results/trunk-vm-asserts@silicon-docker/1466123 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65787 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-18mjit_worker.c: support MJIT in forked Ruby processk0kubun
by launching MJIT worker thread in child Ruby process. See the comment before `mjit_child_after_fork` for details. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65785 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-18test_jit.rb: fix typo [ci skip]k0kubun
we don't have such VM register git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-12Export rb_flo_div_flo for MJITnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65682 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-07Rename get/setinlinecache to opt_get/opt_setinlinecachemame
The instructions are just for optimization. To clarity the intention, this change adds the prefix "opt_", like "opt_case_dispatch". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65600 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-24_mjit_compile_ivar.erb: cancel on undefined ivark0kubun
I assumed somehow this check was not needed, but it did need. By canceling this instead of just warning here, we didn't lose the current performance so much. test_jit.rb: test the case that reproduces SEGV by that. TestGemStreamUI.rb: delete. This test on --jit-wait is fixed. === Optcarrot Benchmark === $ benchmark-driver benchmark.yml --rbenv 'before::before --disable-gems --jit;after::after --disable-gems --jit' -v --repeat-count 24 before: ruby 2.6.0dev (2018-10-24 trunk 65355) +JIT [x86_64-linux] after: ruby 2.6.0dev (2018-10-24 trunk 65355) +JIT [x86_64-linux] last_commit=_mjit_compile_ivar.erb: cancel on undefined ivar Calculating ------------------------------------- before after Optcarrot Lan_Master.nes 85.344 84.849 fps Comparison: Optcarrot Lan_Master.nes before: 85.3 fps after: 84.8 fps - 1.01x slower git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-24test_jit.rb: test newhashfromarrayk0kubun
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-20require 'rbconifg' earlier.ko1
* test/lib/jit_support.rb: require rbconfig here. * test/ruby/test_jit.rb: rbconfig should be required before. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65219 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-20rename configure option `--disable-mjit` to `--disable-mjit-support`ko1
* configure.ac: rename configure option `--disable-mjit` to `--disable-mjit-support` because `--disable-mjit` is ambiguous that runtime MJIT default enable option or supporting MJIT features. `ENABLE_MJIT` is also renamed to `MJIT_SUPPORT` * Makefile.in: catch up this fix. * common.mk: ditto. * test/ruby/test_jit.rb: ditto. * win32/Makefile.sub: catch up this fix on mswin. * tool/mkconfig.rb: fix to pass `MJIT_SUPPORT` key. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65217 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-20add disabling MJIT features option.ko1
* configure.ac: introduce new configure option `--enable-mjit` and `--disable-mjit`. Default is "enable". `--disable-mjit` disables all of MJIT features so that `ruby --jit` can't enable MJIT. This option affect a macro `USE_MJIT`. This change remove `--enable/disable-install-mjit-header` option. * Makefile.in: introduce the `ENABLE_MJIT` variable. * common.mk: use `ENABLE_MJIT` option. * internal.h: respect `USE_MJIT`. Same as other *.c, *.h. * test/ruby/test_jit.rb: check `ENABLE_MJIT` key of rbconfg.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65204 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-19test/lib/jit_support.rb: continue to skip test_jitk0kubun
for icc since it's not supported yet but running on rubyci. This reverts some part of r65175, r65176 and r65177. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65178 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-19test/lib/jit_support.rb: fire test_jit everywherek0kubun
That was a workaround to make rubyci green for a short term after the MJIT merge. As we've done many portability fixes for MJIT, let's try running test_jit on all rubyci platforms. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-14_mjit_compile_getivar.erb: optimize IC-hit getivark0kubun
by inlining index (and serial to invalidate that) and simplifying the branch by using JIT cancellation. mjit_compile.inc.erb: use the above file mjit_compile.c: copy USE_IC_FOR_IVAR definition. will move this to another shared file later. common.mk: add new dependency test/ruby/test_jit.rb: cover this case === Optcarrot benchmark === ``` $ benchmark-driver benchmark.yml --rbenv '2.0.0::2.0.0-p648;before::before --disable-gems;before+JIT::before --disable-gems --jit;after::after --disable-gems;after+JIT::after --disable-gems --jit' -v --repeat-count 24 2.0.0: ruby 2.0.0p648 (2015-12-16 revision 53162) [x86_64-linux] before: ruby 2.6.0dev (2018-10-14 trunk 65072) [x86_64-linux] before+JIT: ruby 2.6.0dev (2018-10-14 trunk 65072) +JIT [x86_64-linux] after: ruby 2.6.0dev (2018-10-14 trunk 65072) [x86_64-linux] last_commit=_mjit_compile_getivar.erb: optimize IC-hit getivar after+JIT: ruby 2.6.0dev (2018-10-14 trunk 65072) +JIT [x86_64-linux] last_commit=_mjit_compile_getivar.erb: optimize IC-hit getivar Calculating ------------------------------------- 2.0.0 before before+JIT after after+JIT Optcarrot Lan_Master.nes 36.065 53.896 71.565 53.856 84.747 fps Comparison: Optcarrot Lan_Master.nes after+JIT: 84.7 fps before+JIT: 71.6 fps - 1.18x slower before: 53.9 fps - 1.57x slower after: 53.9 fps - 1.57x slower 2.0.0: 36.1 fps - 2.35x slower ``` git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65073 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-08include/ruby/ruby.h: import external symbolsk0kubun
properly on MinGW MJIT. test_jit.rb: all MJIT tests are now passing on MinGW. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64964 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-08test_jit.rb: skip to test tempdir emptinessk0kubun
on AppVeyor mswin. It's somehow failing and not reproductive on my environment. We're suspecting maybe somebody is still holding module handle, even while FreeLibrary is finished successfully. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e