aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* mjit_compile.c: use local variables for stackk0kubun2018-03-0412-50/+214
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | if catch_except_p is FALSE. If catch_except_p is TRUE, stack values should be on VM's stack when exception is thrown and the JIT-ed frame is re-executed by VM's exception handler. If it's FALSE, the JIT-ed frame won't be re-executed and don't need to keep values on VM's stack. Using local variables allows us to reduce cfp->sp motion. Moving cfp->sp is needed only for insns whose handles_frame? is false. So it improves performance. _mjit_compile_insn.erb: Prepare `stack_size` variable for GET_SP, STACK_ADDR_FROM_TOP, TOPN macros. Share pc and sp motion partial view. Use cancel handler created in mjit_compile.c. _mjit_compile_send.erb: ditto. Also, when iseq->body->catch_except_p is TRUE, this stops to call mjit_exec directly. I described the reason in vm_insnhelper.h's comment for EXEC_EC_CFP. _mjit_compile_pc_and_sp.erb: Shared logic for moving sp and pc. As you can see from thsi file, when status->local_stack_p is TRUE and insn.handles_frame? is false, moving sp is skipped. But if insn.handles_frame? is true, values should be rolled back to VM's stack. common.mk: add dependency for the file _mjit_compile_insn_body.erb: Set sp value before canceling JIT on DISPATCH_ORIGINAL_INSN. Replace GET_SP, STACK_ADDR_FROM_TOP, TOPN macros for the case ocal_stack_p is TRUE and insn.handles_frame? is false. In that case, values are not available on VM's stack and those macros should be replaced. mjit_compile.inc.erb: updated comments of macros which are supported by JIT compiler. All references to `cfp->sp` should be replaced and thus INC_SP, SET_SV, PUSH are no longer supported for now, because they are not used now. vm_exec.h: moved EXEC_EC_CFP definition to vm_insnhelper.h because it's tighly coupled to CALL_METHOD. vm_insnhelper.h: Have revised EXEC_EC_CFP definition moved from vm_exec.h. Now it triggers mjit_exec for VM, and has the guard for catch_except_p on JIT-ed code. See comments for details. CALL_METHOD delegates triggering mjit_exec to EXEC_EC_CFP. insns.def: Stopped using EXEC_EC_CFP for the case we don't want to trigger mjit_exec. Those insns (defineclass, opt_call_c_function) are not supported by JIT and it's safe to use RESTORE_REGS(), NEXT_INSN(). expandarray is changed to pass GET_SP() to replace the macro in _mjit_compile_insn_body.erb. vm_insnhelper.c: change to take sp for the above reason. [close https://github.com/ruby/ruby/pull/1828] This patch resurrects the performance which was attached in [Feature #14235]. * Benchmark Optcarrot (with configuration for benchmark_driver.gem) https://github.com/benchmark-driver/optcarrot $ benchmark-driver benchmark.yml --verbose 1 --rbenv 'before;before+JIT::before,--jit;after;after+JIT::after,--jit' --repeat-count 10 before: ruby 2.6.0dev (2018-03-04 trunk 62652) [x86_64-linux] before+JIT: ruby 2.6.0dev (2018-03-04 trunk 62652) +JIT [x86_64-linux] after: ruby 2.6.0dev (2018-03-04 local-variable.. 62652) [x86_64-linux] last_commit=mjit_compile.c: use local variables for stack after+JIT: ruby 2.6.0dev (2018-03-04 local-variable.. 62652) +JIT [x86_64-linux] last_commit=mjit_compile.c: use local variables for stack Calculating ------------------------------------- before before+JIT after after+JIT optcarrot 53.552 59.680 53.697 63.358 fps Comparison: optcarrot after+JIT: 63.4 fps before+JIT: 59.7 fps - 1.06x slower after: 53.7 fps - 1.18x slower before: 53.6 fps - 1.18x slower git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62655 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c: set catch_except_p flagk0kubun2018-03-043-0/+51
| | | | | | | | | | | to be used for MJIT's optimization. It's not used for optimization in this commit yet. vm_core.h: added catch_except_p field. iseq.c: show the flag in ISeq disasm for debugging. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm.c: trivial optimizationnobu2018-03-041-4/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm.c: handle_exception loopnobu2018-03-041-32/+37
| | | | | | | * vm.c (vm_exec): hoist out handle_exception and loop to rewind for each catching frames. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm.c: untangle goto loopnobu2018-03-041-9/+10
| | | | | | | * vm.c (vm_exec): moved code to get rid of cross-jumps across branches. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * 2018-03-04svn2018-03-041-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62649 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_exec.c: reduced repeated same callsnobu2018-03-041-3/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit_config.h: MJIT_LDSHAREDnobu2018-03-033-2/+9
| | | | | | | | | | * configure.in (MJIT_LDSHARED): define based on LDSHARED with replacing CC with MJIT_CC. * Makefile.in, win32/Makefile.sub (mjit_config.h): instead of the default LDSHARED, use MJIT_LDSHARED to link mjit shared objects. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62644 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* insns.def: unwrap vm_exec for yieldk0kubun2018-03-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Outer vm_exec can catch longjmp. We don't need to call vm_exec first here. This optimizes JIT-ed yield: * Benchmark script ``` require 'benchmark_driver' Benchmark.driver do |x| x.prelude %{ def yielder yield + 1 end } x.report 'yielder', %{ yielder { 1 } } x.loop_count 300_000_000 x.rbenv 'before', 'before,--jit', 'after', 'after,--jit' x.verbose end ``` * Result before: ruby 2.6.0dev (2018-03-03 trunk 62642) [x86_64-linux] before,--jit: ruby 2.6.0dev (2018-03-03 trunk 62642) +JIT [x86_64-linux] after: ruby 2.6.0dev (2018-03-03 trunk 62642) [x86_64-linux] last_commit=insns.def: unwrap vm_exec for yield after,--jit: ruby 2.6.0dev (2018-03-03 trunk 62642) +JIT [x86_64-linux] last_commit=insns.def: unwrap vm_exec for yield Calculating ------------------------------------- before before,--jit after after,--jit yielder 37.214M 29.222M 35.904M 38.035M i/s - 300.000M times in 8.061581s 10.266312s 8.355716s 7.887447s Comparison: yielder after,--jit: 38035121.0 i/s before: 37213544.0 i/s - 1.02x slower after: 35903565.7 i/s - 1.06x slower before,--jit: 29221787.6 i/s - 1.30x slower git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62643 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * 2018-03-03svn2018-03-031-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62642 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm.c: add mjit_enable_p flagk0kubun2018-03-037-20/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to count up total calls properly. Some places (especially CALL_METHOD) invoke mjit_exec twice for one method call. It would be problematic when debugging, or possibly it would result in a wrong profiling result. This commit doesn't have impact for performance: * Optcarrot benchmark ** before fps: 59.37757770848619 fps: 56.49998488958699 fps: 59.07900362739362 fps: 58.924749807695996 fps: 57.667905665594894 fps: 57.540021018385254 fps: 59.5518055679647 fps: 55.93831555148311 fps: 57.82685112863262 fps: 59.22391754481736 checksum: 59662 ** after fps: 58.461881158098194 fps: 59.32685183081354 fps: 54.11334310279802 fps: 59.2281560439788 fps: 58.60495705318312 fps: 55.696478648491045 fps: 58.49003452654724 fps: 58.387771929393224 fps: 59.24156772816439 fps: 56.68804731968107 checksum: 59662 * Discourse Your Results: (note for timings- percentile is first, duration is second in millisecs) ** before (without JIT) categories_admin: 50: 16 75: 17 90: 24 99: 37 home_admin: 50: 20 75: 20 90: 24 99: 42 topic_admin: 50: 16 75: 16 90: 18 99: 28 categories: 50: 36 75: 37 90: 45 99: 68 home: 50: 38 75: 40 90: 53 99: 92 topic: 50: 14 75: 15 90: 17 99: 26 ** after (without JIT) categories_admin: 50: 16 75: 16 90: 24 99: 36 home_admin: 50: 19 75: 20 90: 23 99: 41 topic_admin: 50: 16 75: 16 90: 19 99: 33 categories: 50: 35 75: 36 90: 44 99: 61 home: 50: 38 75: 40 90: 52 99: 101 topic: 50: 14 75: 15 90: 15 99: 24 ** before (with JIT) categories_admin: 50: 19 75: 23 90: 29 99: 44 home_admin: 50: 24 75: 26 90: 32 99: 46 topic_admin: 50: 20 75: 22 90: 27 99: 44 categories: 50: 41 75: 43 90: 51 99: 66 home: 50: 46 75: 49 90: 56 99: 68 topic: 50: 18 75: 19 90: 22 99: 31 ** after (with JIT) categories_admin: 50: 18 75: 21 90: 28 99: 42 home_admin: 50: 23 75: 25 90: 31 99: 51 topic_admin: 50: 19 75: 20 90: 24 99: 31 categories: 50: 41 75: 44 90: 52 99: 69 home: 50: 45 75: 48 90: 61 99: 88 topic: 50: 19 75: 20 90: 24 99: 33 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* openssl: search winsocknobu2018-03-021-1/+3
| | | | | | | | * ext/openssl/extconf.rb: on Windows search winsock library always, regardless pkg-config. direct use of winsock is not region of OpenSSL. [ruby-core:85895] [Bug #14568] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62637 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Clarify the documentation of the YAML module [Misc #14567]eregon2018-03-021-3/+4
| | | | | | Based on a patch from Victor Shepelev git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io/console: drop 2.1.0 support [ci skip]nobu2018-03-023-9/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62633 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io/console: drop 2.0.0 support [ci skip]nobu2018-03-023-5/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62631 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Makefile.sub: need suffixnobu2018-03-021-1/+1
| | | | | | | * win32/Makefile.sub: fix missing suffix of user32.lib. [Bug #14422] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62630 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Makefile.sub: link user32.libnobu2018-03-021-1/+1
| | | | | | | * win32/Makefile.sub: always link user32.lib which provides a lot of very common library functions. [Bug #14422] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62629 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* search winsock libraries explicitlynobu2018-03-022-0/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62628 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* configure.ac: library options to MAINLIBSnobu2018-03-023-20/+20
| | | | | | | | | * configure.ac (MAINLIBS): moved library options for main program and static libruby, and append MAINLIBS to LIBRUBYARG_STATIC, as these libraries are not needed for linking to shared libruby. [ruby-core:85882] [Bug #14422] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Makefile.in (ruby.pc): phony target [ci skip]nobu2018-03-021-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62626 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* configure.ac: fix up r59130nobu2018-03-021-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62625 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * 2018-03-02svn2018-03-011-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62624 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* MJIT specific flagsnobu2018-03-013-6/+21
| | | | | | | | | Passing options to configure like as `configure MJIT_OPTFLAGS=-O MJIT_DEBUGFLAGS=-g` overrides options to be used to compile JIT code, separately from the default options to be used for ruby itself. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62623 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c: raise on invalid inputnobu2018-03-011-2/+2
| | | | | | | | * compile.c (ibf_load_object_unsupported, ibf_load_object_class): should raise an exception. rejection of invalid input is not a bug. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c: do not truncate VALUE to longnobu2018-03-011-2/+2
| | | | | | | | * compile.c (ibf_dump_object_regexp): do not truncate VALUE to long. it makes invalid VALUE on IL32LLP64 platforms where long is shorter than VALUE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62621 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: refine assign_in_cond warningnobu2018-03-012-2/+2
| | | | | | | | * parse.y (assign_in_cond): refine a warning message for assignment of a literal in conditinal expression. [ruby-core:85872] [Bug #14562] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* tool/bisect.sh: extracted build part [ci skip]nobu2018-03-011-12/+17
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62619 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* bisect.sh: make srcs in builddir [ci skip]nobu2018-03-011-2/+2
| | | | | | | * tool/bisect.sh: also srcs needs Makefile, must in the build but not the source directory. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62618 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c: fix load_from_binarynobu2018-03-012-6/+6
| | | | | | | * compile.c (ibf_load_iseq_each): realpath may be nil. follow up r59709. [fix https://github.com/Shopify/bootsnap/issues/132] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62617 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * 2018-03-01svn2018-02-281-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62616 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Revert r61936 "compile.c: use ALLOCV_N"nobu2018-02-282-5/+12
| | | | | | | | * compile.c (ibf_dump_object_list): `dump->obj_list` is not fixed yet, as new objects are pushed by lbf_dump_object_object. fixes crash by buffer overflow. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62615 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* NEWS: resurrect ticket number [ci skip]k0kubun2018-02-281-1/+1
| | | | | | which was unintentionally dropped at r62612. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62614 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* common.mk: clean timestamp and intermediate headernobu2018-02-281-0/+1
| | | | | | [ci-skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62613 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* erb.rb: relax warn level of ERB.newk0kubun2018-02-282-5/+7
| | | | | | | | | | | I changed my mind and thought branching ERB.new in all libraries is too hard. Code becomes too ugly. I increased the warn level to 2, and the old initializer will be removed when Ruby 2.5 becomes EOL. -S option of erb(1) stays in the same policy: will be removed at Ruby 2.7. NEWS: note about the direction git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Prefer to use %x instead of backtick.hsbt2018-02-281-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62611 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* skip a test if another Thread is running.ko12018-02-281-0/+2
| | | | | | | | | * test/ruby/test_time.rb (test_strftime_no_hidden_garbage): this test checks no object allocation while specific process, however another thread can generate objects. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62608 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* file.c: realpath on special symlinknobu2018-02-282-5/+19
| | | | | | | | * file.c (realpath_rec): fallback to symlink path when it is accessible but the link target is not actual entry on file systems. [ruby-dev:50487] [Bug #14557] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62607 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* file.c: get rid of useless conversionnobu2018-02-281-12/+35
| | | | | | | | * file.c (rb_file_s_stat): File.stat does not accept an IO object as trying conversion to path name string first. skip conversion to IO and try stat(2) only. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62606 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Update to ruby/spec@51f301deregon2018-02-272-6/+10
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62605 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Remove tool/pull-latest-mspec-speceregon2018-02-271-18/+0
| | | | | | * It is now part of mspec in spec/mspec/tool/pull-latest-mspec-spec git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62604 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * properties.svn2018-02-270-0/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Update to ruby/spec@cbe855ceregon2018-02-2738-177/+185
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62602 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * properties.svn2018-02-270-0/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62601 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Update to ruby/mspec@d287466eregon2018-02-273-13/+20
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62600 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * 2018-02-28svn2018-02-271-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62599 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Support two `to_r`-responding args in Rational()mrkn2018-02-272-0/+31
| | | | | | | | | * rational.c (nurat_s_convert): call `to_r` to convert non-Numeric objects also if argc == 2 in Rational(). * test/ruby/test_rational.rb: add tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* common.mk: added missing dependencies on id.hnobu2018-02-271-0/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62597 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* [EXPERIMENTAL] Support upload option for s3 package hosting.hsbt2018-02-271-0/+8
| | | | | | | Example: $ ruby tool/make-snapshot -archname=snapshot -s3=tmp /tmp trunk git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* random.c: Random.extend Formatternobu2018-02-271-0/+1
| | | | | | | | * random.c (InitVM_Random): extend Random itself by Formatter module, as well as the `bytes` method used by the module. [Feature #4938] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Refactor ERB version checking for keyword argumentsk0kubun2018-02-276-9/+7
| | | | | | Improving code like r62590. See r62529 for details. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e