summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
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-28[ruby/error_highlight] Remove a branch for Ruby 3.1Yusuke Endoh
https://github.com/ruby/error_highlight/commit/d3063cde62
2025-08-28[ruby/error_highlight] Show a dedicated snippet for "wrong number of ↵Yusuke Endoh
arguments" error This is an experimental implementation for https://bugs.ruby-lang.org/issues/21543. ``` test.rb:2:in 'Object#foo': wrong number of arguments (given 1, expected 2) (ArgumentError) caller: test.rb:6 | foo(1) ^^^ callee: test.rb:2 | def foo(x, y) ^^^ from test.rb:6:in 'Object#bar' from test.rb:10:in 'Object#baz' from test.rb:13:in '<main>' ``` https://github.com/ruby/error_highlight/commit/21e974e1c4
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-27JSON.generate: warn or raise on duplicated keyJean Boussier
Because both strings and symbols keys are serialized the same, it always has been possible to generate documents with duplicated keys: ```ruby >> puts JSON.generate({ foo: 1, "foo" => 2 }) {"foo":1,"foo":2} ``` This is pretty much always a mistake and can cause various issues because it's not guaranteed how various JSON parsers will handle this. Until now I didn't think it was possible to catch such case without tanking performance, hence why I only made the parser more strict. But I finally found a way to check for duplicated keys cheaply enough.
2025-08-27Fix `JSON::Coder` to cast non-string keys.Jean Boussier
2025-08-27Fix `JSON.generate` `strict: true` mode to also restrict hash keysJean Boussier
2025-08-27[ruby/json] Silence ractor experimental warningsJean Boussier
https://github.com/ruby/json/commit/e77f610b21
2025-08-27[ruby/json] Remove too big Float from fixture to avoid warningÉtienne Barrié
https://github.com/ruby/json/commit/e881e55e83
2025-08-27[ruby/json] Test behavior of parsing a too big FloatÉtienne Barrié
https://github.com/ruby/json/commit/8510ea5c1a
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-26Exclude a couple tests failing on JRuby for multiple reasonsBenoit Daloze
* https://github.com/jruby/jruby/issues/8972 but also at least 2 more incompatibilities.
2025-08-26Fix Pathname#lutime test and add the method backBenoit Daloze
2025-08-26Fix TestPathname#has_symlink? it was returning false on LinuxBenoit Daloze
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-25Import https://github.com/ruby/pathname/pull/57Hiroshi 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.
2025-08-22ZJIT: Temporarily downgrade assert_compiles to assert_runsMax Bernstein
2025-08-21ZJIT: Fill nils before function_stub_hit exit (#14294)Takashi Kokubun
Co-authored-by: Alan Wu <alansi.xingwu@shopify.com> Co-authored-by: Max Bernstein <ruby@bernsteinbear.com> Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
2025-08-21Adjust snt < max_cpu calculationJohn Hawthorn
[Bug #20146] Previously we dealt with the main Ractor not being enabled for M:N by incrementing snt_cnt++. This worked for comparing against ractor count, but meant that we always had one less SNT than was specified by RUBY_MAX_CPU. This was notably a problem for RUBY_MAX_CPU=1, which would cause Ractors to hang. This commit instead of adjusting snt, adjusts a "schedulable_ractor_cnt". This way snt_cnt will actually reach RUBY_MAX_CPU.
2025-08-22Do not respect ruby2_keywords on method/proc with post argumentsJeremy Evans
Previously, ruby2_keywords could be used on a method or proc with post arguments, but I don't think the behavior is desired: ```ruby def a(*c, **kw) [c, kw] end def b(*a, b) a(*a, b) end ruby2_keywords(:b) b({foo: 1}, bar: 1) ``` This changes ruby2_keywords to emit a warning and not set the flag on a method/proc with post arguments. While here, fix the ruby2_keywords specs for warnings, since they weren't testing what they should be testing. They all warned because the method didn't accept a rest argument, not because it accepted a keyword or keyword rest argument.
2025-08-21Remove unused SPECIAL_CONST_SHAPE_IDÉtienne Barrié
Its usage was removed in 306d50811dd060d876d1eb364a0d5e6106f5e4f1.
2025-08-21variable.c: handle cleared fields_obj in genfields cacheJean Boussier
[Bug #21547] Followup: https://github.com/ruby/ruby/pull/14201 When adding an instance variable and the IMEMO/fields need to be larger, we allocate a new one and clear the old one. Since the old one may still be in other ec's cache, on a hit we must check the IMEMO/fields isn't a stale one.
2025-08-21Add `Math.log1p` and `Math.expm1`Yusuke Endoh
This commit adds two new methods to the `Math` module: * `Math.log1p(x)`: Computes `Math.log(x + 1)` * `Math.expm1(x)`: Computes `Math.exp(x) - 1` These methods are often more accurate than the straightforward computation, especially when `x` is close to zero. The corresponding functions, `log1p` and `expm1`, are defined in the C99 standard math library. [Feature #21527]