summaryrefslogtreecommitdiff
path: root/test/ruby
AgeCommit message (Collapse)Author
2024-10-16Fix memory leak in syntax error in prismPeter Zhu
If there is a syntax error, there could be an ast_node in the result. This could get leaked if there is a syntax error so parsing could not complete (parsed is not set to true). For example, the following script leaks memory: 10.times do 10_000.times do eval("def foo(...) super(...) {}; end") rescue SyntaxError end puts `ps -o rss= -p #{$$}` end Before: 31328 42768 53856 65120 76208 86768 97856 109120 120208 131296 After: 20944 20944 20944 20944 20944 20944 20944 20944 20944 20944 Notes: Merged: https://github.com/ruby/ruby/pull/11901
2024-10-16RubyVM::InstructionSequence.of Thread::Backtrace::LocationKevin Newton
This would be useful for debugging. Notes: Merged: https://github.com/ruby/ruby/pull/11896
2024-10-16Skip GC compaction tests in test_yjit.rb when not supportedPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/11905
2024-10-15Remove a puts in test_finalizer_thread_raisePeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/11883
2024-10-14[Bug #20797] Check seconds in UTC offset as well as minutesNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/11892
2024-10-11Rename supports_auto_compact? to supports_compact?Peter Zhu
It's testing whether GC compaction is supported in general. Notes: Merged: https://github.com/ruby/ruby/pull/11885
2024-10-11Used respond_to? check for compaction in test_gc_compact.rbPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/11885
2024-10-11Remove defined check for GC.config in test_gc.rbPeter Zhu
GC.config is always defined. Notes: Merged: https://github.com/ruby/ruby/pull/11867
2024-10-10Fix typo in test_gc.rb [ci skip]Peter Zhu
2024-10-10Revert "TestProcess#test_daemon_noclose is only working with macOS 15.1 ↵Yuta Saito
beta, we should skip with macOS 15.0" This reverts commit 3830bca5edd6964131971866c80107c89fac5362. Notes: Merged: https://github.com/ruby/ruby/pull/11849
2024-10-10Suppress warnings with `RUBYPOT=-w`Nobuyoshi Nakada
``` -:3: warning: assigned but unused variable - var -:3: warning: assigned but unused variable - var -:3: warning: assigned but unused variable - var -:3: warning: assigned but unused variable - var -:3: warning: assigned but unused variable - var -:3: warning: assigned but unused variable - var ```
2024-10-10Emit warning for other method redefinition typesThomas Marshall
This commit ensures warnings about `object_id` and `__send__` method redefinitions are emitted for other method types such as aliases, procs, and attr readers—anything except C functions.
2024-10-09[Bug #20789] Fix an invalid syntax error when `->a=1...{}`ydah
https://bugs.ruby-lang.org/issues/20789 Notes: Merged: https://github.com/ruby/ruby/pull/11850
2024-10-07[Bug #20787] Check the separator in `IO#readline` as well as 3.2Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/11811
2024-10-05[Bug #20705] Update `strtod` implementationNobuyoshi Nakada
The absence of either the integer or fractional part should be allowed. Notes: Merged: https://github.com/ruby/ruby/pull/11807
2024-10-04Fix intermediate array off-by-one errorKevin Newton
Co-authored-by: Adam Hess <HParker@github.com> Notes: Merged: https://github.com/ruby/ruby/pull/11800
2024-10-03Rename size_pool -> heapMatt Valentine-House
Now that we've inlined the eden_heap into the size_pool, we should rename the size_pool to heap. So that Ruby contains multiple heaps, with different sized objects. The term heap as a collection of memory pages is more in memory management nomenclature, whereas size_pool was a name chosen out of necessity during the development of the Variable Width Allocation features of Ruby. The concept of size pools was introduced in order to facilitate different sized objects (other than the default 40 bytes). They wrapped the eden heap and the tomb heap, and some related state, and provided a reasonably simple way of duplicating all related concerns, to provide multiple pools that all shared the same structure but held different objects. Since then various changes have happend in Ruby's memory layout: * The concept of tomb heaps has been replaced by a global free pages list, with each page having it's slot size reconfigured at the point when it is resurrected * the eden heap has been inlined into the size pool itself, so that now the size pool directly controls the free_pages list, the sweeping page, the compaction cursor and the other state that was previously being managed by the eden heap. Now that there is no need for a heap wrapper, we should refer to the collection of pages containing Ruby objects as a heap again rather than a size pool Notes: Merged: https://github.com/ruby/ruby/pull/11771
2024-10-03Make Object#singleton_method return methods in modules included in or ↵Jeremy Evans
prepended to singleton class To simplify the implementation, this makes Object#singleton_method call the same method called by Object#method (rb_obj_method), then check that the returned Method is defined before the superclass of the object's singleton class. To keep the same error messages, it rescues exceptions raised by rb_obj_method, and then raises its own exception. Fixes [Bug #20620] Notes: Merged: https://github.com/ruby/ruby/pull/11605
2024-10-03Add `IO::Buffer` tests for read and write with length & offset. (#11779)Samuel Williams
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2024-10-03Update ruby test for colon-style hash inspecttompng
Notes: Merged: https://github.com/ruby/ruby/pull/10924
2024-10-03Hash#inspect with colon styletompng
Notes: Merged: https://github.com/ruby/ruby/pull/10924
2024-10-01[Bug #20764] Refactor argument forwarding in lambdaNobuyoshi Nakada
Reject argument forwarding in lambda: - without parentheses - after optional argument(s) Notes: Merged: https://github.com/ruby/ruby/pull/11751
2024-10-01[Bug #20755] Frozen string should not be writable via IO::BufferNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/11738
2024-10-01Fix compile issue with a short-circuited if/unless condition and `defined?`Luke Gruber
This caused an issue when `defined?` was in the `if` condition. Its instructions weren't appended to the instruction sequence even though it was compiled if a compile-time known logical short-circuit happened before the `defined?`. The catch table entry (`defined?` compilation produces a catch table entry) was still on the iseq even though the instructions weren't there. This caused faulty exception handling in the method. The solution is to no add the catch table entry for `defined?` after a compile-time known logical short circuit. This shouldn't touch much code, it's only for cases like the following, which can occur during debugging: if false && defined?(Some::CONSTANT) "more code..." end Fixes [Bug #20501] Notes: Merged: https://github.com/ruby/ruby/pull/11554
2024-09-30[Bug #20752] Slice of readonly `IO::Buffer` also should be readonlyNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/11735
2024-09-30Implement SPLAT NODE keyword locationsydah
Notes: Merged: https://github.com/ruby/ruby/pull/11673
2024-09-28Allow dot3 in defs singletontompng
Notes: Merged: https://github.com/ruby/ruby/pull/11716
2024-09-28Implement OP_ASGN2 NODE locationsydah
Notes: Merged: https://github.com/ruby/ruby/pull/11702
2024-09-28[Bug #20763] Add testsNobuyoshi Nakada
2024-09-27Implement OP_ASGN1 NODE locationsydah
Notes: Merged: https://github.com/ruby/ruby/pull/11701
2024-09-25TestProcess#test_daemon_noclose is only working with macOS 15.1 beta, we ↵Hiroshi SHIBATA
should skip with macOS 15.0
2024-09-25Implement BLOCK_PASS NODE keyword locationsydah
Notes: Merged: https://github.com/ruby/ruby/pull/11663
2024-09-25Implement RETURN NODE keyword locationsydah
Notes: Merged: https://github.com/ruby/ruby/pull/11589
2024-09-24Windows: Use Unicode aware WinAPI function for ENV[]=Lars Kanis
This only makes a difference when setting an empty value to a Unicode key. Notes: Merged: https://github.com/ruby/ruby/pull/7034
2024-09-23Implement CASE3 NODE keyword locationsydah
Notes: Merged: https://github.com/ruby/ruby/pull/11661
2024-09-23Implement CASE2 NODE keyword locationsydah
Notes: Merged: https://github.com/ruby/ruby/pull/11661
2024-09-23Implement CASE NODE keyword locationsydah
Notes: Merged: https://github.com/ruby/ruby/pull/11661
2024-09-21Make Complex#{inspect,to_s} work correctly if real part #inspect returns ↵Jeremy Evans
frozen string Make static f_format function take a non-frozen string to append to. This does not result in an additional allocation for #inspect, but it does result in an additional allocation for #to_s. Fixes [Bug #20337] Notes: Merged: https://github.com/ruby/ruby/pull/11657
2024-09-20[Bug #18651] Pass undefined region in CP51932 as is to CP50220Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/5696
2024-09-19Fix method caching bug when including/prepend module A that prepends module BJeremy Evans
Fix by always adding the generated iclass to the subclasses list, otherwise the method cache for the iclass is not cleared when the method in the module is overwritten. Fixes [Bug #20716] Notes: Merged: https://github.com/ruby/ruby/pull/11582
2024-09-18Raise a compile error for break/next/redo inside eval in cases where it is ↵Jeremy Evans
optimized away In cases where break/next/redo are not valid syntax, they should raise a SyntaxError even if inside a conditional block that is optimized away. Fixes [Bug #20597] Co-authored-by: Kevin Newton <kddnewton@gmail.com> Notes: Merged: https://github.com/ruby/ruby/pull/11099 Merged-By: jeremyevans <code@jeremyevans.net>
2024-09-18Fix evaluation order issue in f(**h, &h.delete(key))Jeremy Evans
Previously, this would delete the key in `h` before keyword splatting `h`. This goes against how ruby handles `f(*a, &a.pop)` and similar expressions. Fix this by having the compiler check whether the block pass expression is safe. If it is not safe, then dup the keyword splatted hash before evaluating the block pass expression. For expression: `h=nil; f(**h, &h.delete(:key))` VM instructions before: ``` 0000 putnil ( 1)[Li] 0001 setlocal_WC_0 h@0 0003 putself 0004 getlocal_WC_0 h@0 0006 getlocal_WC_0 h@0 0008 putobject :key 0010 opt_send_without_block <calldata!mid:delete, argc:1, ARGS_SIMPLE> 0012 splatkw 0013 send <calldata!mid:f, argc:1, ARGS_BLOCKARG|FCALL|KW_SPLAT>, nil 0016 leave ``` VM instructions after: ``` 0000 putnil ( 1)[Li] 0001 setlocal_WC_0 h@0 0003 putself 0004 putspecialobject 1 0006 newhash 0 0008 getlocal_WC_0 h@0 0010 opt_send_without_block <calldata!mid:core#hash_merge_kwd, argc:2, ARGS_SIMPLE> 0012 getlocal_WC_0 h@0 0014 putobject :key 0016 opt_send_without_block <calldata!mid:delete, argc:1, ARGS_SIMPLE> 0018 send <calldata!mid:f, argc:1, ARGS_BLOCKARG|FCALL|KW_SPLAT|KW_SPLAT_MUT>, nil 0021 leave ``` This is the same as 07d3bf4832532ae7446c9a6924d79aed60a7a9a5, except that it removes unnecessary hash allocations when using the prism compiler. Fixes [Bug #20640] Notes: Merged: https://github.com/ruby/ruby/pull/11645 Merged-By: jeremyevans <code@jeremyevans.net>
2024-09-18Revert "Fix evaluation order issue in f(**h, &h.delete(key))"Jeremy Evans
This reverts commit 07d3bf4832532ae7446c9a6924d79aed60a7a9a5. No failures in the pull request CI, but there are now allocation test failures.
2024-09-18Fix evaluation order issue in f(**h, &h.delete(key))Jeremy Evans
Previously, this would delete the key in h before keyword splatting h. This goes against how ruby handles f(*a, &a.pop) and similar expressions. Fix this by having the compiler check whether the block pass expression is safe. If it is not safe, then dup the keyword splatted hash before evaluating the block pass expression. For expression: `h=nil; f(**h, &h.delete(:key))` VM instructions before: ``` 0000 putnil ( 1)[Li] 0001 setlocal_WC_0 h@0 0003 putself 0004 getlocal_WC_0 h@0 0006 getlocal_WC_0 h@0 0008 putobject :key 0010 opt_send_without_block <calldata!mid:delete, argc:1, ARGS_SIMPLE> 0012 splatkw 0013 send <calldata!mid:f, argc:1, ARGS_BLOCKARG|FCALL|KW_SPLAT>, nil 0016 leave ``` VM instructions after: ``` 0000 putnil ( 1)[Li] 0001 setlocal_WC_0 h@0 0003 putself 0004 putspecialobject 1 0006 newhash 0 0008 getlocal_WC_0 h@0 0010 opt_send_without_block <calldata!mid:core#hash_merge_kwd, argc:2, ARGS_SIMPLE> 0012 getlocal_WC_0 h@0 0014 putobject :key 0016 opt_send_without_block <calldata!mid:delete, argc:1, ARGS_SIMPLE> 0018 send <calldata!mid:f, argc:1, ARGS_BLOCKARG|FCALL|KW_SPLAT|KW_SPLAT_MUT>, nil 0021 leave ``` Fixes [Bug #20640] Notes: Merged: https://github.com/ruby/ruby/pull/11206 Merged-By: jeremyevans <code@jeremyevans.net>
2024-09-18Prevent a warning (retry)Yusuke Endoh
``` test/ruby/test_case.rb:75: warning: 'when' clause on line 75 duplicates 'when' clause on line 75 and is ignored ```
2024-09-17YJIT: Accept key for runtime_stats to return only that stat (#11536)Randy Stauner
Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2024-09-17Replace all GC.disable with EnvUtil.without_gcPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/11635
2024-09-17Fix a typo, sorry!Yusuke Endoh
2024-09-17Prevent two warningsYusuke Endoh
``` /home/chkbuild/chkbuild/tmp/build/20240917T123003Z/ruby/test/ruby/test_case.rb:73: warning: 'when' clause on line 73 duplicates 'when' clause on line 73 and is ignored /home/chkbuild/chkbuild/tmp/build/20240917T123003Z/ruby/test/ruby/test_syntax.rb:333: warning: key :k1 is duplicated and overwritten on line 333 ```
2024-09-17TestProcess#test_daemon_noclose is working fine with macOS 15.1 beta3 and ↵Hiroshi SHIBATA
Xcode 16 RC