* failing test for ObjToString optimization with GuardType
* profile ObjToString receiver and rewrite with guard
* adjust integration tests for objtostring type guard optimization
* Implement new GuardTypeNot HIR; objtostring sends to_s directly on profiled nonstrings
* codegen for GuardTypeNot
* typo fixes
* better name for tests; fix side exit reason for GuardTypeNot
* revert accidental change
* make bindgen
* Fix is_string to identify subclasses of String; fix codegen for identifying if val is String
[ZJIT] Avoid mutating string in zjit stats
GitHub runs with a Symbol patch that causes a frozen string error when
running `--zjit-stats`
```rb
Class Symbol
alias_method :to_s, :name
end
```
I remember hearing that Shopify runs a similar patch, and that we might
try to make this the default behavior in Ruby some day.
Any chance we can avoid mutating the string here in case it's frozen?
That does mean we'll end up making some extra strings when it's not
frozen, but I think that's OK for printing stats.
If we alias two variable multiple times, for example like this:
alias $foo $bar
alias $foo $bar
Then we will increment the counter for entry2->var->counter each time,
which is not correct because we are not adding more references to
entry2->var. This reports as a memory leak in RUBY_FREE_AT_EXIT because
entry2->var->counter will never reach 0 and thus will never be freed.
This allows for more precise tracking of stats programmatically
which is particularly useful for our nightly benchmarking suite.
- Define rust function
- Expose to C
- Wrap with Ruby API
- Add a test
* ZJIT: Allow label generation above 19 bits
* Refactor emit_conditional_jump to use generate_branch
* Make branching functionality generic across Label and CodePtr
* ZJIT: Add > 19 bit jump test and helper function
* Remove an empty line
---------
Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
* YJIT: Add more information to an assert message
in jit_guard_known_class
* Say "should be a heap object" instead
Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
---------
Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
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
* Revert "Debug: More inspections"
e5a6e952467eef5444eaf63b77d8c91aa367d4de.
* Revert "Debug for sporadical failures on RubyCI"
7cafc61e7df044644f47937694c46835c316e86b.
Ref: https://github.com/ruby/ruby/pull/14134#issuecomment-3207733725
We can't safely use low-bit pointer tagging anymore because `RTypedData.type`
lines up with `RData.dfree` and there is no aligment guarantee on function
pointers, as evidenced by `memcached` and `gpgme` gems.
We also can't use FL_USER* for this, because extensions may use these
for other purposes.
Using a general flag for this is a bit unfortunate, as general flags
are hard to come by, however I recently freed several of them, and
we still have two or three free ones left.
One example to describe how `*` works actually prints a warning:
```
$ ruby -we "sprintf('%d', 20, 14)"
=> -e:1: warning: too many arguments for format string
```
I think it's better to not use examples that print warnings, so I
propose to merge `*` docs with "width" specifier docs, and only include
the "correct" example.
After I believe `*` is not an actual flag, but a special value that the
width specifier can take.
Mention `*` special value in initial summary as well.
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]
Set the runner user's primary group to avoid a mismatch between the group IDs of
"id -g" and C function getpwuid(uid_t uid) pw_gid in a test as a better
workaround.