aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* Add direct marking on iseq operandstenderlove2018-03-097-72/+171
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Directly marking iseq operands allows us to eliminate the "mark array" stored on ISEQ objects, which will reduce the amount of memory ISEQ objects consume. This patch changes the iseq mark function to: * Directly marks ISEQ operands * Iterate over and mark child ISEQs It also introduces two flags on the ISEQ object. In order to mark instruction operands, we have to disassemble the instructions and find the instruction parameters and types. Instructions may also be translated to jump addresses. Instruction sequences may get marked by the GC *while* they're mid flight (being compiled). The `ISEQ_TRANSLATED` flag is used to indicate whether or not the instructions have been translated to jump addresses so that when we decode the instructions we know whether or not we need to go from jump location back to original instruction or not. Not all ISEQ objects have any markable objects embedded in their instructions. We can detect whether or not an ISEQ has markable objects in the instructions at compile time. If the instructions contain markable objects, we set a flag `ISEQ_MARKABLE_ISEQ` on the ISEQ object. This means that during the mark phase, we can skip decompilation if the flag is *not* set. In other words, we can avoid decompilation of we know in advance there is nothing to mark. `once` instructions have an operand that contains the result of a one-time compilation of a regex. Before this patch, that operand was called an "inline cache", even though the struct was actually an "inline storage". This patch changes the operand to be an "inline storage" so that we can differentiate between caches that need marking (the inline storage) and caches that don't need marking (inline cache). [ruby-core:84909] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62706 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* configure.ac: --disable-mathn optionnobu2018-03-093-3/+14
| | | | | | | | | | * Makefile.in, win32/Makefile.sub: move CANONICALIZATION_FOR_MATHN from config.h which affects all extension libraries to XCFLAGS for the core only. * configure.ac: added --disable-mathn option. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62705 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* math.c: calling ordernobu2018-03-091-7/+7
| | | | | | | * math.c (math_log, rb_math_log): inverted calling order, to remove unused argument. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62704 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Removed useless assertions [ci skip]nobu2018-03-093-6/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rational.c: removed redundant conditionsnobu2018-03-091-23/+10
| | | | | | Fixnums can be compared by object values themselves only. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62702 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* complex.c: removed redundant conditionsnobu2018-03-091-27/+9
| | | | | | | | Fixnums can be compared by object values themselves only. Addition/subtraction/mulplication of fixnum 0 do not affect the sign. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* complex.c: removed already unused macrosnobu2018-03-091-14/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * 2018-03-09svn2018-03-081-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62699 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Raise ArgumentError if host component is nilnaruse2018-03-082-0/+14
| | | | | | | From: oss92 <mohamed.o.alnagdy@gmail.com> fix https://github.com/ruby/ruby/pull/1278 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62698 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix a typo [ci skip]kazu2018-03-081-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62697 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * 2018-03-08svn2018-03-081-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62696 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix error if the input is mixed Unicode and percent-escapesnaruse2018-03-082-3/+10
| | | | | | | | Reported by kivikakk (Ashe Connor) with tests and doc fix Patch based on mame and fix by naruse [Bug #14586] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62695 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* transform_mjit_header.rb: inline ivar operationsk0kubun2018-03-071-0/+3
| | | | | | | | | | | | | | | | | | * Optcarrot before,--jit: ruby 2.6.0dev (2018-03-07 trunk 62689) +JIT [x86_64-linux] after,--jit: ruby 2.6.0dev (2018-03-07 trunk 62689) +JIT [x86_64-linux] last_commit=transform_mjit_header.rb: inline ivar operations Calculating ------------------------------------- before,--jit after,--jit optcarrot 67.852 69.359 fps Comparison: optcarrot after,--jit: 69.4 fps before,--jit: 67.9 fps - 1.02x slower git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62693 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* complex.c: check typenobu2018-03-072-2/+16
| | | | | | | * complex.c (m_cos, m_sin): determine the type by the internal type, not by a method. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62689 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* complex.c: check typenobu2018-03-072-3/+19
| | | | | | | * complex.c (nucomp_s_canonicalize_internal): determine the type by the internal type, not by a method. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62688 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* complex.c, rational.c: no backrefnobu2018-03-072-12/+2
| | | | | | Since r37702, parsing complex and rational do not use regexp. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* complex.c, rational.c: adjust indentnobu2018-03-072-4/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62686 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* date_core.c: check conversionnobu2018-03-072-19/+36
| | | | | | | * ext/date/date_core.c (offset_to_sec, d_lite_plus): check conversion results, to get rid of infinite recursion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62685 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_date_arith.rb: needs `test_` prefixnobu2018-03-071-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* object.c: conversions with IDnobu2018-03-071-7/+11
| | | | | | | * object.c (rb_to_integer, rb_check_to_int): convert to Integer with method ID. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62683 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* complex.c, rational.c: simplified macro conditionsnobu2018-03-072-15/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62682 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * 2018-03-07svn2018-03-061-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62681 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_insnhelper.c: blockparamproxy in rescuenobu2018-03-062-1/+13
| | | | | | | | * vm_insnhelper.c (vm_call_opt_block_call): get block handler from the method local frame. fix segfault at calling the proxy in rescue. http://twitter.com/wannabe53/status/970955247626567680 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_signal.rb: fix arguments ordernobu2018-03-061-4/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62679 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* _mjit_compile_pc_and_sp.erb: skip moving pck0kubun2018-03-064-3/+15
| | | | | | | | | | | | | | | | on !body->catch_except_p. We need to move pc only when JIT execution is canceled if the frame does not catch an exception. _mjit_compile_insn.erb: lazily move pc for such optimized case _mjit_compile_insn_body.erb: ditto _mjit_compile_send.erb: ditto * Optcarrot benchmark (--jit) Before: 65.31 fps After: 67.82 fps git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62678 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* transform_mjit_header.rb: inline VM instructionsk0kubun2018-03-061-2/+33
| | | | | | | | | * Optcarrot benchmark (--jit) Before: 62.42 fps After: 65.31 fps git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* transform_mjit_header.rb: drop obsoleted debug codek0kubun2018-03-061-8/+0
| | | | | | Now RubyCI is stable for this part. We no longer use this. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: tSPACE for old bisonnobu2018-03-061-1/+2
| | | | | | | | * parse.y (tSPACE): define a separate token for escaped space, to fix `redefining user token number of ' '` error at word list separator on bison 2. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62675 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* use the reference as failure messagesnobu2018-03-061-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* thread.c: deadlock in backtracenobu2018-03-062-1/+23
| | | | | | | | * thread.c (unblock_function_set): check interrupts just once during raising exceptions, as they are deferred since r16651. [ruby-core:85939] [Bug #14577] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62673 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* resolv.rb: remove rangerandnobu2018-03-061-12/+2
| | | | | | | * lib/resolv.rb (Resolv::DNS.rangerand): rand and random_number accept a Range. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* resolv.rb: close socketnobu2018-03-062-33/+88
| | | | | | | | | | | | | | | | | | | * lib/resolv.rb (UnconnectedUDP#lazy_initialize): store new sockets before binding, so the sockets get closed when the requester is closing. * lib/resolv.rb (ConnectedUDP#lazy_initialize): ditto. * lib/resolv.rb (UnconnectedUDP#close): synchronize to get rid of race condition. * lib/resolv.rb (ConnectedUDP#close): ditto. [ruby-core:85901] [Bug #14571] From: quixoten (Devin Christensen) <quixoten@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Removed redundant private declaration.hsbt2018-03-061-1/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62670 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * 2018-03-06svn2018-03-051-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62669 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* thread.c: reset waitq of keeping mutexes in childnormal2018-03-053-0/+26
| | | | | | | | | | | | | | We must not maintain references to threads in the parent process in any mutexes held by the child process. * thread_sync.c (rb_mutex_cleanup_keeping_mutexes): new function * thread.c (rb_thread_atfork): cleanup keeping mutexes [ruby-core:85940] [Bug #14578] Fixes: r58604 (commit 3586c9e0876e784767a1c1adba9ebc2499fa0ec2) ("reduce rb_mutex_t size from 160 to 80 bytes on 64-bit") git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62668 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix a typo [ci skip]kazu2018-03-051-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62664 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: named whitespacesnobu2018-03-052-0/+28
| | | | | | | * parse.y: named escaped whitespaces to show unexpected character. bare whitespaces should not appear outside of word_list. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62663 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* README.md: removed unnecessary schemesnobu2018-03-051-2/+2
| | | | | | | | | `mailto:` scheme on text looking like email-address is unnecessary in Markdown. [Fix GH-1827] Co-Authored-By: YoeriH <yoeri90@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Tiny Fix for ASYNC BUG error message copyingnobu2018-03-051-1/+1
| | | | | | | | | | | | | | The previous logic would overwrite the error message, replacing the message with the `fd` number. This tiny update will print the message in full. (I'm trying to debug an issue with the timer thread on my machine and the lack of error messages makes it really hard). [Fix GH-1829] From: Bo <bo@bowild.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62661 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* required paths are real pathsnobu2018-03-053-6/+6
| | | | | | | Fix `test-spec` failures when the build directory is a symbolic link. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62660 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Makefile.sub: reconfignobu2018-03-051-1/+2
| | | | | | | * win32/Makefile.sub (reconfig): phony target to force reconfigure with previous options. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* add prefix to the function name.ko12018-03-051-10/+11
| | | | | | | * vm.c (handle_exception): rename to vm_exce_handle_exception. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * 2018-03-05svn2018-03-041-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62657 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Update to ruby/spec@c1b568beregon2018-03-043689-6096/+6095
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* 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