summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Workaround CRuby adding x86_64-linux-fake in $LOADED_FEATURESBenoit Daloze2023-04-251-1/+5
|
* Update to ruby/spec@7f69c86Benoit Daloze2023-04-2599-183/+2316
|
* Update to ruby/mspec@1d8cf64Benoit Daloze2023-04-256-80/+3
|
* Optimize method_missing callsJeremy Evans2023-04-252-19/+71
| | | | | | | | | | | | | | | | | | CALLER_ARG_SPLAT is not necessary for method_missing. We just need to unshift the method name into the arguments. This optimizes all method_missing calls: * mm(recv) ~9% * mm(recv, *args) ~215% for args.length == 200 * mm(recv, *args, **kw) ~55% for args.length == 200 * mm(recv, **kw) ~22% * mm(recv, kw: 1) ~100% Note that empty argument splats do get slower with this approach, by about 30-40%. Other than non-empty argument splats, other argument splats are faster, with the speedup depending on the number of arguments.
* Optimize symproc callsJeremy Evans2023-04-252-15/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Similar to the bmethod/send optimization, this avoids using CALLER_ARG_SPLAT if not necessary. As long as the receiver argument can be shifted off, other arguments are passed through as-is. This optimizes the following types of calls: * symproc.(recv) ~5% * symproc.(recv, *args) ~65% for args.length == 200 * symproc.(recv, *args, **kw) ~45% for args.length == 200 * symproc.(recv, **kw) ~30% * symproc.(recv, kw: 1) ~100% Note that empty argument splats do get slower with this approach, by about 2-3%. This is probably because iseq argument setup is slower for empty argument splats than CALLER_SETUP_ARG is. Other than non-empty argument splats, other argument splats are faster, with the speedup depending on the number of arguments. The following types of calls are not optimized: * symproc.(*args) * symproc.(*args, **kw) This is because the you cannot shift the receiver argument off without first splatting the arg.
* Optimize send callsJeremy Evans2023-04-252-33/+151
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Similar to the bmethod optimization, this avoids using CALLER_ARG_SPLAT if not necessary. As long as the method argument can be shifted off, other arguments are passed through as-is. This optimizes the following types of calls: * send(meth, arg) ~5% * send(meth, *args) ~75% for args.length == 200 * send(meth, *args, **kw) ~50% for args.length == 200 * send(meth, **kw) ~25% * send(meth, kw: 1) ~115% Note that empty argument splats do get slower with this approach, by about 20%. This is probably because iseq argument setup is slower for empty argument splats than CALLER_SETUP_ARG is. Other than non-empty argument splats, other argument splats are faster, with the speedup depending on the number of arguments. The following types of calls are not optimized: * send(*args) * send(*args, **kw) This is because the you cannot shift the method argument off without first splatting the arg.
* Optimize cfunc calls for f(*a) and f(*a, **kw) if kw is emptyJeremy Evans2023-04-252-4/+96
| | | | | | | | | | | | | | | | | | This optimizes the following calls: * ~10-15% for f(*a) when a does not end with a flagged keywords hash * ~10-15% for f(*a) when a ends with an empty flagged keywords hash * ~35-40% for f(*a, **kw) if kw is empty This still copies the array contents to the VM stack, but avoids some overhead. It would be faster to use the array pointer directly, but that could cause problems if the array was modified during the call to the function. You could do that optimization for frozen arrays, but as splatting frozen arrays is uncommon, and the speedup is minimal (<5%), it doesn't seem worth it. The vm_send_cfunc benchmark has been updated to test additional cfunc call types, and the numbers above were taken from the benchmark results.
* Speed up calling iseq bmethodsJeremy Evans2023-04-253-5/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, bmethod arguments are copied from the VM stack to the C stack in vm_call_bmethod, then copied from the C stack to the VM stack later in invoke_iseq_block_from_c. This is inefficient. This adds vm_call_iseq_bmethod and vm_call_noniseq_bmethod. vm_call_iseq_bmethod is an optimized method that skips stack copies (though there is one copy to remove the receiver from the stack), and avoids calling vm_call_bmethod_body, rb_vm_invoke_bmethod, invoke_block_from_c_proc, invoke_iseq_block_from_c, and vm_yield_setup_args. Th vm_call_iseq_bmethod argument handling is similar to the way normal iseq methods are called, and allows for similar performance optimizations when using splats or keywords. However, even in the no argument case it's still significantly faster. A benchmark is added for bmethod calling. In my environment, it improves bmethod calling performance by 38-59% for simple bmethod calls, and up to 180% for bmethod calls passing literal keywords on both sides. ``` ./miniruby-iseq-bmethod: 18159792.6 i/s ./miniruby-m: 13174419.1 i/s - 1.38x slower bmethod_simple_1 ./miniruby-iseq-bmethod: 15890745.4 i/s ./miniruby-m: 10008972.7 i/s - 1.59x slower bmethod_simple_0_splat ./miniruby-iseq-bmethod: 13142804.3 i/s ./miniruby-m: 11168595.2 i/s - 1.18x slower bmethod_simple_1_splat ./miniruby-iseq-bmethod: 12375791.0 i/s ./miniruby-m: 8491140.1 i/s - 1.46x slower bmethod_no_splat ./miniruby-iseq-bmethod: 10151258.8 i/s ./miniruby-m: 8716664.1 i/s - 1.16x slower bmethod_0_splat ./miniruby-iseq-bmethod: 8138802.5 i/s ./miniruby-m: 7515600.2 i/s - 1.08x slower bmethod_1_splat ./miniruby-iseq-bmethod: 8028372.7 i/s ./miniruby-m: 5947658.6 i/s - 1.35x slower bmethod_10_splat ./miniruby-iseq-bmethod: 6953514.1 i/s ./miniruby-m: 4840132.9 i/s - 1.44x slower bmethod_100_splat ./miniruby-iseq-bmethod: 5287288.4 i/s ./miniruby-m: 2243218.4 i/s - 2.36x slower bmethod_kw ./miniruby-iseq-bmethod: 8931358.2 i/s ./miniruby-m: 3185818.6 i/s - 2.80x slower bmethod_no_kw ./miniruby-iseq-bmethod: 12281287.4 i/s ./miniruby-m: 10041727.9 i/s - 1.22x slower bmethod_kw_splat ./miniruby-iseq-bmethod: 5618956.8 i/s ./miniruby-m: 3657549.5 i/s - 1.54x slower ```
* Generalize cfunc large array splat fix to fix many additional cases raising ↵Jeremy Evans2023-04-258-212/+1221
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SystemStackError Originally, when 2e7bceb34ea858649e1f975a934ce1894d1f06a6 fixed cfuncs to no longer use the VM stack for large array splats, it was thought to have fully fixed Bug #4040, since the issue was fixed for methods defined in Ruby (iseqs) back in Ruby 2.2. After additional research, I determined that same issue affects almost all types of method calls, not just iseq and cfunc calls. There were two main types of remaining issues, important cases (where large array splat should work) and pedantic cases (where large array splat raised SystemStackError instead of ArgumentError). Important cases: ```ruby define_method(:a){|*a|} a(*1380888.times) def b(*a); end send(:b, *1380888.times) :b.to_proc.call(self, *1380888.times) def d; yield(*1380888.times) end d(&method(:b)) def self.method_missing(*a); end not_a_method(*1380888.times) ``` Pedantic cases: ```ruby def a; end a(*1380888.times) def b(_); end b(*1380888.times) def c(_=nil); end c(*1380888.times) c = Class.new do attr_accessor :a alias b a= end.new c.a(*1380888.times) c.b(*1380888.times) c = Struct.new(:a) do alias b a= end.new c.a(*1380888.times) c.b(*1380888.times) ``` This patch fixes all usage of CALLER_SETUP_ARG with splatting a large number of arguments, and required similar fixes to use a temporary hidden array in three other cases where the VM would use the VM stack for handling a large number of arguments. However, it is possible there may be additional cases where splatting a large number of arguments still causes a SystemStackError. This has a measurable performance impact, as it requires additional checks for a large number of arguments in many additional cases. This change is fairly invasive, as there were many different VM functions that needed to be modified to support this. To avoid too much API change, I modified struct rb_calling_info to add a heap_argv member for storing the array, so I would not have to thread it through many functions. This struct is always stack allocated, which helps ensure sure GC doesn't collect it early. Because of how invasive the changes are, and how rarely large arrays are actually splatted in Ruby code, the existing test/spec suites are not great at testing for correct behavior. To try to find and fix all issues, I tested this in CI with VM_ARGC_STACK_MAX to -1, ensuring that a temporary array is used for all array splat method calls. This was very helpful in finding breaking cases, especially ones involving flagged keyword hashes. Fixes [Bug #4040] Co-authored-by: Jimmy Miller <jimmy.miller@shopify.com>
* Temporary skipped failing assertionsHiroshi SHIBATA2023-04-251-2/+2
|
* Removed commented-out codeHiroshi SHIBATA2023-04-251-1/+1
|
* [ruby/syntax_suggest] Clean up outputschneems2023-04-255-27/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I previously left a comment stating I didn't know why a certain method existed. In investigating the code in `CaptureCodeContext#capture_before_after_kws` I found that it was added as to give a slightly less noisy output. The docs for AroundBlockScan#capture_neighbor_context only describe keywords as being a primary concern. I modified that code to only include lines that are keywords or ends. This reduces the output noise even more. This allows me to remove that `start_at_next_line` method. One weird side effect of the prior logic is it would cause this code to produce this output: ``` class OH def hello def hai end end ``` ``` 1 class OH > 2 def hello 4 def hai 5 end 6 end ``` But this code to produce this output: ``` class OH def hello def hai end end ``` ``` 1 class OH > 2 def hello 4 end 5 end ``` Note the missing `def hai`. The only difference between them is that space. With this change, they're now both consistent. https://github.com/ruby/syntax_suggest/commit/4a54767a3e
* [ruby/syntax_suggest] standardrb --fix-unsafely spec/spec_helper.rbHiroshi SHIBATA2023-04-251-1/+1
| | | | https://github.com/ruby/syntax_suggest/commit/6e266b3b2b
* [ruby/irb] Add tests for Locale classStan Lo2023-04-251-0/+83
| | | | | | (https://github.com/ruby/irb/pull/566) https://github.com/ruby/irb/commit/df32e024be
* [ruby/set] Update lib/set.rbAkinori MUSHA2023-04-251-1/+0
| | | | https://github.com/ruby/set/commit/bc59f85f2f
* [ruby/set] Expose Set::VERSIONHiroshi SHIBATA2023-04-252-2/+12
| | | | https://github.com/ruby/set/commit/d39b33f463
* [ruby/abbrev] Update lib/abbrev.rbAkinori MUSHA2023-04-251-1/+0
| | | | https://github.com/ruby/abbrev/commit/6fa790eac1
* [ruby/abbrev] Expose Abbrev::VERSIONHiroshi SHIBATA2023-04-252-2/+11
| | | | https://github.com/ruby/abbrev/commit/255ca681c3
* [ruby/syslog] Improve the version extractionAkinori MUSHA2023-04-251-9/+3
| | | | https://github.com/ruby/syslog/commit/34da65a002
* [ruby/syslog] Raise required_ruby_versionAkinori MUSHA2023-04-251-1/+1
| | | | https://github.com/ruby/syslog/commit/5289373016
* [ruby/syslog] Expose Syslog::VERSIONHiroshi SHIBATA2023-04-252-1/+16
| | | | https://github.com/ruby/syslog/commit/ff5d72fcb9
* [rubygems/rubygems] Bump rb-sysdependabot[bot]2023-04-242-5/+5
| | | | | | | | | | | | | | | Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.72 to 0.9.74. - [Release notes](https://github.com/oxidize-rb/rb-sys/releases) - [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.72...v0.9.74) --- updated-dependencies: - dependency-name: rb-sys dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
* Avoid linking capstone by defaultTakashi Kokubun2023-04-241-3/+3
| | | | Workaround for https://github.com/ruby/setup-ruby/pull/501#issuecomment-1520722486
* YJIT: Use general definedivar at the end of chains (#7756)Takashi Kokubun2023-04-241-1/+1
|
* YJIT: Show definedivar exit reasons (#7755)Takashi Kokubun2023-04-241-0/+1
|
* [ruby/reline] Revert #335 (Trap TSTP to handle C-z)Carl Brasic2023-04-241-11/+0
| | | | | | | | | | | | | | | | | | | (https://github.com/ruby/reline/pull/535) This PR was an effort to address #321 (ed_quoted_insert doesn't work properly) but per the reporter it did not work correctly. Moreover, it introduced a major regression: Shell job control stopped working in all applications that use reline, notably IRB. Bash and other shells send SIGTSTP in response to C-z to implement job suspension. Handling SIGSTP opts out of this functionality. For a line oriented terminal program this should be avoided (not to mention, this behavior diverges from readline's) https://github.com/ruby/reline/commit/26383d25b8 Co-authored-by: Carl Brasic <cbrasic@drwholdings.com>
* Allow anonymous memberless StructJeremy Evans2023-04-243-8/+18
| | | | | | | Previously, named memberless Structs were allowed, but anonymous memberless Structs were not. Fixes [Bug #19416]
* [ruby/irb] Simplify the help command's implementationStan Lo2023-04-242-17/+17
| | | | | | | | | | | | (https://github.com/ruby/irb/pull/564) The current method-redefining approach brings little benefit, makes it harder to understand the code, and causes warnings like: > warning: method redefined; discarding old execute This patch simplifies it while displaying more helpful message when rdoc couldn't be loaded.
* [ruby/irb] Filter out top-level methods when using `lsStan Lo2023-04-242-3/+9
| | | | | | | | | <Class/Module>` (https://github.com/ruby/irb/pull/562) Instead of always printing methods inherited from Class or Module, IRB by default should filter them out unless `<Class/Module>` is specified to be either of those.
* Bump github/codeql-action from 2.2.11 to 2.3.0dependabot[bot]2023-04-242-5/+5
| | | | | | | | | | | | | | | Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2.2.11 to 2.3.0. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/d186a2a36cc67bfa1b860e6170d37fb9634742c7...b2c19fb9a2a485599ccf4ed5d65527d94bc57226) --- updated-dependencies: - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
* Use UTF-8 encoding for literal extended regexps with UTF-8 characters in ↵Jeremy Evans2023-04-232-1/+15
| | | | | | comments Fixes [Bug #19455]
* [ruby/irb] fix typo in tracer (https://github.com/ruby/irb/pull/565)Yusuf Daniju2023-04-231-1/+1
| | | | https://github.com/ruby/irb/commit/2f567f3d3e
* Check the precision of `getrusage` at runtimeNobuyoshi Nakada2023-04-231-1/+11
|
* Fix a guard of `Process.times`Nobuyoshi Nakada2023-04-221-8/+5
| | | | | | `GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID` clock uses `getrusage` always if available as the name states. That is if it is implemented `getrusage` is available, regardless microseconds in its results.
* Fix an example of `Process.times`Nobuyoshi Nakada2023-04-221-1/+1
| | | | | | | | Prior to commit 5806c54447439f2ba22892e4045e78dd80f96f0c, it was "at least one result with precision beyond milliseconds (with none-zero microseconds) should exist"; after this commit, "at least one result should have zero microseconds". This chance is lower than the previous condition.
* Remove unused opt_call_c_function insn (#7750)Takashi Kokubun2023-04-211-21/+0
|
* Use shorter path as `SPEC_TEMP_DIR`Nobuyoshi Nakada2023-04-212-1/+15
| | | | | | The temporary directory under the build directory may be too long as a UNIX socket path. On macOS, the default `TMPDIR` per user is also very long.
* Skip when unix socket path is too longNobuyoshi Nakada2023-04-211-1/+3
| | | | | Eventually the path directly under "/tmp" is complained by `rm_r` in spec/mspec/lib/mspec/helpers/fs.rb.
* Add rubyspec-capiext on mswinNobuyoshi Nakada2023-04-211-0/+30
|
* [ruby/rinda] Expose Rinda::VERSIONHiroshi SHIBATA2023-04-212-2/+11
| | | | https://github.com/ruby/rinda/commit/fa3865ac48
* [ruby/win32ole] Reuse WIN32OLE_VERSION for gem versionHiroshi SHIBATA2023-04-212-2/+12
| | | | https://github.com/ruby/win32ole/commit/bff3ea8b0b
* [ruby/fcntl] Expose Fcntl::VERSIONHiroshi SHIBATA2023-04-212-1/+17
| | | | https://github.com/ruby/fcntl/commit/cb8e414e9f
* YJIT: invokesuper: Remove cme mid matching checkJohn Hawthorn2023-04-202-7/+19
| | | | | | | | | | This check was introduced to match an assertion in the C YJIT when this was originally introduced. I don't believe it's necessary for correctness of the generated code. Co-authored-by: Adam Hess <HParker@github.com> Co-authored-by: Daniel Colson <danieljamescolson@gmail.com> Co-authored-by: Luan Vieira <luanzeba@github.com>
* YJIT: Merge lower_stack into the split pass (#7748)Takashi Kokubun2023-04-203-71/+55
|
* [DOC] Documentation for flags of RClassPeter Zhu2023-04-201-0/+36
|
* Fix inaccurate commentMaxime Chevalier-Boisvert2023-04-201-1/+3
|
* YJIT: Merge csel and mov on arm64 (#7747)Takashi Kokubun2023-04-201-94/+91
| | | | | * YJIT: Refactor arm64_split with &mut insn * YJIT: Merge csel and mov on arm64
* YJIT: Avoid splitting mov for small values on arm64 (#7745)Takashi Kokubun2023-04-202-3/+32
| | | | | | | | | | | | | * YJIT: Avoid splitting mov for small values on arm64 * Fix a comment Co-authored-by: Alan Wu <XrXr@users.noreply.github.com> * YJIT: Test the 0xffff boundary --------- Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
* [rubygems/rubygems] util/rubocop -AHiroshi SHIBATA2023-04-201-1/+1
| | | | https://github.com/rubygems/rubygems/commit/784e5e2fe5
* [rubygems/rubygems] Support Symbol and URL keysHiroshi SHIBATA2023-04-201-1/+1
| | | | https://github.com/rubygems/rubygems/commit/3bda049c73