summaryrefslogtreecommitdiff
path: root/test/ruby
AgeCommit message (Collapse)Author
2025-06-16ZJIT: Add support for putspecialobject (#13565)Stan Lo
* ZJIT: Add support for putspecialobject * Address feedback * Update tests * Adjust the indentation of a Ruby test --------- Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com> Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2025-06-16Use `success` option to check if the process failedNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/13624
2025-06-16Suppress stderr output in `TestRubyOptions#assert_segv`Nobuyoshi Nakada
It is checked against the given `list`, do not print the same output twice. Notes: Merged: https://github.com/ruby/ruby/pull/13624
2025-06-16Use the message given to `TestRubyOptions#assert_segv`Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/13624
2025-06-15Relax the criteria of flaky weak_references count testNobuyoshi Nakada
2025-06-15Simplify weak_references count test initializationNobuyoshi Nakada
Using an enumerator does not resolve the intermittent failures: 100+ failures in 10,000 iterations.
2025-06-15Implement COLON3 NODE locationsydah
Notes: Merged: https://github.com/ruby/ruby/pull/11987
2025-06-15Implement COLON2 NODE locationsydah
Notes: Merged: https://github.com/ruby/ruby/pull/11987
2025-06-14Skip test_exivar_resize_with_compaction_stress on s390xJohn Hawthorn
Notes: Merged: https://github.com/ruby/ruby/pull/13617
2025-06-13Fix generic_ivar_set_shape_field for table rebuildJohn Hawthorn
[Bug #21438] Previously GC could trigger a table rebuild of the generic fields st_table in the middle of calling the st_update callback. This could cause entries to be reallocated or rearranged and the update to be for the wrong entry. This commit adds an assertion to make that case easier to detect, and replaces the st_update with a separate st_lookup and st_insert. Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org> Co-authored-by: Jean Boussier <byroot@ruby-lang.org> Notes: Merged: https://github.com/ruby/ruby/pull/13589
2025-06-14Remove test_object_id_race_free_with_stress_compactJean Boussier
This test was written for another implementation of `#object_id` which had complex interations with GC, that's not the case of the implementation that was actually merged.
2025-06-13Fix a race condition in object_id for shareable objectsJean Boussier
If an object is shareable and has no capacity left, it isn't safe to store the object ID in fields as it requires an object resize which can't be done unless all field reads are synchronized. In this very specific case we create the object_id in advance, before the object is made shareable. Notes: Merged: https://github.com/ruby/ruby/pull/13609
2025-06-13test/ruby/test_ractor.rb: avoid outputting anythingJean Boussier
Notes: Merged: https://github.com/ruby/ruby/pull/13611
2025-06-13[Bug #21440] Stop caching member list in frozen Data/Struct classNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/13603
2025-06-12ZJIT: Write a callee frame on JIT-to-JIT calls (#13579)Takashi Kokubun
Co-authored-by: Max Bernstein <tekknolagi@gmail.com> Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2025-06-12Ensure crr->feature is an fstringJohn Hawthorn
Notes: Merged: https://github.com/ruby/ruby/pull/13531
2025-06-12[Bug #21439] Fix `PM_SPLAT_NODE` compilation error in for loops (#13597)Ufuk Kayserilioglu
[Bug #21439] Fix PM_SPLAT_NODE compilation error in for loops This commit fixes a crash that occurred when using splat nodes (*) as the index variable in for loops. The error "Unexpected node type for index in for node: PM_SPLAT_NODE" was thrown because the compiler didn't know how to handle splat nodes in this context. The fix allows code like `for *x in [[1,2], [3,4]]` to compile and execute correctly, where the splat collects each sub-array. Notes: Merged-By: eileencodes <eileencodes@gmail.com>
2025-06-12Make setting and accessing class ivars lock-freeJean Boussier
Now that class fields have been deletated to a T_IMEMO/class_fields when we're in multi-ractor mode, we can read and write class instance variable in an atomic way using Read-Copy-Update (RCU). Note when in multi-ractor mode, we always use RCU. In theory we don't need to, instead if we ensured the field is written before the shape is updated it would be safe. Benchmark: ```ruby Warning[:experimental] = false class Foo @foo = 1 @bar = 2 @baz = 3 @egg = 4 @spam = 5 class << self attr_reader :foo, :bar, :baz, :egg, :spam end end ractors = 8.times.map do Ractor.new do 1_000_000.times do Foo.bar + Foo.baz * Foo.egg - Foo.spam end end end if Ractor.method_defined?(:value) ractors.each(&:value) else ractors.each(&:take) end ``` This branch vs Ruby 3.4: ```bash $ hyperfine -w 1 'ruby --disable-all ../test.rb' './miniruby ../test.rb' Benchmark 1: ruby --disable-all ../test.rb Time (mean ± σ): 3.162 s ± 0.071 s [User: 2.783 s, System: 10.809 s] Range (min … max): 3.093 s … 3.337 s 10 runs Benchmark 2: ./miniruby ../test.rb Time (mean ± σ): 208.7 ms ± 4.6 ms [User: 889.7 ms, System: 6.9 ms] Range (min … max): 202.8 ms … 222.0 ms 14 runs Summary ./miniruby ../test.rb ran 15.15 ± 0.47 times faster than ruby --disable-all ../test.rb ``` Notes: Merged: https://github.com/ruby/ruby/pull/13594
2025-06-12Fix class instance variable inside namespacesJean Boussier
Now that classes fields are delegated to an object with its own shape_id, we no longer need to mark all classes as TOO_COMPLEX. Notes: Merged: https://github.com/ruby/ruby/pull/13595
2025-06-11Try to run ignored tests with macOS 15Hiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/13581
2025-06-09Add missing write barrier in set_i_initialize_copyJohn Hawthorn
When we copy the table from one set to another we need to run write barriers. Notes: Merged: https://github.com/ruby/ruby/pull/13558
2025-06-09ZJIT: Parse opt_regexpmatch2 into HIRAlan Wu
Notes: Merged: https://github.com/ruby/ruby/pull/13549
2025-06-09ZJIT: Parse opt_not into HIRAlan Wu
Notes: Merged: https://github.com/ruby/ruby/pull/13549
2025-06-09ZJIT: Parse opt_or into HIRAlan Wu
Notes: Merged: https://github.com/ruby/ruby/pull/13549
2025-06-09ZJIT: Parse opt_and into HIRAlan Wu
Notes: Merged: https://github.com/ruby/ruby/pull/13549
2025-06-09ZJIT: Parse opt_succ into HIRAlan Wu
Notes: Merged: https://github.com/ruby/ruby/pull/13549
2025-06-09ZJIT: Parse opt_empty_p into HIRAlan Wu
Notes: Merged: https://github.com/ruby/ruby/pull/13549
2025-06-09[Feature #21219] Selective inspect of instance variablesNobuyoshi Nakada
Make Kernel#inspect ask which instance variables should be dumped by the result of `#instance_variables_to_inspect`. Co-Authored-By: Jean Boussier <byroot@ruby-lang.org> Notes: Merged: https://github.com/ruby/ruby/pull/13555
2025-06-08record load average at failKoichi Sasada
On a high load machine, the following test can fail. This patch simply records the load average with `uptime`. ``` 1) Failure: TestThreadQueue#test_thr_kill [/tmp/ruby/src/trunk_gcc10/test/ruby/test_thread_queue.rb:239]: only 165/250 done in 60 seconds. ```
2025-06-08increase timeout for high load envKoichi Sasada
I can reproduce timeout failure with the high load machine: ``` $ RUBY_MAX_CPU=100 ruby -e '100.times{Ractor.new{loop{}}}; sleep' & $ while make test-all -o exts -o encs TESTS='ruby/gc -n /test_interrupt_in_finalizer/ --repeat-count=100'; do date; done .... Finished(93/100) tests in 0.653434s, 1.5304 tests/s, 7.6519 assertions/s. Finished(94/100) tests in 0.614422s, 1.6275 tests/s, 8.1377 assertions/s. [1/1] TestGc#test_interrupt_in_finalizer = 11.08 s 1) Timeout: TestGc#test_interrupt_in_finalizer ```
2025-06-07Get rid of SHAPE_T_OBJECTJean Boussier
Now that we have the `heap_index` in shape flags we no longer need `T_OBJECT` shapes. Notes: Merged: https://github.com/ruby/ruby/pull/13556
2025-06-07Replicate `heap_index` in shape_id flags.Jean Boussier
This is preparation to getting rid of `T_OBJECT` transitions. By first only replicating the information it's easier to ensure consistency. Notes: Merged: https://github.com/ruby/ruby/pull/13556
2025-06-06shape.c: match capacity growth with T_OBJECT embedded sizesJean Boussier
This helps with getting with of `SHAPE_T_OBJECT`, by ensuring that transitions will have capacities that match the next embed size. Notes: Merged: https://github.com/ruby/ruby/pull/13548
2025-06-06ZJIT: Add codegen for uncached setinstancevariableMax Bernstein
Notes: Merged: https://github.com/ruby/ruby/pull/13527
2025-06-06ZJIT: Add codegen for uncached getinstancevariableMax Bernstein
I didn't know `rb_ivar_get` existed until @Xrxr pointed me to it. Thanks, Alan! Notes: Merged: https://github.com/ruby/ruby/pull/13527
2025-06-05ZJIT: Pass self through basic block params (#13529)Takashi Kokubun
* ZJIT: Pass self through basic block params Co-authored-by: Max Bernstein <tekknolagi@gmail.com> * Add comments for self * Use self_param for ivar * Make self_param a loop local * Fix rest parameter type check * Push self_param first * Add a test case for putself * Use SELF_PARAM_IDX Co-authored-by: Max Bernstein <tekknolagi@gmail.com> * Fix test_unknown --------- Co-authored-by: Max Bernstein <tekknolagi@gmail.com> Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2025-06-05Refactor raw accesses to rb_shape_t.capacityJean Boussier
Notes: Merged: https://github.com/ruby/ruby/pull/13524
2025-06-05Add debug message to test_heaps_grow_independentlyPeter Zhu
To debug flaky failures on i686 that look like: 1) Failure: TestGc#test_heaps_grow_independently [test/ruby/test_gc.rb:704]: Expected 2061929 to be < 2000000. Notes: Merged: https://github.com/ruby/ruby/pull/13140
2025-06-05ZJIT: Add `insns` param that tests for opcode presenceAlan Wu
Notes: Merged: https://github.com/ruby/ruby/pull/13470 Merged-By: XrXr
2025-06-05Get rid of `rb_shape_t.flags`Jean Boussier
Now all flags are only in the `shape_id_t`, and can all be checked without needing to dereference a pointer. Notes: Merged: https://github.com/ruby/ruby/pull/13515
2025-06-04ZJIT: Add newrange support (#13505)Stan Lo
* Add newrange support to zjit * Add RangeType enum for Range insn's flag * Address other feedback Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2025-06-05mark main Ractor objectKoichi Sasada
`RUBY_DEBUG=gc_stress ./miniruby -e0` crashes because of this marking miss. BTW, to use `RUBY_DEBUG=gc_stress` we need to specify `--enable-debug-env` configure option. This is why I couldn't repro on my environments. see c0c94ab183d0d428595ccb74ae71ee945f1afd45 Notes: Merged: https://github.com/ruby/ruby/pull/13506
2025-06-04ZJIT: Implement side exits for entry frames (#13469)Takashi Kokubun
Co-authored-by: Max Bernstein <tekknolagi@gmail.com> Co-authored-by: Alan Wu <alansi.xingwu@shopify.com> Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2025-06-04ZJIT: Spill to the stack using arguments instead of FrameStateAlan Wu
The FrameState on the SendWithoutBlock represents the entry state, but for instructions that push to the stack in the middle of the instruction before actually doing the send like opt_aref_with, the FrameState is incorrect. We need to write to the stack using the arguments for the instruction. Notes: Merged: https://github.com/ruby/ruby/pull/13468
2025-06-04Get rid of frozen shapes.Jean Boussier
Instead `shape_id_t` higher bits contain flags, and the first one tells whether the shape is frozen. This has multiple benefits: - Can check if a shape is frozen with a single bit check instead of dereferencing a pointer. - Guarantees it is always possible to transition to frozen. - This allow reclaiming `FL_FREEZE` (not done yet). The downside is you have to be careful to preserve these flags when transitioning. Notes: Merged: https://github.com/ruby/ruby/pull/13289
2025-06-03Fix memory leak in Prism's RubyVM::InstructionSequence.newPeter Zhu
[Bug #21394] There are two ways to make RubyVM::InstructionSequence.new raise which would cause the options->scopes to leak memory: 1. Passing in any (non T_FILE) object where the to_str raises. 2. Passing in a T_FILE object where String#initialize_dup raises. This is because rb_io_path dups the string. Example 1: 10.times do 100_000.times do RubyVM::InstructionSequence.new(nil) rescue TypeError end puts `ps -o rss= -p #{$$}` end Before: 13392 17104 20256 23920 27264 30432 33584 36752 40032 43232 After: 9392 11072 11648 11648 11648 11712 11712 11712 11744 11744 Example 2: require "tempfile" MyError = Class.new(StandardError) String.prepend(Module.new do def initialize_dup(_) if $raise_on_dup raise MyError else super end end end) Tempfile.create do |f| 10.times do 100_000.times do $raise_on_dup = true RubyVM::InstructionSequence.new(f) rescue MyError else raise "MyError was not raised during RubyVM::InstructionSequence.new" end puts `ps -o rss= -p #{$$}` ensure $raise_on_dup = false end end Before: 14080 18512 22000 25184 28320 31600 34736 37904 41088 44256 After: 12016 12464 12880 12880 12880 12912 12912 12912 12912 12912 Notes: Merged: https://github.com/ruby/ruby/pull/13496
2025-06-02Fix test_loading_kwargs_memory_leakPeter Zhu
The test fails with: TestISeq#test_loading_kwargs_memory_leak [test/ruby/test_iseq.rb:882]: pid 18222 exit 1 | -:2:in '<main>': undefined method 'iseq_to_binary' for main (NoMethodError) Notes: Merged: https://github.com/ruby/ruby/pull/13494
2025-06-02compile.c: Handle anonymous variables in `outer_variable_cmp`Jean Boussier
[Bug #21370] Notes: Merged: https://github.com/ruby/ruby/pull/13436
2025-05-31skip failing test in a weekKoichi Sasada
``` 1) Failure: TestGc#test_gc_stress_at_startup [/home/chkbuild/chkbuild/tmp/build/20250530T213003Z/ruby/test/ruby/test_gc.rb:799]: [Bug #15784] pid 1748790 killed by SIGSEGV (signal 11) (core dumped). 1. [3/3] Assertion for "success?" | Expected #<Process::Status: pid 1748790 SIGSEGV (signal 11) (core dumped)> to be success?. ```
2025-05-31skip flaky testKoichi Sasada
``` 1) Failure: TestProcess#test_warmup_frees_pages [/tmp/ruby/src/trunk-random1/test/ruby/test_process.rb:2772]: <164348> expected but was <165985>. ``` can someone investigate it? Notes: Merged: https://github.com/ruby/ruby/pull/13478