summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-05-12Avoid improper optimization of case statements mixed integer/rational/complexJeremy Evans
Fixes [Bug #17857] Notes: Merged: https://github.com/ruby/ruby/pull/4496
2021-05-12Fix handling of control/meta escapes in literal regexpsJeremy Evans
Ruby uses a recursive algorithm for handling control/meta escapes in strings (read_escape). However, the equivalent code for regexps (tokadd_escape) in did not use a recursive algorithm. Due to this, Handling of control/meta escapes in regexp did not have the same behavior as in strings, leading to behavior such as the following returning nil: ```ruby /\c\xFF/ =~ "\c\xFF" ``` Switch the code for handling \c, \C and \M in literal regexps to use the same code as for strings (read_escape), to keep behavior consistent between the two. Fixes [Bug #14367] Notes: Merged: https://github.com/ruby/ruby/pull/4495
2021-05-13[rubygems/rubygems] Use `Time.stub :now` to avoid a random failureYusuke Endoh
Essentially this reverts 45464bfcbdf9f9cfb440950bc57a27d237627a17. The commit removed a mock of Time.now, which caused a random failure. http://rubyci.s3.amazonaws.com/ubuntu1804/ruby-master/log/20210512T123004Z.fail.html.gz ``` 1) Failure: TestGemPackageTarWriter#test_add_file_signer [/home/chkbuild/chkbuild/tmp/build/20210512T123004Z/ruby/test/rubygems/test_gem_package_tar_writer.rb:117]: Field mtime of the tar header differs.. <"14046746312\u0000"> expected but was <"14046746311\x00">. ``` Object#stub is defined at f1af59fe02ef2cc58f13e2742e4cc6cf8c2a1a20, so now `Time.stub :now` works. https://github.com/rubygems/rubygems/commit/85f60a9ed0
2021-05-13* 2021-05-13 [ci skip]git
2021-05-13parse.y: Allow "command" syntax in endless method definitionYusuke Endoh
This change allows `def hello = puts "Hello"` without parentheses. Note that `private def hello = puts "Hello"` does not parse for technical reason. [Feature #17398]
2021-05-12* remove trailing spaces. [ci skip]git
2021-05-12Use another class for the comparison.Koichi Sasada
`memsize_of(Object.new)` can be changed with past ivar creation history for Object instances (another Object instance has 4 or more ivars, next created Object instance has the area for the ivars). So use antoher class for the comparison.
2021-05-12Use assert_raise instead of assert_raisesHiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/4491
2021-05-12Revert 924ce2c5ba4d1c1dc781a6a06682204d358421bbHiroshi SHIBATA
Because test-unit didn't provide the benchmark test. And This test is fragile with the several environments. Notes: Merged: https://github.com/ruby/ruby/pull/4491
2021-05-12[rubygems/rubygems] Added begin-end block for java platformHiroshi SHIBATA
Because pend of test-unit raises exception. https://github.com/rubygems/rubygems/commit/b5e2d0855a Notes: Merged: https://github.com/ruby/ruby/pull/4491
2021-05-12[rubygems/rubygems] Update the link of minitest code with the commit hash.Hiroshi SHIBATA
https://github.com/rubygems/rubygems/commit/e7280f8d30 Notes: Merged: https://github.com/ruby/ruby/pull/4491
2021-05-12[rubygems/rubygems] Removed the related code for minitest-bisectHiroshi SHIBATA
https://github.com/rubygems/rubygems/commit/83ebdec27a Notes: Merged: https://github.com/ruby/ruby/pull/4491
2021-05-12[rubygems/rubygems] Fixed an intentional blank-lineHiroshi SHIBATA
https://github.com/rubygems/rubygems/commit/795b572ac2 Notes: Merged: https://github.com/ruby/ruby/pull/4491
2021-05-12[rubygems/rubygems] Added comment for Minitest::MockHiroshi SHIBATA
https://github.com/rubygems/rubygems/commit/ae44b68d57 Notes: Merged: https://github.com/ruby/ruby/pull/4491
2021-05-12[rubygems/rubygems] Replace skip to pendHiroshi SHIBATA
https://github.com/rubygems/rubygems/commit/0b145135c7 Notes: Merged: https://github.com/ruby/ruby/pull/4491
2021-05-12[rubygems/rubygems] util/rubocop -aHiroshi SHIBATA
https://github.com/rubygems/rubygems/commit/a10ff97830 Notes: Merged: https://github.com/ruby/ruby/pull/4491
2021-05-12[rubygems/rubygems] Don't use Minitest::MockHiroshi SHIBATA
https://github.com/rubygems/rubygems/commit/d3fa893597 Notes: Merged: https://github.com/ruby/ruby/pull/4491
2021-05-12[rubygems/rubygems] Removed minitest/mock from ↵Hiroshi SHIBATA
test/rubygems/test_gem_remote_fetcher.rb https://github.com/rubygems/rubygems/commit/f1af59fe02 Notes: Merged: https://github.com/ruby/ruby/pull/4491
2021-05-12[rubygems/rubygems] Removed minitest/mock from test_gem_package_tar_writer.rbHiroshi SHIBATA
https://github.com/rubygems/rubygems/commit/45464bfcbd Notes: Merged: https://github.com/ruby/ruby/pull/4491
2021-05-12[rubygems/rubygems] capture_output will return empty string, not nilHiroshi SHIBATA
https://github.com/rubygems/rubygems/commit/3fa93f6144 Notes: Merged: https://github.com/ruby/ruby/pull/4491
2021-05-12[rubygems/rubygems] Fixed variable scope at test_silent_systemHiroshi SHIBATA
https://github.com/rubygems/rubygems/commit/bfcdf79657 Notes: Merged: https://github.com/ruby/ruby/pull/4491
2021-05-12[rubygems/rubygems] Import capture_subprocess_io from minitestHiroshi SHIBATA
https://github.com/rubygems/rubygems/commit/8b2ca6df3a Notes: Merged: https://github.com/ruby/ruby/pull/4491
2021-05-12[rubygems/rubygems] Rewrite with capture_outputHiroshi SHIBATA
https://github.com/rubygems/rubygems/commit/a091004ded Notes: Merged: https://github.com/ruby/ruby/pull/4491
2021-05-12[rubygems/rubygems] Use capture_output instead of capture_ioHiroshi SHIBATA
https://github.com/rubygems/rubygems/commit/c46185abe3 Notes: Merged: https://github.com/ruby/ruby/pull/4491
2021-05-12[rubygems/rubygems] Use assert_raise instead of assert_raisesHiroshi SHIBATA
https://github.com/rubygems/rubygems/commit/769e87f011 Notes: Merged: https://github.com/ruby/ruby/pull/4491
2021-05-12[rubygems/rubygems] Use dummy assertion for assert_httpsHiroshi SHIBATA
https://github.com/rubygems/rubygems/commit/64d843fe17 Notes: Merged: https://github.com/ruby/ruby/pull/4491
2021-05-12[rubygems/rubygems] Use capture_output instead of assert_silentHiroshi SHIBATA
https://github.com/rubygems/rubygems/commit/3225aab7f8 Notes: Merged: https://github.com/ruby/ruby/pull/4491
2021-05-12[rubygems/rubygems] Use capture_output instead of capture_io for test-unitHiroshi SHIBATA
https://github.com/rubygems/rubygems/commit/ab9c80d4cb Notes: Merged: https://github.com/ruby/ruby/pull/4491
2021-05-12[rubygems/rubygems] Use assert_path_exist and assert_path_not_exist instead ↵Hiroshi SHIBATA
of assert_path_exists and refute_path_exists https://github.com/rubygems/rubygems/commit/a7c93558c3 Notes: Merged: https://github.com/ruby/ruby/pull/4491
2021-05-12[rubygems/rubygems] Extract assert_output to assert_empty and assert_equal ↵Hiroshi SHIBATA
with capture_output https://github.com/rubygems/rubygems/commit/f6759440a4 Notes: Merged: https://github.com/ruby/ruby/pull/4491
2021-05-12[rubygems/rubygems] Use Regexp with refute_matchHiroshi SHIBATA
https://github.com/rubygems/rubygems/commit/51fdbe53bc Notes: Merged: https://github.com/ruby/ruby/pull/4491
2021-05-12[rubygems/rubygems] Also use capture_output instead of capture_ioHiroshi SHIBATA
https://github.com/rubygems/rubygems/commit/229858ea56 Notes: Merged: https://github.com/ruby/ruby/pull/4491
2021-05-12[rubygems/rubygems] Use capture_output instead of capture_io.Hiroshi SHIBATA
https://github.com/rubygems/rubygems/commit/ad9206d4d0 Notes: Merged: https://github.com/ruby/ruby/pull/4491
2021-05-12[rubygems/rubygems] Use test-unit instead of minitestHiroshi SHIBATA
https://github.com/rubygems/rubygems/commit/a8571524ad Notes: Merged: https://github.com/ruby/ruby/pull/4491
2021-05-12skip test for debug.Koichi Sasada
test_memsize_of_iseq fails on repeat tests and it seems to difficult to solve immediately. Now this test is skipped. It seems that the result of `memsize_of(Object.new)` are increased. Why...?
2021-05-12suppress warnings on repeat tests.Koichi Sasada
Constant definitions are affect on outer namespace of an anonymous module. To define constants on the anonymous module, this patch uses Module#class_eval(str).
2021-05-12test_cdhash: refactor change class卜部昌平
It is now strange to test Complex in a class named Rational_Test. Notes: Merged: https://github.com/ruby/ruby/pull/4469
2021-05-12cdhash_cmp: should use ||卜部昌平
cf: https://github.com/ruby/ruby/pull/4469#discussion_r628386707
2021-05-12cdhash_cmp: recursively apply卜部昌平
For instance a rational's numerator can be a bignum. Comparison using C's == can be insufficient. Notes: Merged: https://github.com/ruby/ruby/pull/4469
2021-05-12cdhash_cmp: can also take complex卜部昌平
There are complex literals `123i`, which can also be a case condition. Notes: Merged: https://github.com/ruby/ruby/pull/4469
2021-05-12cdhash_cmp: rational literals with fractions卜部昌平
Nobu kindly pointed out that rational literals can have fractions. Notes: Merged: https://github.com/ruby/ruby/pull/4469
2021-05-12cdhash_cmp: can take rational literals卜部昌平
Rational literals are those integers suffixed with `r`. They tend to be a part of more complex expressions like `123/456r`, but in theory they can live alone. When such "bare" rational literals are passed to case-when branch, we have to take care of them. Fixes [Bug #17854] Notes: Merged: https://github.com/ruby/ruby/pull/4469
2021-05-12[ruby/net-ftp] Bump version to 0.1.2Shugo Maeda
https://github.com/ruby/net-ftp/commit/895ba44b3c
2021-05-11Update keyword argument description in method syntax guideJeremy Evans
Remove discussion of Ruby 2.7 specific handling of keyword argument separation. Add a small example of keyword to positional hash conversion for methods not accepting keyword arguments.
2021-05-11Run nmake check on Actions (#4487)Takashi Kokubun
* Run nmake check on Actions * Skip tests not working in mswin GitHub Actions * Override TEMP * Revert "Skip tests not working in mswin GitHub Actions" This reverts commit 544d2575fcdf23ae63cd25aa03fce10c28b259f2. * Revert "Revert "Skip tests not working in mswin GitHub Actions"" This reverts commit e1f8ad7862c9c4be52dc6e1031a004621eb07e6e. * Fix timeouts * Skip some more broken tests * Update windows.yml * Add a guard for rbasic_spec * Revert "Update windows.yml" This reverts commit bc9694b6b3b9594d406378d15ca11723fb052bc8. * Skip the ensure clause * Simplify the ensure Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2021-05-11Revert "Filling cache values on cvar write"Aaron Patterson
This reverts commit 08de37f9fa3469365e6b5c964689ae2bae0eb9f3. This reverts commit e8ae922b62adb00a80d3d4c49f7d7b0e6026eaba.
2021-05-11Filling cache values on cvar writeeileencodes
Instead of on read. Once it's in the inline cache we never have to make one again. We want to eventually put the value into the cache, and the best opportunity to do that is when you write the value. Notes: Merged: https://github.com/ruby/ruby/pull/4340
2021-05-11Add a cache for class variableseileencodes
This change implements a cache for class variables. Previously there was no cache for cvars. Cvar access is slow due to needing to travel all the way up th ancestor tree before returning the cvar value. The deeper the ancestor tree the slower cvar access will be. The benefits of the cache are more visible with a higher number of included modules due to the way Ruby looks up class variables. The benchmark here includes 26 modules and shows with the cache, this branch is 6.5x faster when accessing class variables. ``` compare-ruby: ruby 3.1.0dev (2021-03-15T06:22:34Z master 9e5105ca45) [x86_64-darwin19] built-ruby: ruby 3.1.0dev (2021-03-15T12:12:44Z add-cache-for-clas.. c6be0093ae) [x86_64-darwin19] | |compare-ruby|built-ruby| |:--------|-----------:|---------:| |vm_cvar | 5.681M| 36.980M| | | -| 6.51x| ``` Benchmark.ips calling `ActiveRecord::Base.logger` from within a Rails application. ActiveRecord::Base.logger has 71 ancestors. The more ancestors a tree has, the more clear the speed increase. IE if Base had only one ancestor we'd see no improvement. This benchmark is run on a vanilla Rails application. Benchmark code: ```ruby require "benchmark/ips" require_relative "config/environment" Benchmark.ips do |x| x.report "logger" do ActiveRecord::Base.logger end end ``` Ruby 3.0 master / Rails 6.1: ``` Warming up -------------------------------------- logger 155.251k i/100ms Calculating ------------------------------------- ``` Ruby 3.0 with cvar cache / Rails 6.1: ``` Warming up -------------------------------------- logger 1.546M i/100ms Calculating ------------------------------------- logger 14.857M (± 4.8%) i/s - 74.198M in 5.006202s ``` Lastly we ran a benchmark to demonstate the difference between master and our cache when the number of modules increases. This benchmark measures 1 ancestor, 30 ancestors, and 100 ancestors. Ruby 3.0 master: ``` Warming up -------------------------------------- 1 module 1.231M i/100ms 30 modules 432.020k i/100ms 100 modules 145.399k i/100ms Calculating ------------------------------------- 1 module 12.210M (± 2.1%) i/s - 61.553M in 5.043400s 30 modules 4.354M (± 2.7%) i/s - 22.033M in 5.063839s 100 modules 1.434M (± 2.9%) i/s - 7.270M in 5.072531s Comparison: 1 module: 12209958.3 i/s 30 modules: 4354217.8 i/s - 2.80x (± 0.00) slower 100 modules: 1434447.3 i/s - 8.51x (± 0.00) slower ``` Ruby 3.0 with cvar cache: ``` Warming up -------------------------------------- 1 module 1.641M i/100ms 30 modules 1.655M i/100ms 100 modules 1.620M i/100ms Calculating ------------------------------------- 1 module 16.279M (± 3.8%) i/s - 82.038M in 5.046923s 30 modules 15.891M (± 3.9%) i/s - 79.459M in 5.007958s 100 modules 16.087M (± 3.6%) i/s - 81.005M in 5.041931s Comparison: 1 module: 16279458.0 i/s 100 modules: 16087484.6 i/s - same-ish: difference falls within error 30 modules: 15891406.2 i/s - same-ish: difference falls within error ``` Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org> Notes: Merged: https://github.com/ruby/ruby/pull/4340
2021-05-12* 2021-05-12 [ci skip]git
2021-05-11Method cache: fix refinement entry handlingAlan Wu
To invalidate some callable method entries, we replace the entry in the class. Most types of method entries are on the method table of the origin class, but refinement entries without an orig_me are housed in the method table of the class itself. They are there because refinements take priority over prepended methods. By unconditionally inserting a copy of the refinement entry into the origin class, clearing the method cache created situations where there are refinement entry duplicates in the lookup chain, leading to infinite loops and other problems. Update the replacement logic to use the right class that houses the method entry. Also, be more selective about cache invalidation when moving refinement entries for prepend. This avoids calling clear_method_cache_by_id_in_class() before refinement entries are in the place it expects. [Bug #17806] Notes: Merged: https://github.com/ruby/ruby/pull/4386 Merged-By: XrXr