summaryrefslogtreecommitdiff
path: root/test/ruby
AgeCommit message (Collapse)Author
2020-08-26Fixed error messages at non-ascii %string terminatorNobuyoshi Nakada
2020-08-19register_fstring: avoid duping the passed string when possibleJean Boussier
If the passed string is frozen, bare and not shared, then there is no need to duplicate it. Ref: 4ab69ebbd7cef8539f687e1f948845d076461dc6 Ref: https://bugs.ruby-lang.org/issues/11386 Notes: Merged: https://github.com/ruby/ruby/pull/3430
2020-08-17Ensure the shortcut cached in the classNobuyoshi Nakada
As well as the other places using RCLASS_IV_INDEX_TBL. `IO#reopen` seems the only case that the class of an object can be changed.
2020-08-13rb_str_{index,rindex}_m: Handle /\K/ in patternKasumi Hanazuki
When the pattern Regexp given to String#index and String#rindex contain a /\K/ (lookbehind) operator, these methods return the position where the beginning of the lookbehind pattern matches, while they are expected to return the position where the \K matches. ``` # without patch "abcdbce".index(/b\Kc/) # => 1 "abcdbce".rindex(/b\Kc/) # => 4 ``` This patch fixes this problem by using BEG(0) instead of the return value of rb_reg_search. ``` # with patch "abcdbce".index(/b\Kc/) # => 2 "abcdbce".rindex(/b\Kc/) # => 5 ``` Fixes [Bug #17118] Notes: Merged: https://github.com/ruby/ruby/pull/3414
2020-08-13rb_str_{partition,rpartition}_m: Handle /\K/ in patternKasumi Hanazuki
When the pattern given to String#partition and String#rpartition contain a /\K/ (lookbehind) operator, the methods return strings sliced at incorrect positions. ``` # without patch "abcdbce".partition(/b\Kc/) # => ["a", "c", "cdbce"] "abcdbce".rpartition(/b\Kc/) # => ["abcd", "c", "ce"] ``` This patch fixes the problem by using BEG(0) instead of the return value of rb_reg_search. ``` # with patch "abcdbce".partition(/b\Kc/) # => ["ab", "c", "dbce"] "abcdbce".rpartition(/b\Kc/) # => ["abcdb", "c", "e"] ``` As a side-effect this patch makes String#partition 2x faster when the pattern is a costly Regexp by performing Regexp search only once, which was unexpectedly done twice in the original implementation. Fixes [Bug #17119] Notes: Merged: https://github.com/ruby/ruby/pull/3413
2020-08-12Fix corruption in ARGF.inplacePeter Zhu
Extension string stored in `ARGF.inplace` is created using an api designed for C string constants to create a Ruby string that points at another Ruby string. When the original string is swept, the extension string gets corrupted. Reproduction script (on MacOS): ```ruby #!/usr/bin/ruby -pi.bak BEGIN { GC.start(full_mark: true) arr = [] 1000000.times do |x| arr << "fooo#{x}" end } puts "hello" ``` Co-Authored-By: Matt Valentine-House <31869+eightbitraptor@users.noreply.github.com> Notes: Merged: https://github.com/ruby/ruby/pull/3409 Merged-By: nobu <nobu@ruby-lang.org>
2020-08-12string.c(rb_str_split_m): Handle /\K/ correctlyKasumi Hanazuki
Use BEG(0) instead of the result of rb_reg_search to handle the cases when the separator Regexp contains /\K/ (lookbehind) operator. Fixes [Bug #17113] Notes: Merged: https://github.com/ruby/ruby/pull/3407
2020-08-11Enable s390x invokebuiltin JIT test againTakashi Kokubun
2020-08-06[Feature #16513] TracePoint#inspect returns "... file:line" (#3391)Nguyễn Quang Minh
* Fix debug documents to match Thread#to_s change (Feature #16412 ticket) * TracePoint#inspect returns "... file:line" (Feature #16513) * Guard older version of Ruby in Tracepoint inspection tests * Focus on current thread only when running TracePoint inspection test Notes: Merged-By: ko1 <ko1@atdot.net>
2020-08-06Apply timeout-scale to test_thr_kill.Jun Aruga
Notes: Merged: https://github.com/ruby/ruby/pull/3380
2020-07-31Added NUL-contained casesNobuyoshi Nakada
2020-07-30Fix Array#flatten for recursive array when given positive depth [Bug #17092]Marc-Andre Lafortune
2020-07-28Fix Time#ceil when result should be the same as the receiverJeremy Evans
Fixes [Bug #17025] Notes: Merged: https://github.com/ruby/ruby/pull/3362
2020-07-27Prevent SystemStackError when calling super in module with activated refinementJeremy Evans
Without this, if a refinement defines a method that calls super and includes a module with a module that calls super and has a activated refinement at the point super is called, the module method super call will end up calling back into the refinement method, creating a loop. Fixes [Bug #17007] Notes: Merged: https://github.com/ruby/ruby/pull/3309
2020-07-24Respect visibility in non-array Enumerable#inject [Bug #13592]Nobuyoshi Nakada
2020-07-24Fix Time#to_a behavior with timezone [Bug #17046]S.H
Notes: Merged: https://github.com/ruby/ruby/pull/3355 Merged-By: nobu <nobu@ruby-lang.org>
2020-07-23Improved Enumerable::Lazy#flat_mapNobuyoshi Nakada
| |compare-ruby|built-ruby| |:-------|-----------:|---------:| |num3 | 96.333k| 160.732k| | | -| 1.67x| |num10 | 96.615k| 159.150k| | | -| 1.65x| |ary2 | 103.836k| 172.787k| | | -| 1.66x| |ary10 | 109.249k| 177.252k| | | -| 1.62x| |ary20 | 106.628k| 177.371k| | | -| 1.66x| |ary50 | 107.135k| 162.282k| | | -| 1.51x| |ary100 | 106.513k| 177.626k| | | -| 1.67x| Notes: Merged: https://github.com/ruby/ruby/pull/3339
2020-07-23Test for weeknumber with timezone [Bug #17042]Nobuyoshi Nakada
2020-07-22Switch reserved for numbered parameter warning to SyntaxErrorJeremy Evans
Notes: Merged: https://github.com/ruby/ruby/pull/3163
2020-07-19Special case Range#max for integer beginning and Float::Infinity endJeremy Evans
Popular Ruby libraries such as Rails and Rubocop relying on the previous behavior, even though it is technically a bug. The correct behavior is probably raising RangeError, since that is what an endless range raises. Related to [Bug #17017]
2020-07-19Fix Range#max for beginless Integer ranges [Bug #17034]Michael Kohl
* Fix Range#max for beginless Integer ranges * Update test/ruby/test_range.rb * Fix formatting https://github.com/ruby/ruby/pull/3328 Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> Notes: Merged-By: nobu <nobu@ruby-lang.org>
2020-07-18Optimize Array#min (#3324)Kenta Murata
The benchmark result is below: | |compare-ruby|built-ruby| |:---------------|-----------:|---------:| |ary2.min | 39.105M| 39.442M| | | -| 1.01x| |ary10.min | 23.995M| 30.762M| | | -| 1.28x| |ary100.min | 6.249M| 10.783M| | | -| 1.73x| |ary500.min | 1.408M| 2.714M| | | -| 1.93x| |ary1000.min | 828.397k| 1.465M| | | -| 1.77x| |ary2000.min | 332.256k| 570.504k| | | -| 1.72x| |ary3000.min | 338.079k| 573.868k| | | -| 1.70x| |ary5000.min | 168.217k| 286.114k| | | -| 1.70x| |ary10000.min | 85.512k| 143.551k| | | -| 1.68x| |ary20000.min | 43.264k| 71.935k| | | -| 1.66x| |ary50000.min | 17.317k| 29.107k| | | -| 1.68x| |ary100000.min | 9.072k| 14.540k| | | -| 1.60x| |ary1000000.min | 872.930| 1.436k| | | -| 1.64x| compare-ruby is 9f4b7fc82e. Notes: Merged-By: mrkn <mrkn@ruby-lang.org>
2020-07-18Optimize Array#max (#3325)Kenta Murata
The benchmark result is below: | |compare-ruby|built-ruby| |:---------------|-----------:|---------:| |ary2.max | 38.837M| 40.830M| | | -| 1.05x| |ary10.max | 23.035M| 32.626M| | | -| 1.42x| |ary100.max | 5.490M| 11.020M| | | -| 2.01x| |ary500.max | 1.324M| 2.679M| | | -| 2.02x| |ary1000.max | 699.167k| 1.403M| | | -| 2.01x| |ary2000.max | 284.321k| 570.446k| | | -| 2.01x| |ary3000.max | 282.613k| 571.683k| | | -| 2.02x| |ary5000.max | 145.120k| 285.546k| | | -| 1.97x| |ary10000.max | 72.102k| 142.831k| | | -| 1.98x| |ary20000.max | 36.065k| 72.077k| | | -| 2.00x| |ary50000.max | 14.343k| 29.139k| | | -| 2.03x| |ary100000.max | 7.586k| 14.472k| | | -| 1.91x| |ary1000000.max | 726.915| 1.495k| | | -| 2.06x| Notes: Merged-By: mrkn <mrkn@ruby-lang.org>
2020-07-15Fixed infinite loop at error in printing cause [Bug #17033]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/3320
2020-07-13Fix Range#{max,minmax} for range with integer beginning and non-integer endJeremy Evans
Previously, for inclusive ranges, the max would show up as the end of the range, even though the end was not an integer and would not be the maximum value. For exclusive ranges, max/minmax would previously raise a TypeError, even though it is possible to get the correct maximum. This change to max/minmax also uncovered a similar error in cover?, which calls max in certain cases, so adjust the code there so that cover? still works as expected. Fixes [Bug #17017] Notes: Merged: https://github.com/ruby/ruby/pull/3306 Merged-By: jeremyevans <code@jeremyevans.net>
2020-07-12Fixed yday and wday with timezone [Bug #17024]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/3312
2020-07-10Encode ' as &apos; when using encode(xml: :attr)Jeremy Evans
Fixes [Bug #16922] Notes: Merged: https://github.com/ruby/ruby/pull/3177
2020-07-10Fix an inaccurate comment in test_jitTakashi Kokubun
2020-07-10Make sure vm_call_cfunc uses inlined ccTakashi Kokubun
which is checked by the first guard. When JIT-inlined cc and operand cd->cc are different, the JIT-ed code might wrongly dispatch cd->cc even while class check is done with another cc inlined by JIT. This fixes SEGV on railsbench.
2020-07-08Added `NODE_SPECIAL_EXCESSIVE_COMMA` info to `ARGS` of ↵manga_osyo
`RubyVM::AbstractSyntaxTree`. Notes: Merged: https://github.com/ruby/ruby/pull/3298
2020-07-06Add operator info to `OP_ASGN2` of `RubyVM::AbstractSyntaxTree`.manga_osyo
Notes: Merged: https://github.com/ruby/ruby/pull/3294
2020-07-04Check ROBJECT_EMBED on guards-merged ivar accessTakashi Kokubun
Fix CI failure like http://ci.rvm.jp/results/trunk-mjit-wait@silicon-docker/3043247 introduced by a69dd699ee630dd1086627dbca15a218a8538b6f
2020-07-04Fix non-numeric exclusive Range#minmax bugSam Bostock
The implementation of Range#minmax added in d5c60214c45 causes the following incorrect behaviour: ('a'...'c').minmax => ["a", ["a", "b"]] instead of ('a'...'c').minmax => ["a", "b"] This is because the C implementation of Range#minmax (range_minmax) directly delegates to the C implementation of Range#min (range_min) and Range#max (range_max), without changing the execution context. Range#max's C implementation (range_max), when given a non-numeric exclusive range, delegates to super, which is meant to call Enumerable#max. However, because range_max is called directly by range_minmax, super calls Enumerable#minmax instead, causing the incorrect nesting. Perhaps it is possible to change the execution context in an optimized manner, but the simplest solution seems to be to just explicitly delegate from Range#minmax to Range#min and Range#max. Notes: Merged: https://github.com/ruby/ruby/pull/3285
2020-07-03Make Kernel#then, #yield_self, #frozen? builtin (#3283)Takashi Kokubun
* Make Kernel#then, #yield_self, #frozen? builtin * Fix test_jit Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2020-07-03Rewrite Kernel#tap with Ruby (#3281)Takashi Kokubun
* Rewrite Kernel#tap with Ruby This was good for VM too, but of course my intention is to unblock JIT's inlining of a block over yield (inlining invokeyield has not been committed though). * Fix test_settracefunc About the :tap deletions, the :tap events are actually traced (we already have a TracePoint test for builtin methods), but it's filtered out by tp.path == "xyzzy" (it became "<internal:kernel>"). We could trace tp.path == "<internal:kernel>" cases too, but the lineno is impacted by kernel.rb changes and I didn't want to make it fragile for kernel.rb lineno changes. Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2020-06-27Suppress "assigned but unused variable" warningsKazuki Tsujimoto
2020-06-27Add #deconstruct cache to find patternVladimir Dementyev
Notes: Merged: https://github.com/ruby/ruby/pull/3104
2020-06-27Optimize array pattern matching by caching #deconstruct valueVladimir Dementyev
Notes: Merged: https://github.com/ruby/ruby/pull/3104
2020-06-25Collect insns from a child processTakashi Kokubun
to make sure :opt_invokebuiltin_delegate_leave doesn't become :(trace_)opt_invokebuiltin_delegate. This is to prevent a warning like > /tmp/ruby/v3/src/trunk-test/test/ruby/test_jit.rb:618: warning: 'opt_invokebuiltin_delegate_leave' insn is not included in the script. Actual insns are: opt_invokebuiltin_delegate leave
2020-06-26test/ruby/test_settracefunc.rb: Suppress a warningYusuke Endoh
http://rubyci.s3.amazonaws.com/ubuntu2004/ruby-master/log/20200626T033003Z.log.html.gz ``` /home/chkbuild/chkbuild/tmp/build/20200626T033003Z/ruby/test/ruby/test_settracefunc.rb:2299: warning: ambiguous first argument; put parentheses or a space even after `/' operator ```
2020-06-26fix return event and opt_invokebuiltin_delegate_leave (#3256)Koichi Sasada
If :return event is specified for a opt_invokebuiltin_delegate_leave and leave combination, the instructions should be opt_invokebuiltin_delegate trace_return instructions. To make it, opt_invokebuiltin_delegate_leave instruction will be changed to opt_invokebuiltin_delegate even if it is not an event target instruction. Notes: Merged-By: ko1 <ko1@atdot.net>
2020-06-24Do not JIT inline builtin methodsTakashi Kokubun
It's probably not worth it because there's nothing we can optimize in such builtin methods. It's worth JIT only when inlined.
2020-06-24Run a TracePoint test in an insolated processTakashi Kokubun
to prevent a random failure like http://ci.rvm.jp/results/trunk-random2@phosphorus-docker/3024287
2020-06-25Drop token info for endless method definitionNobuyoshi Nakada
Because it does not have closing `end`.
2020-06-24Fix a random test failure by TracePointTakashi Kokubun
A test worker process may already be enabling TracePoint, which results in changing the insn name in this test. http://ci.rvm.jp/results/trunk-random0@phosphorus-docker/3022750
2020-06-23Trace :return of builtin methodsTakashi Kokubun
using opt_invokebuiltin_delegate_leave insn. Since Ruby 2.7, :return of methods using builtin have not been traced properly.
2020-06-21test/ruby/test_jit.rb: Change the condition to detect RHEL 7.1 s390xYusuke Endoh
2020-06-20Skip a test_jit with builtin for rhel_zlinuxTakashi Kokubun
Either 95b0fed371 or 7561db8c00 started to cause https://rubyci.org/logs/rubyci.s3.amazonaws.com/rhel_zlinux/ruby-master/log/20200621T053303Z.fail.html.gz But so far no idea why it's happening. Until I get direct ssh access to debug the details, let me skip this as it's essentially not ruby's fault.
2020-06-20Make Integer#zero? a separated method and builtin (#3226)Takashi Kokubun
A prerequisite to fix https://bugs.ruby-lang.org/issues/15589 with JIT. This commit alone doesn't make a significant difference yet, but I thought this commit should be committed independently. This method override was discussed in [Misc #16961]. Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2020-06-19Implement Proc#== and #eql?Jeremy Evans
Previously, these were not implemented, and Object#== and #eql? were used. This tries to check the proc internals to make sure that procs created from separate blocks are treated as not equal, but procs created from the same block are treated as equal, even when the lazy proc allocation optimization is used. Implements [Feature #14267] Notes: Merged: https://github.com/ruby/ruby/pull/3174