summaryrefslogtreecommitdiff
path: root/test/ruby
AgeCommit message (Collapse)Author
2025-09-08ZJIT: Add --zjit-stats=quiet option to collect stats without printing (#14467)Randy Stauner
Similar to YJIT's --yjit-stats=quiet, this option allows ZJIT to collect statistics and make them available via the Ruby API without printing them at exit. This is useful for programmatic access to stats without the output noise. - Added print_stats field to Options struct - Modified option parsing to support --zjit-stats=quiet - Added rb_zjit_print_stats_p primitive to check if stats should be printed - Updated zjit.rb to only register at_exit handler when print_stats is true - Update the help text shown by `ruby --help` to indicate that --zjit-stats now accepts an optional =quiet parameter. - Added test for --zjit-stats=quiet option
2025-09-08Allow IO#each_codepoint to work with unetc even when encoding conversion activeYO4
Using IO#each_codepoint together with IO#ungetc causes an unwanted exception when encoding conversion is active. C:\>ruby -e "open('NUL', 'rt') { |f| f.ungetc('aa'); f.each_codepoint { |c| p c }}" 97 -e:1:in 'IO#each_codepoint': byte oriented read for character buffered IO (IOError) from -e:1:in 'block in <main>' from -e:1:in 'Kernel#open' from -e:1:in '<main>' Fixes [Bug #21131]
2025-09-07Make invalid & operator type error message consistent with */**Jeremy Evans
If #to_proc is defined, this uses the following error message format, matching the error message format used for * when to_a returns non-Array and for ** when to_hash returns non-Hash: ``` can't convert ClassName to Proc (ClassName#to_proc gives OtherClassName) ``` If #to_proc is not defined, this uses the following error message format, matching the error message format used when ** is called on a non-Hash not implementing to_hash. ``` no implicit conversion of ClassName into Proc ``` There isn't a similar error for * when called on a non-Array not implementing to_a, as Ruby does not raise for that case. Fixes [Bug #21563]
2025-09-06Increase the rehearsal countNobuyoshi Nakada
2025-09-05ZJIT: Fix tests for ZJIT (#14460)Takashi Kokubun
2025-09-05ZJIT: Stop optimizing toplevel locals (#14458)Takashi Kokubun
2025-09-05ZJIT: Invalidate local variables on EP escape (#14448)Takashi Kokubun
2025-09-04ZJIT: Compile invokesuper with dynamic dispatch (#14444)Takashi Kokubun
Co-authored-by: Max Bernstein <ruby@bernsteinbear.com>
2025-09-04ZJIT: Add patchpoint for TracePoint (#14420)Stan Lo
ZJIT: Add patchpoint for TracePoint activation Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com> Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
2025-09-04ZJIT: Support compiling ISEQs for opt_pc = 0 (#14441)Takashi Kokubun
* ZJIT: Support compiling ISEQs for opt_pc = 0 * Test send with optional arguments
2025-09-03Revert "test_gc.rb: Attempt to stabilize test_interrupt_in_finalizer"Takashi Kokubun
This reverts commit c1c0b32445c66e343c136faa28d7a0f0f46d96a2. This test is clearly not reliable: https://github.com/ruby/ruby/actions/runs/17446920961/job/49543543423 I want to skip this unstable test on GitHub Actions to make sure this test doesn't prevent PRs from getting merged. We can continue to monitor the state of this test on RubyCI and ci.rvm.jp.
2025-09-03ZJIT: Handle `opt_case_dispatch` insn (#14433)Stan Lo
ZJIT: Handle opt_case_dispatch insn
2025-09-02test_gc.rb: Attempt to stabilize test_interrupt_in_finalizerTakashi Kokubun
This fails way too often across many environments. I don't think this test is healthy. https://github.com/ruby/ruby/actions/runs/17343611722/job/49240735401 Before we give up on it, let me see if this helps.
2025-09-02test_settracefunc.rb: Increase a timeoutTakashi Kokubun
https://github.com/ruby/ruby/actions/runs/17413734881/job/49436975287
2025-09-02ZJIT: Clear jit entry from iseqs after TracePoint activation (#14407)Stan Lo
ZJIT: Remove JITed code after TracePoint is enabled
2025-09-02ZJIT: NewRangeFixnum instruction (#14409)André Luiz Tiago Soares
* Failing optimization tests for NewRangeFixnum * NewRangeFixnum general idea * Use gen_prepare_call_with_gc on gen_new_range_fixnum; add additional hir tests * Remove unused NewRange rewrite trigger when neither range is Fixnum literal * Remove misleading 'profiled' name in range optimization tests * Adjustments as per review comments * Include new_range_fixnum tests * remove non-ASCII character from comments as per PR review * remove non-ASCII character from comments as per PR review
2025-09-02test_thread_cv.rb: Increase a timeout for a thread testTakashi Kokubun
https://github.com/ruby/ruby/actions/runs/17410747983/job/49427074277
2025-09-02test_transcode.rb: Increase a timeout for Ractor testsTakashi Kokubun
https://github.com/ruby/ruby/actions/runs/17408924679/job/49420774667
2025-08-30Initialize class dup/clone before calling initialize_dup/initialize_cloneJeremy Evans
Previously, you could override the class initialize_dup/initialize_clone method and the class hierarchy would not be set correctly inside the method before calling super. This removes Module#initialize_copy, and instead makes Object#dup/clone call the underlying C function (rb_mod_init_copy) before calling the appropriate initialize_dup/initialize_clone method. This results in the following fixes: * The appropriate initialize_dup method is called (dup on a class will respect superclass initialize_dup). * Inside class initialize_dup/initialize_clone/initialize_copy, class ancestor hierarchy is correct. * Calling singleton_class inside initialize_dup no longer raises a TypeError later in dup. * Calling singleton_class.ancestors inside initialize_dup no longer results in missing ancestors. Fixes [Bug #21538]
2025-08-30Add NODE SCLASS locationsS-H-GAMELINKS
Add locations to struct `RNode_SCLASS`. memo: ``` @ ProgramNode (location: (1,0)-(1,18)) +-- locals: [] +-- statements: @ StatementsNode (location: (1,0)-(1,18)) +-- body: (length: 1) +-- @ SingletonClassNode (location: (1,0)-(1,18)) +-- locals: [] +-- class_keyword_loc: (1,0)-(1,5) = "class" +-- operator_loc: (1,6)-(1,8) = "<<" +-- expression: | @ SelfNode (location: (1,9)-(1,13)) +-- body: nil +-- end_keyword_loc: (1,15)-(1,18) = "end" ```
2025-08-29ZJIT: Specialize monomorphic GetIvar (#14388)Max Bernstein
Specialize monomorphic `GetIvar` into: * `GuardType(HeapObject)` * `GuardShape` * `LoadIvarEmbedded` or `LoadIvarExtended` This requires profiling self for `getinstancevariable` (it's not on the operand stack). This also optimizes `GetIvar`s that happen as a result of inlining `attr_reader` and `attr_accessor`. Also move some (newly) shared JIT helpers into jit.c.
2025-08-29ZJIT: Remove special case for defined?(method call) (#14401)Max Bernstein
This was fixed in https://github.com/ruby/ruby/pull/14308 Thanks, Stan, for noticing. Fixes https://github.com/Shopify/ruby/issues/703
2025-08-29`Module#attr` family accepts strings as well as symbolsNobuyoshi Nakada
2025-08-29Relax thresholds for array, object, and string compaction verificationHiroshi SHIBATA
These tests failed with RHEL10 https://rubyci.s3.amazonaws.com/rhel10/ruby-master/log/20250828T093003Z.fail.html.gz
2025-08-28ZJIT: Add missing rb_zjit_cme_invalidateTakashi Kokubun
2025-08-28ZJIT: Compile Insn::SendTakashi Kokubun
2025-08-28ZJIT: Prepare getglobal for non-leaf call (#14387)Stan Lo
Depending on the user's warning level, getting certain global variables may lead to calling `Warning#warn`, which can be redefined by the user. This fixes another `bootstraptest/test_yjit.rb` failure.
2025-08-28ZJIT: Generate code for ArrayExtendMax Bernstein
2025-08-28ZJIT: Generate code for DefinedIvarMax Bernstein
2025-08-28ZJIT: Generate code for ToArray, ToNewArrayMax Bernstein
2025-08-28ZJIT: Generate code for ArrayPushMax Bernstein
2025-08-28ZJIT: Generate code for HashDupMax Bernstein
2025-08-28ZJIT: Add Ractor mode PatchPoint for ivar get/set (#14375)Stan Lo
* ZJIT: Add Ractor mode PatchPoint for ivar get/set * ZJIT: Only add single ractor patchpoint to class/module receivers * ZJIT: Improve Ractor mode patch point comments Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com> --------- Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
2025-08-28ZJIT: Refactor stats implementations (#14378)Takashi Kokubun
* ZJIT: Refactor stats implementations * s/num_send_dynamic/dynamic_send_count/
2025-08-28rb_ivar_delete: allow complex transitionJean Boussier
`rb_ivar_delete` would force a new shape to be created. And in the case of a shape exhaustion, it wouldn't handle T_CLASS/T_MODULE correctly.
2025-08-28Populate ivar caches for types other than T_OBJECTJean Boussier
`vm_setinstancevariable` had a codepath to try to match the inline cache for types other than T_OBJECT, but the cache population path in `vm_setivar_slowpath` was exclusive to T_OBJECT, so `vm_setivar_default` would never match anything. This commit improves `vm_setivar_slowpath` so that it is capable of filling the cache for all types, and adds a `vm_setivar_class` codepath for `T_CLASS` and `T_MODULE`. `vm_setivar`, `vm_setivar_default` and `vm_setivar_class` could be unified, but based on the very explicit `NOINLINE` I assume they were split to minimize codesize. ``` compare-ruby: ruby 3.5.0dev (2025-08-27T14:58:58Z merge-vm-setivar-d.. 5b749d8e53) +PRISM [arm64-darwin24] built-ruby: ruby 3.5.0dev (2025-08-27T16:30:31Z setivar-cache-gene.. 4fe78ff296) +PRISM [arm64-darwin24] | |compare-ruby|built-ruby| |:------------------------|-----------:|---------:| |vm_ivar_set_on_instance | 161.809| 164.688| | | -| 1.02x| |vm_ivar_set_on_generic | 58.769| 115.638| | | -| 1.97x| |vm_ivar_set_on_class | 70.034| 141.042| | | -| 2.01x| ```
2025-08-28Allow to get a NODE_SCOPE node of dummy stack frame of ArgumentErrorYusuke Endoh
Previously, it was not possible to obtain a node of the callee's `Thread::Backtrace::Location` for cases like "wrong number of arguments" by using `RubyVM::AST.of`. This change allows that retrieval. This is preparation for [Feature #21543].
2025-08-28Make `RubyVM::AST.of` return a parent node of NODE_SCOPEYusuke Endoh
This change makes `RubyVM::AST.of` and `.node_id_for_backtrace_location` return a parent node of NODE_SCOPE (such as NODE_DEFN) instead of the NODE_SCOPE node itself. (In future, we may remove NODE_SCOPE, which is a bit hacky AST node.) This is preparation for [Feature #21543].
2025-08-27Fix bad NameError raised using sendforward instruction through vcallLuke Gruber
If you called a VCALL method and the method takes forwarding arguments and then you forward those arguments along using the sendforward instruction, the method_missing class was wrongly chosen as NameError instead of NoMethodError. This is because the VM looked at the CallInfo of the vcall and determined it needed to raise NameError. Now we detect that case and raise NoMethodError. Fixes [Bug #21535]
2025-08-27ZJIT: Implement side exit stats (#14357)Takashi Kokubun
2025-08-27Add more `File.path` testsNobuyoshi Nakada
2025-08-26Skip a Ractor test unstable on Windows for MinGWTakashi Kokubun
MinGW is also Windows, so it doesn't work for MinGW either. https://github.com/ruby/ruby/actions/runs/17250269899/job/48950567246
2025-08-26Follow up cleanup for `opt_(aref|aset)_with` removalStan Lo
Just removing some unneeded tests, outdated comments...etc.
2025-08-26Remove `opt_aref_with` and `opt_aset_with`Aaron Patterson
When these instructions were introduced it was common to read from a hash with mutable string literals. However, these days, I think these instructions are fairly rare. I tested this with the lobsters benchmark, and saw no difference in speed. In order to be sure, I tracked down every use of this instruction in the lobsters benchmark, and there were only 4 places where it was used. Additionally, this patch fixes a case where "chilled strings" should emit a warning but they don't. ```ruby class Foo def self.[](x)= x.gsub!(/hello/, "hi") end Foo["hello world"] ``` Removing these instructions shows this warning: ``` > ./miniruby -vw test.rb ruby 3.5.0dev (2025-08-25T21:36:50Z rm-opt_aref_with dca08e286c) +PRISM [arm64-darwin24] test.rb:2: warning: literal string will be frozen in the future (run with --debug-frozen-string-literal for more information) ``` [Feature #21553]
2025-08-26Simplified assertionHiroshi SHIBATA
2025-08-26Revert "Omit extra allocation of Array object in Windows platform temporary"Benoit Daloze
This reverts commit 6ab2cd0f69ff1591db3a0011b73d3b26a9a69412.
2025-08-25Omit extra allocation of Array object in Windows platform temporaryHiroshi SHIBATA
2025-08-22ZJIT: Spill whole FrameState in `Insn::SendWithoutBlock`Alan Wu
Previously, we only spilled the arguments necessary for the particular send. In case the callee raises and a rescue resumes the ISEQ, that did not present a complete stack state. E.g. in `[1, (raise rescue 2)]` the raise send only spills `self`, when `1` also needs to be spilled. Spill the whole stack. Adjust parsing for `opt_aref_with` since the key argument for the send now needs to be described by the frame state of the send. This changes the contract for `Insn::SendWithoutBlock` to use arguments from the interpreter stack as described by its frame state.
2025-08-22ZJIT: Allow querying a single ZJIT stat (#14309)Takashi Kokubun
* ZJIT: Add RubyVM::ZJIT.stats_enabled? * ZJIT: Allow querying a single ZJIT stat
2025-08-22Fixes to encoding/transcoding for ractors.Luke Gruber
Not all ractor-related encoding issues were fixed by 1afc07e815051e2f73493f055f2130cb642ba12a. I found more by running my test-all branch with 3 ractors for each test.