summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2019-10-21[Bug #16121] adjusted indent [ci skip]Nobuyoshi Nakada
2019-10-21Stop making a redundant hash copy in Hash#dup (#2489)Dylan Thacker-Smith
* Stop making a redundant hash copy in Hash#dup It was making a copy of the hash without rehashing, then created an extra copy of the hash to do the rehashing. Since rehashing creates a new copy already, this change just uses that rehashing to make the copy. [Bug #16121] * Remove redundant Check_Type after to_hash * Fix freeing and clearing destination hash in Hash#initialize_copy The code was assuming the state of the destination hash based on the source hash for clearing any existing table on it. If these don't match, then that can cause the old table to be leaked. This can be seen by compiling hash.c with `#define HASH_DEBUG 1` and running the following script, which will crash from a debug assertion. ```ruby h = 9.times.map { |i| [i, i] }.to_h h.send(:initialize_copy, {}) ``` * Remove dead code paths in rb_hash_initialize_copy Given that `RHASH_ST_TABLE_P(h)` is defined as `(!RHASH_AR_TABLE_P(h))` it shouldn't be possible for a hash to be neither of these, so there is no need for the removed `else if` blocks. * Share implementation between Hash#replace and Hash#initialize_copy This also fixes key rehashing for small hashes backed by an array table for Hash#replace. This used to be done consistently in ruby 2.5.x, but stopped being done for small arrays in ruby 2.6.x. This also bring optimization improvements that were done for Hash#initialize_copy to Hash#replace. * Add the Hash#dup benchmark
2019-10-21add a NEWS entry about [Feature #15602]Koichi Sasada
2019-10-21Pass the called keyword arguments if `keyword_init`Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/2582
2019-10-21* expand tabs. [ci skip]git
Tabs were expanded because previously the file did not have any tab indentation. Please update your editor config, and use misc/expand_tabs.rb in the pre-commit hook.
2019-10-21Look up event ID offsets by token as indexNobuyoshi Nakada
2019-10-21st: Do error check only on non-RubyK.Takata
Notes: Merged: https://github.com/ruby/ruby/pull/2304
2019-10-21st: Add NULL checkingK.Takata
These are found by Coverity. Notes: Merged: https://github.com/ruby/ruby/pull/2304
2019-10-21Make suggestions order stable [Bug #16263]Nobuyoshi Nakada
As the result order of `DidYouMean::SpellChecker#correct` is undefined, keep the order of the original candidates.
2019-10-21test/optparse/test_did_you_mean.rb - fix suggestion orderMSP-Greg
Notes: Merged: https://github.com/ruby/ruby/pull/2581
2019-10-21DidYouMean can be an empty stub module [Bug #16263]Nobuyoshi Nakada
2019-10-21* 2019-10-21 [ci skip]git
2019-10-21test_exception - fix with & w/o did_you_meanMSP-Greg
See Ruby issue 16263 Notes: Merged: https://github.com/ruby/ruby/pull/2577
2019-10-20Also BDOT2 and BDOT3 are operatorsNobuyoshi Nakada
2019-10-20show BASERUBY version at configure.Koichi Sasada
2019-10-20Native MonitorMixin::ConditionVariable#waitKoichi Sasada
MonitorMixin::ConditionVariable#wait can be interrupted just after Monitor#exit_for_cond. So implementation in C.
2019-10-20delegate synchronize methodKoichi Sasada
Delegate MonitorMixin#synchronize body to Monitor#synchronize. It makes guarantee interrupt safe (because Monitor#synchronize is written in C). I thought Ruby implementation is also safe, but I got stuck failure <http://ci.rvm.jp/results/trunk_test@P895/2327639> so that I introduce this fix to guarantee interrupt safe.
2019-10-20make monitor.so for performance. (#2576)Koichi Sasada
Recent monitor.rb has performance problem because of interrupt handlers. 'Monitor#synchronize' is frequently used primitive so the performance of this method is important. This patch rewrite 'monitor.rb' with 'monitor.so' (C-extension) and make it faster. See [Feature #16255] for details. Monitor class objects are normal object which include MonitorMixin. This patch introduce a Monitor class which is implemented on C and MonitorMixin uses Monitor object as re-entrant (recursive) Mutex. This technique improve performance because we don't need to care atomicity and we don't need accesses to instance variables any more on Monitor class. Notes: Merged-By: ko1 <[email protected]>
2019-10-20* 2019-10-20 [ci skip]git
2019-10-20Fixed a typo [ci skip]Nobuyoshi Nakada
2019-10-19Extend Ripper DSL to set to pseudo variables other than `$$`Nobuyoshi Nakada
2019-10-18appveyor.yml - MinGW - update for MSYS2 / Mingw-w64 (#2573)MSP-Greg
MSYS source code comes from both gcc.gnu.org & Mingw-w64. Updates to the Mingw-w64 source broke the MinGW build step. Fixes the issue until Mingw-w64 updates their source, then it should be reverted, see comments in code.
2019-10-19* 2019-10-19 [ci skip]git
2019-10-19Fixed passing idNil as a SymbolNobuyoshi Nakada
2019-10-18Verbatim texts need more indent [ci skip]Nobuyoshi Nakada
And separate ruby script and executed example.
2019-10-18Use `_` instead of `_n_`Kazuhiro NISHIYAMA
2019-10-18NEWS: Mention that optparse now supports did_you_mean for unknown optionYusuke Endoh
2019-10-18Support DidYouMean by AmbiguousOption tooNobuyoshi Nakada
2019-10-18Defer adding additional info until getting the message of an errorNobuyoshi Nakada
2019-10-18Default DidYouMean.formatter to PlainFormatterNobuyoshi Nakada
2019-10-18Added no suggestion test caseNobuyoshi Nakada
2019-10-18Use DidYouMean.formatterNobuyoshi Nakada
Instead of building messages separately.
2019-10-18Suppress numbered parameter warningsNobuyoshi Nakada
2019-10-18Make weakmap finalizer an ifunc lambdaNobuyoshi Nakada
Simple comparison between proc/ifunc/method invocations: ``` proc 15.209M (± 1.6%) i/s - 76.138M in 5.007413s ifunc 15.195M (± 1.7%) i/s - 76.257M in 5.020106s method 9.836M (± 1.2%) i/s - 49.272M in 5.009984s ``` As `proc` and `ifunc` have no significant difference, chosen the latter for arity check.
2019-10-18Use identhash as WeakMapNobuyoshi Nakada
As ObjectSpace::WeakMap allows FLONUM as a key, needs the special deal for its hash. [Feature #16035]
2019-10-18lib/optparse.rb: Show a did_you_mean hint for unknown optionYusuke Endoh
``` require 'optparse' OptionParser.new do |opts| opts.on("-f", "--foo", "foo") {|v| } opts.on("-b", "--bar", "bar") {|v| } opts.on("-c", "--baz", "baz") {|v| } end.parse! ``` ``` $ ruby test.rb --baa Traceback (most recent call last): test.rb:7:in `<main>': invalid option: --baa (OptionParser::InvalidOption) Did you mean? baz bar ``` Notes: Merged: https://github.com/ruby/ruby/pull/2561
2019-10-17Fix warning of generated parser for nested moduleSeiei Miyagi
Notes: Merged: https://github.com/ruby/ruby/pull/2571
2019-10-17Remove unused constant.Aaron Patterson
This constant isn't used, so lets remove it.
2019-10-17Look up constant instead of caching in a globalAaron Patterson
The global can go bad if the compactor runs, so we need to look up the constant instead of caching it in a global.
2019-10-17Update test to handle x32 ABI compiled Ruby on LinuxJeremy Evans
Suggestion from Laurence Parry. Fixes [Bug #16030] Notes: Merged: https://github.com/ruby/ruby/pull/2572
2019-10-18Treat key sequences from getwch() that start from 0 or 0xE0 correctlyaycabta
2019-10-18Add numeric keypad key sequences on Windowsaycabta
2019-10-18Remove freezeaycabta
2019-10-18Ignore the input method key sequence from getwch() correctlyaycabta
The function getwch() returns some key sequences which start from 0 or 0xE0 with a following key code. Alt+` that is on/off key for input methods gives 0 and 41 so Reline was always ignoring 0 and following keys but numeric keypad keys give 0 and following actual keys. This commit changes the behavior to be ignoring only the 0 and 41 sequence.
2019-10-17Make circular argument reference a SyntaxError instead of a warningJeremy Evans
Fixes [Bug #10314] Notes: Merged: https://github.com/ruby/ruby/pull/2569
2019-10-18* 2019-10-18 [ci skip]git
2019-10-18Insert multiline incremental search result correctlyaycabta
2019-10-17[DOC] no change on Windows [Bug #15267] [ci skip]Nobuyoshi Nakada
2019-10-17Fixed File.extname at a name ending with a dotNobuyoshi Nakada
File.extname now returns a dot string at a name ending with a dot. [Bug #15267] Notes: Merged: https://github.com/ruby/ruby/pull/2565
2019-10-17* remove trailing spaces. [ci skip]git