| Age | Commit message (Collapse) | Author |
|
[Bug #22002] Never pop when compiling branch predicate
The value is always needed. Now prism emits the same instructions as parse.y for the added test case.
`defined?`/`flip-flop` caused `argument stack underflow`, `and`/`or` segfaulted during runtime.
|
|
c0d86a0103de7130943d54b4a290b76ec7e0c135,47e061277ac194a36659510bcf4f3190bde629a6: [Backport #21952]
class.c: rb_class_duplicate_classext also dup content of cvc_tbl
[Bug #21952]
Shallow copying the table result in the same memory being shared
between multiple box, causing double free when one of the box
is garbage collected.
---
class.c: Make cvc_tbl a managed object
[Bug #21952]
Solves the double-free or use after-free concern with boxes.
Now entries can safely be used for copy-on-write.
Also is likely necessary to make it save to read cvar from
secondary ractors, as allowed since: ab32c0e690b805cdaaf264ad4c3421696c588204
|
|
[PATCH] [Bug #22004] Fix short-circuited loop conditions
|
|
[PATCH] Mark `$_` as box-dynamic to bypass Box gvar_tbl cache
`$_` is updated through svar (rb_lastline_set), bypassing
rb_gvar_set, so the Box gvar_tbl cache is never invalidated
and returns a stale value. Call rb_gvar_box_dynamic so
gvar_use_box_tbl() skips the cache.
Fixes [Bug #21940](https://bugs.ruby-lang.org/issues/21940)
|
|
8ad6baa01746e8de0460f0ccdaee69953a70af17: [Backport #21933]
[PATCH] Fix Box regexp match vars after non-match
[PATCH] Use box_ready for $&, $`, $\', $+
These variables have rb_gvar_readonly_setter, so box_ready is sufficient.
Only $~ needs box_dynamic due to its custom match_setter.
|
|
[PATCH] [Bug #21986] Fix location of numeric literal
When checking for suffixes, do not flush the numeric literal token
even if no suffix is found.
|
|
[PATCH] [Bug #21985] Include the `-` in the negative numbers location
|
|
|
|
[Bug #22018]
ISeq returned by `RubyVM::InstructionSequene.load_iseq` weren't
handled by the coverage module.
|
|
Extends the @_init guard to def_method so that an ERB object created
via Marshal.load (which bypasses initialize) raises ArgumentError
instead of evaluating arbitrary source. def_module and def_class both
delegate to def_method and are covered by the same check.
Co-authored-by: Tristan Madani <TristanInSec@gmail.com>
|
|
[Bug #21992]
When redefining `BasicObject#initialize` there's no super class to
access.
|
|
|
|
|
|
|
|
|
|
|
|
b6e6ccc6c22ebb464ce101e42a14e7daea2a80b6, cbca59377ebfa1bc1183322fa9d9d0067d445c24: [Backport #21844]
[ruby/psych] Remove excessive check of message
Make `Data#initialize` reject `Integer` keys
[Bug #21844] Fix error message
|
|
[ruby/rubygems] Fix NoMethodError in Gem.try_activate when activation conflicts occur
|
|
marshal.c: properly freeze linked strings
|
|
[Bug #21964]
|
|
Currently we maintain the subclasses list for two separate purposes (we essentially have to different relationships we're putting into the same list):
1. On a T_MODULE, we track the T_ICLASSes created to include it into
other classes. Used for method invalidation and propagating includes
on the module that happen after it's been used
2. On a T_CLASS/T_ICLASS, we track the T_CLASS/T_ICLASS which are the
immediate children of the class. We use this for method invalidation,
some cvar things, and to iterate through subclasses.
Purpose 1 does not have any issues with box, the T_ICLASS always belongs
to one specific module and that's immutable. This list can be box-global
(always use the prime classext or hoist it out) and only needs to be
pruned during free. If we care about behaviour under a particular box
(ie. the propagating includes), we should look up the current box being
modified on the ICLASS itself.
Purpose 2 is more complicated. It currently tracks the immediate
children, the T_CLASS or T_ICLASS whose super points back. Because super
is per-box and is mutable (include/prepend insert ICLASSes into the
chain) we need to update the list on include/prepend, entries must be
per-box, and we can have multiple entries per-box. *I propose we
simplify this by no longer tracking the immediate subclass*, but instead
tracking the T_CLASS -> ... -> T_CLASS relationship, ie. the inverse of
rb_class_superclass. That relationship is the same across all boxes and
immutable after Class creation.
As a special case the ICLASS for refinements are also added to the
purpose 2 list (on T_CLASS). As those ICLASS do not chain to an eventual
leaf T_CLASS.
When we need to find the classes which have included a module, we can
use the module subclasses list to find the ICLASS and then use
RCLASS_INCLUDER. If we needed to iterate all T_ICLASS, we could then
walk up the CLASS_SUPER chain, but I didn't find anywhere we needed to
do that.
|
|
Fix race condition right after ubf registration
Fixes [Bug #21926]
|
|
[ruby/timeout] Compatibility with Fiber scheduler.
(https://github.com/ruby/timeout/pull/97)
[Bug #21947]
|
|
[Bug #21945] Correctly handle `and?` and similar
|
|
exceptional entry
[Backport #21941]
In case of `--yjit-disable`, YJIT only starts to record environment
escapes after `RubyVM::YJIT.enable`. Previously we falsely assumed that
we always have a full history all the way back to VM boot. This had YJIT
install and run code that assume EP=BP when EP≠BP for some exceptional
entry into the middle of a running frame, if the environment escaped
before `YJIT.enable`.
The fix is to reject exceptional entry with an escaped environment.
Rename things and explain in more detail how the predicate for deciding
to assume EP=BP works. It's quite subtle since it reasons about all
parties in the system that push a control frame and then run JIT code.
Note that while can_assume_on_stack_env() checks the currently running
environment if it so happens to be the one YJIT is compiling against, it
can return true for any ISEQ. The check isn't necessary for fixing the
bug, and the load bearing part of this patch is the change to
exceptional entries.
This fix is flat on speed and space on ruby-bench headline benchmarks.
Many thanks for the community effort to create a small test case for
this bug.
|
|
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
|
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
|
|
|
in is a unique keyword because it can be the start of a clause or
an infix keyword. We need to be explicitly sure that even though in
_could_ close an expression context (the body of another in clause)
that we are not also parsing an inline in. The exception is the
case of a command call, which can never be the LHS of an expression,
and so we must immediately exit.
[Bug #21925]
[Bug #21674]
https://github.com/ruby/prism/commit/20374ced51
|
|
They currently complain that the parent method is not forwarding.
But the actual problem is that these types of arguments simply don't
accept `...`
Fixes [Bug #21927]
https://github.com/ruby/prism/commit/0aa2363331
|
|
It gets confused for syntax introduced in https://bugs.ruby-lang.org/issues/20925
But it actually should be a plain method call.
`!`/`?` are not valid as part of an identifier, methods
however allow them as the last character.
Fixes [Bug #21946]
https://github.com/ruby/prism/commit/5d80bc5e1a
|
|
PR #15822 fixed the warning for direct hyphenated gem requires like
`benchmark/ips` → `benchmark-ips`. However, hyphenated gems often
provide multiple files under their namespace.
For example, `benchmark-ips` provides:
- benchmark/ips.rb
- benchmark/timing.rb
- benchmark/compare.rb
When requiring `benchmark/timing`, the previous fix only checked for
`benchmark-timing` gem (doesn't exist), not `benchmark-ips` which
actually provides the file.
This fix checks if ANY gem matching `{prefix}-*` is in the bundle
specs, which covers all subfeatures provided by hyphenated gems.
Reported in https://github.com/ruby/ruby/pull/15822#issuecomment-123456
|
|
Before this it would raise if zjit wasn't enabled
and raise a different exception if zjit was but extended stats were
not (_some_ stats are available).
Co-authored-by: Randy Stauner <randy@r4s6.net>
|
|
#21873]
Method#unbind clones the method entry, preserving its defined_class.
For methods mixed in via include/extend, defined_class is an ICLASS,
causing UnboundMethod#== to return false when comparing against the
same method obtained via Module#instance_method.
Resolve ICLASS defined_class in method_eq.
[Bug #21873]
|
|
|
|
b4a62a1ca949d93332ad8bce0fcc273581160cc5: [Backport #21842]
[PATCH] [Bug #21842] Let `rb_interned_str` return US-ASCII if possible
[PATCH] [DOC] Update docs for rb_interned_str and related functions (#15897)
Related to [Bug #21842].
* rb_interned_str: document what decides whether the returned string is
in US-ASCII or BINARY encoding.
* rb_interned_str_cstr: include the same description as rb_interned_str
for the encoding. This one was still missing the update for US-ASCII
and erroneously said the returned string was alwasy in BINARY encoding
* rb_str_to_interned_str: document how the encoding of the result is
defined.
Co-authored-by: Herwin <herwinw@users.noreply.github.com>
|
|
64f508ade8 changed rb_threadptr_raise to call rb_exception_setup,
which uses rb_scan_args with RB_SCAN_ARGS_PASS_CALLED_KEYWORDS.
This checked rb_keyword_given_p(), which read the interrupted
frame's keyword state rather than the signal raise arguments,
causing a crash when a signal arrived during a keyword call.
Revert rb_threadptr_raise to use rb_make_exception directly, and
have thread_raise_m call rb_exception_setup where
rb_keyword_given_p() reflects the correct frame.
[Bug #21865]
|
|
https://bugs.ruby-lang.org/issues/21831
|
|
|
|
[PATCH] Fix sleep spurious wakeup from sigchld (#15802)
When sleeping with `sleep`, currently the main thread can get woken up from sigchld
from any thread (subprocess exited). The timer thread wakes up the main thread when this
happens, as it checks for signals. The main thread then executes the ruby sigchld handler
if one is registered and is supposed to go back to sleep immediately. This is not ideal but
it's the way it's worked for a while. In commit 8d8159e7d8 I added writes to `th->status`
before and after `wait_running_turn` in `thread_sched_to_waiting_until_wakeup`, which is
called from `sleep`. This is usually the right way to set the thread's status, but `sleep`
is an exception because the writes to `th->status` are done in `sleep_forever`. There's a
loop that checks `th->status` in `sleep_forever`. When the main thread got woken up from
sigchld it saw the changed `th->status` and continued to run the main thread instead of
going back to sleep.
The following script shows the error. It was returning instead of sleeping forever.
```ruby
t = Thread.new do
sleep 0.3
`echo hello` # Spawns subprocess
puts "Subprocess exited"
end
puts "Main thread sleeping..."
result = sleep # Should block forever
puts "sleep returned: #{result.inspect}"
```
Fixes [Bug #21812]
|
|
[PATCH] [Bug #21819] Data objects without members should also be frozen
|
|
[PATCH] [Bug #21814] Fix negative bignum modulo
If modulo is zero, do not apply bias even if the divisor is zero.
`BIGNUM_POSITIVE_P` is true even on bignum zero.
|
|
When requiring a file like "benchmark/ips", the warning system would
incorrectly warn about the "benchmark" gem not being a default gem,
even when the user has "benchmark-ips" (a separate third-party gem)
in their Gemfile.
The fix checks if a hyphenated version of the require path exists in
the bundle specs before issuing a warning. For example, requiring
"benchmark/ips" now checks for both "benchmark" and "benchmark-ips"
in the Gemfile.
[Bug #21828]
|
|
Without this change, classes (including iclass) are allocated
as un-boxable classes after initializing user boxes (after starting
script evaluation). Under this situation, iclasses are created as
un-boxabled class when core modules are included by a class in the
root box, then it causes problems because it's in the root box but
it can't have multiple classexts.
This change makes it possible to allocate boxable classes even after
initializing user boxes. Classes create in the root box will be
boxable, and those can have 2 or more classexts.
|
|
This reverts commit 31ff07ed1eb05d01f7da3c017d542137a3db1e94.
* Don't add a test which only runs on production release
* https://github.com/ruby/actions/actions/runs/20486784889/job/58870959976
* Don't add a new line to `ruby --help`
* https://github.com/ruby/ruby/pull/14142#issuecomment-3689829564
|
|
This reverts commit 9b576cd6255aba97e5e2f55f4b09f00c7dd0e839.
|
|
`Dir.mktmpdir` concatenates a random base-36 number separated by "-",
so may generate pathnames containing "-j2".
|
|
|
|
|
|
|