| Age | Commit message (Collapse) | Author |
|
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
|
|
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]
|
|
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]
|
|
|
|
|
|
|
|
|
|
Co-authored-by: Max Bernstein <ruby@bernsteinbear.com>
|
|
ZJIT: Add patchpoint for TracePoint activation
Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
|
|
* ZJIT: Support compiling ISEQs for opt_pc = 0
* Test send with optional arguments
|
|
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.
|
|
ZJIT: Handle opt_case_dispatch insn
|
|
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.
|
|
https://github.com/ruby/ruby/actions/runs/17413734881/job/49436975287
|
|
ZJIT: Remove JITed code after TracePoint is enabled
|
|
* 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
|
|
https://github.com/ruby/ruby/actions/runs/17410747983/job/49427074277
|
|
https://github.com/ruby/ruby/actions/runs/17408924679/job/49420774667
|
|
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]
|
|
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"
```
|
|
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.
|
|
This was fixed in https://github.com/ruby/ruby/pull/14308
Thanks, Stan, for noticing.
Fixes https://github.com/Shopify/ruby/issues/703
|
|
|
|
These tests failed with RHEL10
https://rubyci.s3.amazonaws.com/rhel10/ruby-master/log/20250828T093003Z.fail.html.gz
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
* 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>
|
|
* ZJIT: Refactor stats implementations
* s/num_send_dynamic/dynamic_send_count/
|
|
`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.
|
|
`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|
```
|
|
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].
|
|
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].
|
|
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]
|
|
|
|
|
|
MinGW is also Windows, so it doesn't work for MinGW either.
https://github.com/ruby/ruby/actions/runs/17250269899/job/48950567246
|
|
Just removing some unneeded tests, outdated comments...etc.
|
|
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]
|
|
|
|
This reverts commit 6ab2cd0f69ff1591db3a0011b73d3b26a9a69412.
|
|
|
|
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.
|
|
* ZJIT: Add RubyVM::ZJIT.stats_enabled?
* ZJIT: Allow querying a single ZJIT stat
|
|
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.
|