summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Bundle rbs-3.1.0 (#7766)Soutaro Matsumoto2023-04-282-1/+5
|
* Introduce --enable-rjit=disasmTakashi Kokubun2023-04-272-4/+15
|
* [ruby/irb] Simplify Locale#loadStan Lo2023-04-271-39/+2
| | | | | | | | | | | | | (https://github.com/ruby/irb/pull/571) * Simplify Locale#load Instead of loading file content with `MagicFile` and then evaluting it, we can just use `Kernel.load` to load the file. * Remove unused optional argument * Remove unused Locale#require and #toplevel_load
* Merge T_OBJECT case in rb_ivar_delete functionS-H-GAMELINKS2023-04-271-5/+0
|
* [ruby/irb] Stop using MagicFile for printing help messagesStan Lo2023-04-271-1/+1
| | | | | | | | | | | | | (https://github.com/ruby/irb/pull/573) `MagicFile` was introduced around v0.9.6, which was like 14~15 years ago. It was needed because back then we needed to read a file's magic comment to determine the encoding of it, and read it with that encoding. Commit: https://github.com/ruby/irb/commit/3ee79e89adb8e21b63d796e53bcc86281685076d But now both EN and JA's help-message file are UTF-8 and have removed the encoding comment, we don't need to open them with `MagicFile` anymore.
* [Bug #19611] Remove never-reachable branch in logical expressionNobuyoshi Nakada2023-04-272-24/+47
|
* Constify `type` and `typed_flag` in `RTypedData`Nobuyoshi Nakada2023-04-271-4/+2
| | | | These must not be changed once initialized.
* Skip DW_FORM_GNU_* forms in addr2line.cKJ Tsanaktsidis2023-04-271-1/+13
| | | | | | | | | | | | | | DW_FORM_GNU_ref_alt and DW_FORM_GNU_strp_alt refer to data stored in an external ELF file specified by a .gnu_debugaltlink attribute. These attributes are generated by dwz(1), which extracts DWARF data common amongst several files and stores it in a single, new file. It leaves behind these two forms in the original file to point at the new, common data. We don't support actually reading the .gnu_debugaltlink file in addr2line.c (and maybe we don't really need to), but we do need to know how to read the actual value of these forms so we can skip over the right number of bytes and not lose track of where we are in the CU.
* RJIT: Tweak the default call thresholdTakashi Kokubun2023-04-261-1/+1
| | | | This number works better on yjit-bench (ruby-lsp).
* RJIT: Fix unspecified_bits with localsTakashi Kokubun2023-04-262-2/+16
|
* Add a CI check for ext/SetupAlan Wu2023-04-261-0/+5
|
* [Bug #19592] Fix ext/Setup supportAlan Wu2023-04-263-20/+17
| | | | | | | | | | | | | | After [1], using ext/Setup to link some, but not all extensions failed during linking. I did not know about this option, and had assumed that only `--with-static-linked-ext` builds can include statically linked extensions. Include the support code for statically linked extensions in all configurations like before [1]. Initialize the table lazily to minimize footprint on builds that have no statically linked extensions. [1]: 790cf4b6d0475614afb127b416e87cfa39044d67 "Fix autoload status of statically linked extensions"
* [ruby/irb] Use a more tolerant way to check Locale#find's returnStan Lo2023-04-261-4/+4
| | | | | | | path (https://github.com/ruby/irb/pull/572) https://github.com/ruby/irb/commit/0b648adf38
* [ruby/irb] Add tests for Locale#find and Locale#loadStan Lo2023-04-261-0/+35
| | | | | | (https://github.com/ruby/irb/pull/570) https://github.com/ruby/irb/commit/710d5b1af5
* [ruby/irb] Remove encoding_aliases.rbStan Lo2023-04-262-16/+6
| | | | | | | | (https://github.com/ruby/irb/pull/569) We don't have to load another file to define the legacy encoding aliases map because there's only one definition of it. We can define it in locale.rb directly.
* marshal.c: shallow freeze user objectsJean Boussier2023-04-262-10/+16
| | | | | | When `freeze: true` argument is passed. [Bug #19427]
* Wrap `undef_method :a` with `ensure`Gary Tou2023-04-261-2/+2
|
* `klass == (VALUE)NULL` --> `!klass`Gary Tou2023-04-261-1/+1
| | | Co-authored-by: Rafael Mendonça França <rafael@franca.dev>
* Test: `defined?(super)` in `BasicObject` returns `nil`Gary Tou2023-04-261-0/+14
| | | | Ensure it returns `nil` instead of segmentation faulting
* defined zsuper: Handle NULL superclass for `BasicObject`Gary Tou2023-04-261-0/+2
| | | | | | | | | | | | | | | | | Prior to this commit, a segmentation fault occurred in `vm_defined`'s `zsuper` implementation after NULL is returned as `BasicObject`'s superclass. This fix returns false from `vm_defined` if the superclass is NULL. For example, the following code resulted in a segfault. ```ruby class BasicObject def seg_fault defined?(super) end end seg_fault ```
* add new debug log line on `rb_ractor_terminate_all`Koichi Sasada2023-04-261-0/+2
| | | | to leave the trace.
* show a separator even if `ec` is NULL.Koichi Sasada2023-04-261-13/+12
| | | | | `RUBY_DEBUG_LOG()` doesn't show anything if `GET_EC()` returns NULL, but print a separator "\t" to make consistent TSV.
* `RUBY_DEBUG_LOG_PID` for `RUBY_DEBUG_LOG()`Koichi Sasada2023-04-261-0/+11
| | | | | `RUBY_DEBUG_LOG=stderr RUBY_DEBUG_LOG_PID=1 ruby ...` will prints debug logs with PID.
* We need to checkout before BundledGem.dummy_gemspec checking.Hiroshi SHIBATA2023-04-261-6/+10
| | | | | | | | | When newer version released rather than gems/bundled_gems defined, `spec.version == Gem::Version.new(v)` always abort like: ``` Unexpected versions between bundled_gems:3.0.4 and gemspec:3.1.0 ```
* [ruby/irb] Fix Locale's encoding lookup for Japanese encodingsStan Lo2023-04-262-3/+4
| | | | | | | | | | | | | | (https://github.com/ruby/irb/pull/568) In https://github.com/ruby/irb/commit/3ee79e89adb8e21b63d796e53bcc86281685076d, `encoding_aliases.rb` was introduced to return the correct encoding object for `ujis` and `euc` encodings. However, the return value of `@@legacy_encoding_alias_map[@encoding_name]` is always overridden by a second look up with `Encoding.find(@encoding_name)`. So the logic didn't work as expected. This commit fixes the problem.
* Revert "Temporary skipped failing assertions"Hiroshi SHIBATA2023-04-261-2/+2
| | | | This reverts commit e7cdce83e8c8797c481ccb54c260c0db1e1afa7c.
* Bump ruby/setup-ruby from 1.146.0 to 1.147.0dependabot[bot]2023-04-264-4/+4
| | | | | | | | | | | | | | Bumps [ruby/setup-ruby](https://github.com/ruby/setup-ruby) from 1.146.0 to 1.147.0. - [Release notes](https://github.com/ruby/setup-ruby/releases) - [Commits](https://github.com/ruby/setup-ruby/compare/55283cc23133118229fd3f97f9336ee23a179fcf...6cecb48364174b0952995175c55f9bf5527e6682) --- updated-dependencies: - dependency-name: ruby/setup-ruby dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
* [ruby/pp] Remove patch added for Ruby 2.6/JRuby 9.3Stan Lo2023-04-251-9/+0
| | | | https://github.com/ruby/pp/commit/09dae96129
* [ruby/pp] Skip certain tests for JRubyStan Lo2023-04-251-1/+3
| | | | https://github.com/ruby/pp/commit/f7bde31ca9
* Update to ruby/spec@7f6ca5bBenoit Daloze2023-04-252-1/+2
|
* 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