summaryrefslogtreecommitdiff
path: root/test/ruby
AgeCommit message (Collapse)Author
2023-02-24YJIT: Generate Block::entry_exit with block entry PCAlan Wu
Previously, when Block::entry_exit is requested from any instruction that is not the first one in the block, we generated the exit with an incorrect PC. We should always be using the PC for the entry of the block for Block::entry_exit. It was a simple typo. The bug was [introduced][1] while we were refactoring to use the current backend. Later, we had a chance to spot this issue while [preparing][2] to enable unused variable warnings, but didn't spot the issue. Fixes [Bug #19463] [1]: 27fcab995e6dde19deb91dc6e291bdb72100af68 [2]: 31461c7e0eab4963ccc8649ea8ebf27979132c0c Notes: Merged: https://github.com/ruby/ruby/pull/7374 Merged-By: XrXr
2023-02-23Implement ObjectSpace::WeakKeyMap basic allocatorJean Boussier
[Feature #18498] Notes: Merged: https://github.com/ruby/ruby/pull/5570
2023-02-21Add marking and sweeping time to GC.statPeter Zhu
There is a `time` key in GC.stat that gives us the total time spent in GC. However, we don't know what proportion of the time is spent between marking and sweeping. This makes it difficult to tune the GC as we're not sure where to focus our efforts on. This PR adds keys `marking_time` and `sweeping_time` to GC.stat for the time spent marking and sweeping, in milliseconds. [Feature #19437] Notes: Merged: https://github.com/ruby/ruby/pull/7304
2023-02-20YJIT: Fix assertion for partially mapped last pages (#7337)Takashi Kokubun
Follows up [Bug #19400] Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2023-02-20Update some tests for the new message format of NoMethodErrorYusuke Endoh
Notes: Merged: https://github.com/ruby/ruby/pull/6950
2023-02-17[Bug#19445] Fix keyword splat in enumeratorNobuyoshi Nakada
Extracted arguments do not have keyword hash to splat. Notes: Merged: https://github.com/ruby/ruby/pull/7325 Merged-By: nobu <nobu@ruby-lang.org>
2023-02-16YJIT: Fix false assumption that String#+@ => ::StringAlan Wu
Could return a subclass. [Bug #19444] Notes: Merged: https://github.com/ruby/ruby/pull/7328
2023-02-16YJIT: jit_prepare_routine_call() for String#+@ missingAlan Wu
We saw SEGVs due to this when running with StackProf, which needs a correct PC for RUBY_INTERNAL_EVENT_NEWOBJ, the same event used for ObjectSpace allocation tracing. [Bug #19444] Notes: Merged: https://github.com/ruby/ruby/pull/7328
2023-02-15Fix removing ivars from clases and modules.Haldun Bayhantopcu
Co-authored-by: Adam Hess <hparker@github.com> Notes: Merged: https://github.com/ruby/ruby/pull/7314
2023-02-14[Bug #19259] `Data#with` should call `initialize` methodNobuyoshi Nakada
2023-02-10use correct svar even if env is escapedKoichi Sasada
This patch is follo-up of 0a82bfe. Without this patch, if env is escaped (Proc'ed), strange svar can be touched. This patch tracks escaped env and use it. Notes: Merged: https://github.com/ruby/ruby/pull/7282
2023-02-09Copy cvar table on cloneeileencodes
When a class with a class variable is cloned we need to also copy the cvar cache table from the original table to the clone. I found this bug while working on fixing [Bug #19379]. While this does not fix that bug directly it is still a required change to fix another bug revealed by the fix in https://github.com/ruby/ruby/pull/7265 This needs to be backported to 3.2.x and 3.1.x. Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org> Notes: Merged: https://github.com/ruby/ruby/pull/7275
2023-02-09[Bug #19426] Fix endless `Range#step` with `#succ` methodNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/7277
2023-02-08Only emit circular dependency warning for owned thread shieldsJean byroot Boussier
[Bug #19415] If multiple threads attemps to load the same file concurrently it's not a circular dependency issue. So we check that the existing ThreadShield is owner by the current fiber before warning about circular dependencies. Notes: Merged: https://github.com/ruby/ruby/pull/7257
2023-02-08Add RUBY_GC_HEAP_INIT_SIZE_%d_SLOTS to pre-init pools granularlyJean Boussier
The old RUBY_GC_HEAP_INIT_SLOTS isn't really usable anymore as it initalize all the pools by the same factor, but it's unlikely that pools will need similar sizes. In production our 40B pool is 5 to 6 times bigger than our 80B pool. Notes: Merged: https://github.com/ruby/ruby/pull/7235
2023-02-07Use more agressive RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR for GC testsJean Boussier
Notes: Merged: https://github.com/ruby/ruby/pull/7263
2023-02-06Revert "Only emit circular dependency warning for owned thread shields"Jean byroot Boussier
This reverts commit fa49651e05a06512e18ccb2f54a7198c9ff579de. Notes: Merged: https://github.com/ruby/ruby/pull/7256
2023-02-06Only emit circular dependency warning for owned thread shieldsJean Boussier
[Bug #19415] If multiple threads attemps to load the same file concurrently it's not a circular dependency issue. So we check that the existing ThreadShield is owner by the current fiber before warning about circular dependencies. Notes: Merged: https://github.com/ruby/ruby/pull/7252
2023-02-06Limit maximum number of IVs on a shape on T_OBJECTSJemma Issroff
Create SHAPE_MAX_NUM_IVS (currently 50) and limit all shapes of T_OBJECTS to that number of IVs. When a shape with a T_OBJECT has more than 50 IVs, fall back to the obj_too_complex shape which uses hash lookup for ivs. Note that a previous version of this commit 78fcc9847a9db6d42c8c263154ec05903a370b6b was reverted in 88f2b94065be3fcd6769a3f132cfee8ecfb663b8 because it did not account for non-T_OBJECTS Notes: Merged: https://github.com/ruby/ruby/pull/7188
2023-02-01Add a test for svar #7225 (#7228)Takashi Kokubun
Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2023-02-01[Bug #19398] Memory leak in WeakMapPeter Zhu
There's a memory leak in ObjectSpace::WeakMap due to not freeing the `struct weakmap`. It can be seen in the following script: ``` 100.times do 10000.times do ObjectSpace::WeakMap.new end # Output the Resident Set Size (memory usage, in KB) of the current Ruby process puts `ps -o rss= -p #{$$}` end ``` Notes: Merged: https://github.com/ruby/ruby/pull/7223
2023-01-31YJIT: Fix BorrowMutError on BOP invalidation (#7212)Takashi Kokubun
Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-01-30YJIT: Fix BorrowMutError on GC.compact (#7176)Takashi Kokubun
YJIT: Fix BorrowMutError Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2023-01-30Fix parsing of regexps that toggle extended mode on/off inside regexpJeremy Evans
This was broken in ec3542229b29ec93062e9d90e877ea29d3c19472. That commit didn't handle cases where extended mode was turned on/off inside the regexp. There are two ways to turn extended mode on/off: ``` /(?-x:#y)#z /x =~ '#y' /(?-x)#y(?x)#z /x =~ '#y' ``` These can be nested inside the same regexp: ``` /(?-x:(?x)#x (?-x)#y)#z /x =~ '#y' ``` As you can probably imagine, this makes handling these regexps somewhat complex. Due to the nesting inside portions of regexps, the unassign_nonascii function needs to be recursive. In recursive mode, it needs to track both opening and closing parentheses, similar to how it already tracked opening and closing brackets for character classes. When scanning the regexp and coming to `(?` not followed by `#`, scan for options, and use `x` and `i` to determine whether to turn on or off extended mode. For `:`, indicting only the current regexp section should have the extended mode switched, recurse with the extended mode set or unset. For `)`, indicating the remainder of the regexp (or current regexp portion if already recursing) should turn extended mode on or off, just change the extended mode flag and keep scanning. While testing this, I noticed that `a`, `d`, and `u` are accepted as options, in addition to `i`, `m`, and `x`, but I can't see where those options are documented. I'm not sure whether or not handling `a`, `d`, and `u` as options is a bug. Fixes [Bug #19379] Notes: Merged: https://github.com/ruby/ruby/pull/7192
2023-01-30bignum.c: rb_int_parse_cstr handle `0` stringsJean Boussier
[Bug #19390] We shouldn't check the string length when skipping zeros, as the string might only contains zero characters, resulting in an empty string. Notes: Merged: https://github.com/ruby/ruby/pull/7196
2023-01-24Add tests for variables in `END` block shared with the toplevelNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/7136
2023-01-22Fix Integer#ceildiv to respect #coerce (#7118)Kouhei Yanagita
Fixes [Bug #19343] Notes: Merged-By: mrkn <mrkn@ruby-lang.org>
2023-01-20[Feature #19314] Add new arguments of String#bytespliceShugo Maeda
bytesplice(index, length, str, str_index, str_length) -> string bytesplice(range, str, str_range) -> string In these forms, the content of +self+ is replaced by str.byteslice(str_index, str_length) or str.byteslice(str_range); however the substring of +str+ is not allocated as a new string. Notes: Merged: https://github.com/ruby/ruby/pull/7160
2023-01-19[ci skip] Add ticket label to testPeter Zhu
2023-01-19don't allow setting class variable on module that's frozen [Bug #19341]lukeg
Notes: Merged: https://github.com/ruby/ruby/pull/7124
2023-01-19String#bytesplice should return selfShugo Maeda
In Feature #19314, we concluded that the return value of String#bytesplice should be changed from the source string to the receiver, because the source string is useless and confusing when extra arguments are added. This change should be included in Ruby 3.2.1.
2023-01-17Change ArgumentError message when Comparable#clamp receives min value higher ↵Kaíque Kandy Koga
than max value Notes: Merged: https://github.com/ruby/ruby/pull/6802 Merged-By: jeremyevans <code@jeremyevans.net>
2023-01-17Fix crash when defining ivars on special constantsPeter Zhu
[Bug #19339] Notes: Merged: https://github.com/ruby/ruby/pull/7129
2023-01-15[Bug #19335] `Integer#remainder` should respect `#coerce` (#7120)Nobuyoshi Nakada
Also `Numeric#remainder` should. Notes: Merged-By: mrkn <mrkn@ruby-lang.org>
2023-01-13Remove MIN_PRE_ALLOC_SIZE from Strings.Matt Valentine-House
This optimisation is no longer helpful now that we use VWA to allocate strings in larger size pools where they can be embedded. Notes: Merged: https://github.com/ruby/ruby/pull/6965
2023-01-13Skip time-related assertions on /dev/nullNobuyoshi Nakada
2023-01-13Do not use VM stack for splat arg on cfuncKoichi Sasada
On the cfunc methods, if a splat argument is given, all array elements are expanded on the VM stack and it can cause SystemStackError. The idea to avoid it is making a hidden array to contain all parameters and use this array as an argv. This patch is reviesed version of https://github.com/ruby/ruby/pull/6816 The main change is all changes are closed around calling cfunc logic. Fixes [Bug #4040] Co-authored-by: Jeremy Evans <code@jeremyevans.net> Notes: Merged: https://github.com/ruby/ruby/pull/7109
2023-01-11Remove Encoding#replicateBenoit Daloze
Notes: Merged: https://github.com/ruby/ruby/pull/7079
2023-01-10YJIT: Save PC and SP before calling leaf builtins (#7090)Alan Wu
Previously, we did not update `cfp->sp` before calling the C function of ISEQs marked with `Primitive.attr! "inline"` (leaf builtins). This caused the GC to miss temporary values on the stack in case the function allocates and triggers a GC run. Right now, there is only a few leaf builtins in numeric.rb on Integer methods such as `Integer#~`. Since these methods only allocate when operating on big numbers, we missed this issue. Fix by saving PC and SP before calling the functions -- our usual protocol for calling C functions that may allocate on the GC heap. [Bug #19316] Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
2023-01-09Assert that resizing arrays will re-embed themPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/7071
2023-01-09Assert that resizing objects will re-embed themPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/7071
2023-01-09Fix re-embedding of strings during compactionPeter Zhu
The reference updating code for strings is not re-embedding strings because the code is incorrectly wrapped inside of a `if (STR_SHARED_P(obj))` clause. Shared strings can't be re-embedded so this ends up being a no-op. This means that strings can be moved to a large size pool during compaction, but won't be re-embedded, which would waste the space. Notes: Merged: https://github.com/ruby/ruby/pull/7071
2023-01-08[Bug #19323] Raise `RangeError` instead of integer overflowNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/7087 Merged-By: nobu <nobu@ruby-lang.org>
2023-01-06[Bug #19312] Return end-of-input at `__END__`Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/7077
2023-01-06Check if the argument is Thread::Backtrace::Location objectyui-knk
[Bug #19262] Notes: Merged: https://github.com/ruby/ruby/pull/7029
2023-01-05Raise an ArgumentError for unknown pack/unpack directiveBenoit Daloze
* [Bug #19150]
2023-01-04Fix crash in TracePoint c_call for removed methodPeter Zhu
trace_arg->id is the ID of the original method of an aliased method. If the original method is removed, then the lookup will fail. We should use trace_arg->called_id instead, which is the ID of the aliased method. Fixes [Bug #19305] Notes: Merged: https://github.com/ruby/ruby/pull/7064
2023-01-03YJIT: Fix `yield` into block with >=30 locals on ARMAlan Wu
It's a register spill issue. Fix by moving the Qnil fill snippet to after registers are released. [Bug #19299] Notes: Merged: https://github.com/ruby/ruby/pull/7059
2023-01-03Fix Error in GC Compaction specsMatt Valentine-House
Previously if any of the tests that move objects between size pools failed to move anything, then the call to stats.dig would return `nil` which would then cause assert_operator to error. This should be a test Failure, rather than an Error so this commit uses a default value of 0 if stats.dig fails to find a key. Also refactor object movement tests to use stats.dig, rather than :[] Notes: Merged: https://github.com/ruby/ruby/pull/6978
2023-01-02[Bug #19296] Precheck bits of time componentsNobuyoshi Nakada