aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby
Commit message (Collapse)AuthorAgeFilesLines
* test_jit.rb: cover most insn compilationsk0kubun2018-02-101-3/+344
| | | | | | | | test_compile_insns has only basic tests to improve coverage. Other severer tests should be added with different names. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62348 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c: popped hashnobu2018-02-091-0/+5
| | | | | | | * compile.c (compile_array): skip creating new hash if preceeding elements are popped all. [ruby-core:85486] [Bug #14459] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* .travis.yml: force to execute JIT test on Travisk0kubun2018-02-091-0/+6
| | | | | | | | | | test_jit.rb: with environment variable RUBY_FORCE_TEST_JIT, we can force to test JIT availability. I wanted to have such CI, but Travis was the only option which I can modify easily. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_jit.rb: don't force to test --jit-waitk0kubun2018-02-081-2/+2
| | | | | | | | | | for platforms which can't use JIT. Such platforms can time out with eval_with_jit. http://ci.rvm.jp/results/trunk_gcc5@silicon-docker/509911 http://ci.rvm.jp/results/trunk_gcc4@silicon-docker/509904 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62314 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_jit.rb: fix typok0kubun2018-02-081-1/+1
| | | | | | This is notified by zns-san. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62312 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_jit.rb: add forgotten checkk0kubun2018-02-081-1/+2
| | | | | | I was going to check this in r62310... git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62311 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_jit.rb: check JIT support more conservativelyk0kubun2018-02-081-5/+9
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62310 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_jit.rb: remove unnecessary requirek0kubun2018-02-081-1/+0
| | | | | | | | | At first I was going to check the name of `RbConfig::CONFIG['CC']` and use shellwords for it, but I decided not to do so. Thus removing obsoleted require in r62307. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_jit.rb: try to test JIT againk0kubun2018-02-081-0/+68
| | | | | | | This commit reverts r62297, revising the check if JIT is supported or not. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* revert r62291 for nowk0kubun2018-02-081-60/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While some of CIs are succeeding and the test succeeds on my laptop, some other CIs are failing. As I don't have time to fix it until I come back to home, reverting this for now. Failures: https://rubyci.org/logs/www.rubyist.net/~akr/chkbuild/debian/ruby-trunk/log/20180208T000401Z.fail.html.gz https://rubyci.org/logs/rubyci.s3.amazonaws.com/scw-9d6766/ruby-trunk/log/20180207T201706Z.fail.html.gz https://rubyci.org/logs/rubyci.s3.amazonaws.com/ubuntu1604/ruby-trunk/log/20180207T183004Z.fail.html.gz https://rubyci.org/logs/rubyci.s3.amazonaws.com/gentoo/ruby-trunk/log/20180207T213004Z.fail.html.gz https://rubyci.org/logs/rubyci.s3.amazonaws.com/centos6/ruby-trunk/log/20180207T213003Z.fail.html.gz https://rubyci.org/logs/rubyci.s3.amazonaws.com/fedora25/ruby-trunk/log/20180207T213003Z.fail.html.gz https://rubyci.org/logs/rubyci.s3.amazonaws.com/fedora26/ruby-trunk/log/20180207T213003Z.fail.html.gz https://rubyci.org/logs/rubyci.s3.amazonaws.com/opensuseleap/ruby-trunk/log/20180207T213001Z.fail.html.gz https://rubyci.org/logs/rubyci.s3.amazonaws.com/rhel_zlinux/ruby-trunk/log/20180207T223303Z.fail.html.gz https://rubyci.org/logs/rubyci.s3.amazonaws.com/osx1011/ruby-trunk/log/20180207T234501Z.fail.html.gz https://rubyci.org/logs/rubyci.s3.amazonaws.com/osx1012/ruby-trunk/log/20180207T234501Z.fail.html.gz https://rubyci.org/logs/rubyci.s3.amazonaws.com/icc-x64/ruby-trunk/log/20180207T210002Z.fail.html.gz https://rubyci.org/logs/rubyci.s3.amazonaws.com/unstable10x/ruby-trunk/log/20180207T231805Z.fail.html.gz https://rubyci.org/logs/rubyci.s3.amazonaws.com/unstable11x/ruby-trunk/log/20180207T232403Z.fail.html.gz https://rubyci.org/logs/rubyci.s3.amazonaws.com/unstable10s/ruby-trunk/log/20180207T171914Z.fail.html.gz https://rubyci.org/logs/rubyci.s3.amazonaws.com/unstable11s/ruby-trunk/log/20180207T232503Z.fail.html.gz https://rubyci.org/logs/mswinci.japaneast.cloudapp.azure.com/vc12-x64/ruby-trunk/log/20180207T172813Z.fail.html.gz http://ci.rvm.jp/results/trunk_gcc5@silicon-docker/506100 http://ci.rvm.jp/results/trunk_gcc4@silicon-docker/506114 http://ci.rvm.jp/results/trunk_clang_40@silicon-docker/506119 http://ci.rvm.jp/results/trunk_clang_39@silicon-docker/506170 http://ci.rvm.jp/results/trunk-nopara@silicon-docker/506176 http://ci.rvm.jp/results/trunk_gcc5@silicon-docker/506192 http://ci.rvm.jp/results/trunk_gcc4@silicon-docker/506202 http://ci.rvm.jp/results/trunk_clang_39@silicon-docker/506244 http://ci.rvm.jp/results/trunk_gcc5@silicon-docker/506271 http://ci.rvm.jp/results/trunk_gcc4@silicon-docker/506280 http://ci.rvm.jp/results/trunk-nopara@silicon-docker/506323 http://ci.rvm.jp/results/trunk_clang_50@silicon-docker/506325 http://ci.rvm.jp/results/trunk_gcc5@silicon-docker/506342 http://ci.rvm.jp/results/trunk_gcc4@silicon-docker/506354 http://ci.rvm.jp/results/trunk_clang_39@silicon-docker/506385 http://ci.rvm.jp/results/trunk_clang_40@silicon-docker/506389 http://ci.rvm.jp/results/trunk_gcc5@silicon-docker/506409 http://ci.rvm.jp/results/trunk_gcc4@silicon-docker/506425 http://ci.rvm.jp/results/trunk_clang_40@silicon-docker/506471 http://ci.rvm.jp/results/trunk_gcc5@silicon-docker/506484 http://ci.rvm.jp/results/trunk_gcc4@silicon-docker/506495 http://ci.rvm.jp/results/trunk-test@x2/506524 http://ci.rvm.jp/results/trunk-vm-asserts@silicon-docker/506547 http://ci.rvm.jp/results/trunk_gcc5@silicon-docker/506556 http://ci.rvm.jp/results/trunk_gcc4@silicon-docker/506579 http://ci.rvm.jp/results/trunk-nopara@silicon-docker/506582 http://ci.rvm.jp/results/trunk_clang_50@silicon-docker/506634 http://ci.rvm.jp/results/trunk_gcc5@silicon-docker/506638 http://ci.rvm.jp/results/trunk_gcc4@silicon-docker/506663 http://ci.rvm.jp/results/trunk-test@frontier/506690 http://ci.rvm.jp/results/trunk_clang_40@silicon-docker/506718 http://ci.rvm.jp/results/trunk_gcc5@silicon-docker/506728 http://ci.rvm.jp/results/trunk-nopara@silicon-docker/506752 http://ci.rvm.jp/results/trunk_gcc4@silicon-docker/506754 http://ci.rvm.jp/results/trunk-gc-asserts@silicon-docker/506782 http://ci.rvm.jp/results/trunk_clang_38@silicon-docker/506799 http://ci.rvm.jp/results/trunk_gcc5@silicon-docker/506816 http://ci.rvm.jp/results/trunk_gcc4@silicon-docker/506835 http://ci.rvm.jp/results/trunk-nopara@silicon-docker/506879 http://ci.rvm.jp/results/trunk_gcc5@silicon-docker/506903 http://ci.rvm.jp/results/trunk_gcc4@silicon-docker/506920 http://ci.rvm.jp/results/trunk-test@frontier/506955 http://ci.rvm.jp/results/trunk_gcc5@silicon-docker/506994 http://ci.rvm.jp/results/trunk_gcc4@silicon-docker/507012 http://ci.rvm.jp/results/trunk-vm-asserts@silicon-docker/507036 http://ci.rvm.jp/results/trunk_clang_40@silicon-docker/507037 http://ci.rvm.jp/results/trunk-nopara@silicon-docker/507053 http://ci.rvm.jp/results/trunk_gcc5@silicon-docker/507081 http://ci.rvm.jp/results/trunk_gcc4@silicon-docker/507097 http://ci.rvm.jp/results/trunk_clang_40@silicon-docker/507136 http://ci.rvm.jp/results/trunk_gcc5@silicon-docker/507165 http://ci.rvm.jp/results/trunk_gcc4@silicon-docker/507178 http://ci.rvm.jp/results/trunk-nopara@silicon-docker/507180 http://ci.rvm.jp/results/trunk_gcc5@silicon-docker/507257 http://ci.rvm.jp/results/trunk_gcc4@silicon-docker/507268 http://ci.rvm.jp/results/trunk-gc-asserts@silicon-docker/507303 http://ci.rvm.jp/results/trunk_gcc5@silicon-docker/507342 http://ci.rvm.jp/results/trunk_gcc4@silicon-docker/507355 http://ci.rvm.jp/results/trunk_gcc5@silicon-docker/507434 http://ci.rvm.jp/results/trunk_gcc4@silicon-docker/507448 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62297 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_jit.rb: make JIT count test optionalk0kubun2018-02-071-6/+8
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62294 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_jit.rb: add initial test for JITk0kubun2018-02-071-0/+58
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62291 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit_compile.c: merge initial JIT compilerk0kubun2018-02-043-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | which has been developed by Takashi Kokubun <takashikkbn@gmail> as YARV-MJIT. Many of its bugs are fixed by wanabe <s.wanabe@gmail.com>. This JIT compiler is designed to be a safe migration path to introduce JIT compiler to MRI. So this commit does not include any bytecode changes or dynamic instruction modifications, which are done in original MJIT. This commit even strips off some aggressive optimizations from YARV-MJIT, and thus it's slower than YARV-MJIT too. But it's still fairly faster than Ruby 2.5 in some benchmarks (attached below). Note that this JIT compiler passes `make test`, `make test-all`, `make test-spec` without JIT, and even with JIT. Not only it's perfectly safe with JIT disabled because it does not replace VM instructions unlike MJIT, but also with JIT enabled it stably runs Ruby applications including Rails applications. I'm expecting this version as just "initial" JIT compiler. I have many optimization ideas which are skipped for initial merging, and you may easily replace this JIT compiler with a faster one by just replacing mjit_compile.c. `mjit_compile` interface is designed for the purpose. common.mk: update dependencies for mjit_compile.c. internal.h: declare `rb_vm_insn_addr2insn` for MJIT. vm.c: exclude some definitions if `-DMJIT_HEADER` is provided to compiler. This avoids to include some functions which take a long time to compile, e.g. vm_exec_core. Some of the purpose is achieved in transform_mjit_header.rb (see `IGNORED_FUNCTIONS`) but others are manually resolved for now. Load mjit_helper.h for MJIT header. mjit_helper.h: New. This is a file used only by JIT-ed code. I'll refactor `mjit_call_cfunc` later. vm_eval.c: add some #ifdef switches to skip compiling some functions like Init_vm_eval. win32/mkexports.rb: export thread/ec functions, which are used by MJIT. include/ruby/defines.h: add MJIT_FUNC_EXPORTED macro alis to clarify that a function is exported only for MJIT. array.c: export a function used by MJIT. bignum.c: ditto. class.c: ditto. compile.c: ditto. error.c: ditto. gc.c: ditto. hash.c: ditto. iseq.c: ditto. numeric.c: ditto. object.c: ditto. proc.c: ditto. re.c: ditto. st.c: ditto. string.c: ditto. thread.c: ditto. variable.c: ditto. vm_backtrace.c: ditto. vm_insnhelper.c: ditto. vm_method.c: ditto. I would like to improve maintainability of function exports, but I believe this way is acceptable as initial merging if we clarify the new exports are for MJIT (so that we can use them as TODO list to fix) and add unit tests to detect unresolved symbols. I'll add unit tests of JIT compilations in succeeding commits. Author: Takashi Kokubun <takashikkbn@gmail.com> Contributor: wanabe <s.wanabe@gmail.com> Part of [Feature #14235] --- * Known issues * Code generated by gcc is faster than clang. The benchmark may be worse in macOS. Following benchmark result is provided by gcc w/ Linux. * Performance is decreased when Google Chrome is running * JIT can work on MinGW, but it doesn't improve performance at least in short running benchmark. * Currently it doesn't perform well with Rails. We'll try to fix this before release. --- * Benchmark reslts Benchmarked with: Intel 4.0GHz i7-4790K with 16GB memory under x86-64 Ubuntu 8 Cores - 2.0.0-p0: Ruby 2.0.0-p0 - r62186: Ruby trunk (early 2.6.0), before MJIT changes - JIT off: On this commit, but without `--jit` option - JIT on: On this commit, and with `--jit` option ** Optcarrot fps Benchmark: https://github.com/mame/optcarrot | |2.0.0-p0 |r62186 |JIT off |JIT on | |:--------|:--------|:--------|:--------|:--------| |fps |37.32 |51.46 |51.31 |58.88 | |vs 2.0.0 |1.00x |1.38x |1.37x |1.58x | ** MJIT benchmarks Benchmark: https://github.com/benchmark-driver/mjit-benchmarks (Original: https://github.com/vnmakarov/ruby/tree/rtl_mjit_branch/MJIT-benchmarks) | |2.0.0-p0 |r62186 |JIT off |JIT on | |:----------|:--------|:--------|:--------|:--------| |aread |1.00 |1.09 |1.07 |2.19 | |aref |1.00 |1.13 |1.11 |2.22 | |aset |1.00 |1.50 |1.45 |2.64 | |awrite |1.00 |1.17 |1.13 |2.20 | |call |1.00 |1.29 |1.26 |2.02 | |const2 |1.00 |1.10 |1.10 |2.19 | |const |1.00 |1.11 |1.10 |2.19 | |fannk |1.00 |1.04 |1.02 |1.00 | |fib |1.00 |1.32 |1.31 |1.84 | |ivread |1.00 |1.13 |1.12 |2.43 | |ivwrite |1.00 |1.23 |1.21 |2.40 | |mandelbrot |1.00 |1.13 |1.16 |1.28 | |meteor |1.00 |2.97 |2.92 |3.17 | |nbody |1.00 |1.17 |1.15 |1.49 | |nest-ntimes|1.00 |1.22 |1.20 |1.39 | |nest-while |1.00 |1.10 |1.10 |1.37 | |norm |1.00 |1.18 |1.16 |1.24 | |nsvb |1.00 |1.16 |1.16 |1.17 | |red-black |1.00 |1.02 |0.99 |1.12 | |sieve |1.00 |1.30 |1.28 |1.62 | |trees |1.00 |1.14 |1.13 |1.19 | |while |1.00 |1.12 |1.11 |2.41 | ** Discourse's script/bench.rb Benchmark: https://github.com/discourse/discourse/blob/v1.8.7/script/bench.rb NOTE: Rails performance was somehow a little degraded with JIT for now. We should fix this. (At least I know opt_aref is performing badly in JIT and I have an idea to fix it. Please wait for the fix.) *** JIT off Your Results: (note for timings- percentile is first, duration is second in millisecs) categories_admin: 50: 17 75: 18 90: 22 99: 29 home_admin: 50: 21 75: 21 90: 27 99: 40 topic_admin: 50: 17 75: 18 90: 22 99: 32 categories: 50: 35 75: 41 90: 43 99: 77 home: 50: 39 75: 46 90: 49 99: 95 topic: 50: 46 75: 52 90: 56 99: 101 *** JIT on Your Results: (note for timings- percentile is first, duration is second in millisecs) categories_admin: 50: 19 75: 21 90: 25 99: 33 home_admin: 50: 24 75: 26 90: 30 99: 35 topic_admin: 50: 19 75: 20 90: 25 99: 30 categories: 50: 40 75: 44 90: 48 99: 76 home: 50: 42 75: 48 90: 51 99: 89 topic: 50: 49 75: 55 90: 58 99: 99 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: merge MJIT infrastructurek0kubun2018-02-042-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | that allows to JIT-compile Ruby methods by generating C code and using C compiler. See the first comment of mjit.c to know what this file does. mjit.c is authored by Vladimir Makarov <vmakarov@redhat.com>. After he invented great method JIT infrastructure for MRI as MJIT, Lars Kanis <lars@greiz-reinsdorf.de> sent the patch to support MinGW in MJIT. In addition to merging it, I ported pthread to Windows native threads. Now this MJIT infrastructure can be compiled on Visual Studio. This commit simplifies mjit.c to decrease code at initial merge. For example, this commit does not provide multiple JIT threads support. We can resurrect them later if we really want them, but I wanted to minimize diff to make it easier to review this patch. `/tmp/_mjitXXX` file is renamed to `/tmp/_ruby_mjitXXX` because non-Ruby developers may not know the name "mjit" and the file name should make sure it's from Ruby and not from some harmful programs. TODO: it may be better to store this to some temporary directory which Ruby is already using by Tempfile, if it's not bad for performance. mjit.h: New. It has `mjit_exec` interface similar to `vm_exec`, which is for triggering MJIT. This drops interface for AOT compared to the original MJIT. Makefile.in: define macros to let MJIT know the path of MJIT header. Probably we can refactor this to reduce the number of macros (TODO). win32/Makefile.sub: ditto. common.mk: compile mjit.o and mjit_compile.o. Unlike original MJIT, this commit separates MJIT infrastructure and JIT compiler code as independent object files. As initial patch is NOT going to have ultra-fast JIT compiler, it's likely to replace JIT compiler, e.g. original MJIT's compiler or some future JIT impelementations which are not public now. inits.c: define MJIT module. This is added because `MJIT.enabled?` was necessary for testing. test/lib/zombie_hunter.rb: skip if `MJIT.enabled?`. Obviously this wouldn't work with current code when JIT is enabled. test/ruby/test_io.rb: skip this too. This would make no sense with MJIT. ruby.c: define MJIT CLI options. As major difference from original MJIT, "-j:l"/"--jit:llvm" are renamed to "--jit-cc" because I want to support not only gcc/clang but also cl.exe (Visual Studio) in the future. But it takes only "--jit-cc=gcc", "--jit-cc=clang" for now. And only long "--jit" options are allowed since some Ruby committers preferred it at Ruby developers Meeting on January, and some of options are renamed. This file also triggers to initialize MJIT thread and variables. eval.c: finalize MJIT worker thread and variables. test/ruby/test_rubyoptions.rb: fix number of CLI options for --jit. thread_pthread.c: change for pthread abstraction in MJIT. Prefix rb_ for functions which are used by other files. thread_win32.c: ditto, for Windows. Those pthread porting is one of major works that YARV-MJIT created, which is my fork of MJIT, in Feature 14235. thread.c: follow rb_ prefix changes vm.c: trigger MJIT call on VM invocation. Also trigger `mjit_mark` to avoid SEGV by race between JIT and GC of ISeq. The improvement was provided by wanabe <s.wanabe@gmail.com>. In JIT compiler I created and am going to add in my next commit, I found that having `mjit_exec` after `vm_loop_start:` is harmful because the JIT-ed function doesn't proceed other ISeqs on RESTORE_REGS of leave insn. Executing non-FINISH frame is unexpected for my JIT compiler and `exception_handler` triggers executions of such ISeqs. So `mjit_exec` here should be executed only when it directly comes from `vm_exec` call. `RubyVM::MJIT` module and `.enabled?` method is added so that we can skip some tests which don't expect JIT threads or compiler file descriptors. vm_insnhelper.h: trigger MJIT on method calls during VM execution. vm_core.h: add fields required for mjit.c. `bp` must be `cfp[6]` because rb_control_frame_struct is likely to be casted to another struct. The last position is the safest place to add the new field. vm_insnhelper.c: save initial value of cfp->ep as cfp->bp. This is an optimization which are done in both MJIT and YARV-MJIT. So this change is added in this commit. Calculating bp from ep is a little heavy work, so bp is kind of cache for it. iseq.c: notify ISeq GC to MJIT. We should know which iseq in MJIT queue is GCed to avoid SEGV. TODO: unload some GCed units in some safe way. gc.c: add hooks so that MJIT can wait GC, and vice versa. Simultaneous JIT and GC executions may cause SEGV and so we should synchronize them. cont.c: save continuation information in MJIT worker. As MJIT shouldn't unload JIT-ed code which is being used, MJIT wants to know full list of saved execution contexts for continuation and detect ISeqs in use. mjit_compile.c: added empty JIT compiler so that you can reuse this commit to build your own JIT compiler. This commit tries to compile ISeqs but all of them are considered as not supported in this commit. So you can't use JIT compiler in this commit yet while we added --jit option now. Patch author: Vladimir Makarov <vmakarov@redhat.com>. Contributors: Takashi Kokubun <takashikkbn@gmail.com>. wanabe <s.wanabe@gmail.com>. Lars Kanis <lars@greiz-reinsdorf.de>. Part of Feature 12589 and 14235. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* thread.c (thread_join_m): avoid NUM2TIMET for Bignumnormal2018-02-031-0/+9
| | | | | | Bignums exceed the range of time_t (or long). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62184 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c: fix string Range optimization with FSLnormal2018-02-031-6/+8
| | | | | | | The optimization in [Feature #13355] needs to be detected differently to work with "frozen_string_literal: true" git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62177 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* process.c: command_name encodingnobu2018-02-031-0/+16
| | | | | | | * process.c (rb_exec_fillarg): share subsequence of argv_buf for command_name, and copy the encoding from the command string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_system.rb: tests without shellnobu2018-02-021-0/+6
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62168 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_system.rb: exit by abort for portabilitynobu2018-02-021-4/+5
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62167 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix testkazu2018-02-021-6/+2
| | | | | | Followup to r62158 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* win32.c: EPIPE for ERROR_NO_DATAnobu2018-02-011-0/+19
| | | | | | | * win32/win32.c (rb_w32_write): writing to closed pipe fails with ERROR_NO_DATA but msvcrt maps it to EINVAL. map it to EPIPE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62150 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io.c: fptr_copy_finalizernobu2018-01-311-1/+2
| | | | | | | | * io.c (fptr_copy_finalizer): remove fptr from pipe_list when pipe became ordinary file, to fix access after free. to be finalized by pipe_finalize and being in pipe_list must match. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io.c: pipe_register_fptrnobu2018-01-311-0/+9
| | | | | | | * io.c (pipe_register_fptr): get rid of double registration which causes access after free and segfault. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62121 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* trick ruby-mode.el by heredocsnobu2018-01-314-7/+15
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* proc: fix super_method segfault after bindnormal2018-01-301-0/+5
| | | | | | | | | * proc.c: handle undefined iclass [ruby-core:85231] [Bug #14421] From: Eric Wong <e@80x24.org> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62115 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* force fixablenobu2018-01-302-3/+9
| | | | | | | | | * complex.c (nucomp_hash): force hash values fixable. [ruby-core:85224] [Bug #14420] * rational.c (nurat_hash): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62107 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c: try to convert in massign `for`nobu2018-01-271-0/+10
| | | | | | | | * compile.c (compile_for_masgn): try to convert to an Array if an element of massign `for` is not an Array. [ruby-core:84931] [Bug #14374] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62073 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* defined? returns nil for toplevel constant lookupnobu2018-01-271-0/+4
| | | | | | | | | | * variable.c (rb_const_defined_0): toplevel constant lookup has been removed, should return nil too. [ruby-core:85142] [Bug #14407] [Fix GH-1800] From: Gonzalo <grzuy0@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62071 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* error.c: receiver kwargnobu2018-01-261-0/+46
| | | | | | | | | | * error.c (name_err_initialize_options): NameError#initialize accepts receiver. [Feature #14313] * error.c (nometh_err_initialize_options): pass keyword arguments to the super method. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62057 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_exception.rb: NameError.new NoMethodError.newnobu2018-01-261-0/+61
| | | | | | | * test/ruby/test_exception.rb: added tests for NameError.new, and NoMethodError.new including priv argument. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62056 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* error.c: KeyError missing keyword argumentsnobu2018-01-261-0/+4
| | | | | | | | * error.c (key_err_initialize): leave attributes for missing keyword arguments unset, so accessors can tell if it is missing or explicit nil. [Feature #14313] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* KeyError#initialize accepts receiver and key.kou2018-01-261-0/+38
| | | | | | | [Feature #14313][ruby-core:84626] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62049 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c: support key swapping in Hash#transform_keys!mrkn2018-01-261-0/+8
| | | | | | | | | | | * hash.c (rb_hash_transform_keys_bang): support key swapping in Hash#transform_keys! [Bug #14380] [ruby-core:84951] * test/ruby/test_hash.rb (test_transform_keys_bang): add assertions for this change git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62042 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c: clear substring code rangenobu2018-01-251-0/+6
| | | | | | | | * string.c (str_substr): substring of broken code range string may be valid or broken. patch by tommy (Masahiro Tomita) at [ruby-dev:50430] [Bug #14388]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62040 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* process.c: add :exception option to Kernel.#systemk0kubun2018-01-241-0/+19
| | | | | | | | to raise error when it fails. [Feature 14386] [GH-1795] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* dir.c: Dir#each_childnobu2018-01-241-0/+3
| | | | | | | * dir.c (dir_each_child_m): new instance methods Dir#each_child and Dir#children. [Feature #13969] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62022 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_args.c: to_proc refinementsnobu2018-01-241-0/+116
| | | | | | | | * vm_args.c (vm_to_proc): enable #to_proc by refinements at Proc passing as a block. patched by osyo (manga osyo). [Feature #14223] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62020 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix a typoyui-knk2018-01-241-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62019 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_io.rb: avoid OOMnobu2018-01-191-1/+2
| | | | | | | * test/ruby/test_io.rb (TestIO#test_copy_stream_socket7): reduce memory usage so the worker process will not die by OOM. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61961 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_insnhelper.c: fix many keyword argumentsnobu2018-01-191-2/+5
| | | | | | | | | | * vm_insnhelper.c (vm_check_keyword): if the index exceeds the width of unspecified bits, that argument is specified. `unspecified_bits` still be a fixnum if the actual arguments do not exceed the limit, regardless the formal parameters size. [ruby-core:84921] [Bug #14373] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61940 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_insnhelper.c: should invert unspecified flagnobu2018-01-191-0/+50
| | | | | | | * vm_insnhelper.c (vm_check_keyword): invert unspecified value flag as `checkkeyword` result. fix up r58390. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61939 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* extend timeout morenaruse2018-01-181-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61902 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* extend timeoutnaruse2018-01-171-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y (new_regexp): Fix SEGV of `/#{"\u3042"}#{'い'}/` in non UTF-8mame2018-01-161-2/+6
| | | | | | | Mixing other encoding string literals in one Regexp caused SEGV. This bug was found by CoverityScan. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/ruby/test_syntax.rb (test_command_with_cmd_brace_block): Addedmame2018-01-151-0/+5
| | | | | | The bison rules were not covered. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61855 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: Fix a bug of `obj[42, &blk] ||= foo bar`mame2018-01-151-0/+24
| | | | | | Follow up of r28123 (!) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61841 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* iseq.c: child iseq encodingnobu2018-01-111-0/+5
| | | | | | * iseq.c (iseq_inspect): preserve the encoding of child iseqs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61767 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_insnhelper.c: search in the indexing ordernobu2018-01-111-0/+12
| | | | | | | | * vm_insnhelper.c (vm_opt_newarray_max, vm_opt_newarray_min): search in the indexing order, as well as usual methods. [ruby-core:84821] [Bug #14350] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: insane syntax too (class definition in cond)mame2018-01-091-0/+5
| | | | | | | This change partially reverts r61724 and take another approach: exploiting struct local_vars to backup the cond_stack state. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y: insane syntaxnobu2018-01-091-0/+5
| | | | | | | * parse.y (primary): save/restore COND and CMDARG stacks at method definition, to distinguish do_block and do_cond properly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61724 b2dd03c8-39d4-4d8f-98ff-823fe69b080e