Age | Commit message (Collapse) | Author |
|
|
|
|
|
|
|
Fix segmentation fault when `Module#name` returns non string value
[Bug #17754]
* Add test for NoMethodError#to_s does not segfault
* Ensure no segfault even if Module#name is overridden
---
error.c | 4 +++-
test/ruby/test_nomethod_error.rb | 16 ++++++++++++++++
2 files changed, 19 insertions(+), 1 deletion(-)
|
|
Ensure that caller respects the start argument
Previously, if there were ignored frames (iseq without pc), we could
go beyond the requested start frame. This has two changes:
1) Ensure that we don't look beyond the start frame by using
last_cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(last_cfp) until the
desired start frame is reached.
2) To fix the failures caused by change 1), which occur when a
limited number of frames is requested, scan the VM stack before
allocating backtrace frames, looking for ignored frames. This
is complicated if there are ignored frames before and after
the start, in which case we need to scan until the start frame,
and then scan backwards, decrementing the start value until we
get to the point where start will result in the number of
requested frames.
This fixes a Rails test failure. Jean Boussier was able to
to produce a failing test case outside of Rails.
Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
---
test/ruby/test_backtrace.rb | 16 ++++++++++++++
vm_backtrace.c | 52 +++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 66 insertions(+), 2 deletions(-)
|
|
rb_enc_interned_str: handle autoloaded encodings
If called with an autoloaded encoding that was not yet
initialized, `rb_enc_interned_str` would crash with
a NULL pointer exception.
See: https://github.com/ruby/ruby/pull/4119#issuecomment-800189841
---
encoding.c | 28 ++++++++++++----------------
ext/-test-/string/depend | 3 +++
ext/-test-/string/fstring.c | 15 +++++++++++++++
internal/encoding.h | 3 +++
string.c | 4 ++++
test/-ext-/string/test_fstring.rb | 16 ++++++++++++++++
6 files changed, 53 insertions(+), 16 deletions(-)
|
|
Fix Enumerable#inject with high negative fixnums [Bug #17731]
---
enum.c | 2 +-
test/ruby/test_enum.rb | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
|
|
Fix infinite loop at illegal sequence [Bug #17729]
As mblen returns -1 on failure, skip the first byte and try the
succeeding bytes in that case.
Close https://github.com/ruby/ruby/pull/4281
---
eval_intern.h | 11 ++++++++++-
test/ruby/test_rubyoptions.rb | 5 +++++
2 files changed, 15 insertions(+), 1 deletion(-)
|
|
Skip refined method when exporting methods with changed visibility
Previously, attempting to change the visibility of a method in a
singleton class for a class/module that is prepended to and refined
would raise a NoMethodError.
Fixes [Bug #17519]
---
test/ruby/test_module.rb | 23 +++++++++++++++++++++++
vm_method.c | 14 +++++++++++---
2 files changed, 34 insertions(+), 3 deletions(-)
|
|
|
|
2a6bfd22468343003463e0cbf91953a01b0dbba5,3ac28de5414c81a0da8c8ec969ea74db5a0f1b0f: [Backport #17645]
Properly convert time_t [Bug #17645]
---
thread_sync.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Explicitly cast __s64 to time_t [Bug #17645]
A workaround of shorten-64-to-32 error where 32-bit linux.
---
file.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
[ruby/io-wait] Declare as Ractor-safe
Fixes https://bugs.ruby-lang.org/issues/17659
https://github.com/ruby/io-wait/commit/ba338b4764
---
ext/io/wait/wait.c | 4 ++++
test/io/wait/test_ractor.rb | 22 ++++++++++++++++++++++
2 files changed, 26 insertions(+)
create mode 100644 test/io/wait/test_ractor.rb
|
|
Make Ractor stdio belonging to the Ractor [Bug #17672]
Defer making ractor stdio until ractor started.
Before ractor started, created objects belong to the caller ractor
instead of the created ractor.
---
bootstraptest/test_ractor.rb | 12 ++++++++++++
ractor.c | 9 ---------
thread.c | 9 +++++++++
3 files changed, 21 insertions(+), 9 deletions(-)
|
|
63abb5c227e5c20d18d0debf699251da93ca64b5,34d02631e71209b12abb69d0114601027e485bc9,2adbf01ae14c0a4cf190b7c969b91726966a0e0f,3acc81d9e41b18380b9e0168fe2b5e5e0c727256: [Backport #17612]
dtoa.c: make compilable independently
Except for `-Dxmalloc=malloc -Dxfree=free`.
---
missing/dtoa.c | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
dtoa.c: constified
clang seems to locate never modified local data in the const
segment implicitly.
---
missing/dtoa.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
dtoa.c: make thread-safe by using atomic CAS
---
common.mk | 2 ++
missing/dtoa.c | 75 ++++++++++++++++++++++++++++++++++++++++++----------------
util.c | 1 +
3 files changed, 57 insertions(+), 21 deletions(-)
Fixed race in dtoa [Bug #17612]
Fixed the race condition when replacing `freelist` entry with its
chained next element. At acquiring an entry, hold the entry once
with the special value, then release by replacing it with the next
element again after acquired. If another thread is holding the
same entry at that time, spinning until the entry gets released.
Co-Authored-By: Koichi Sasada <ko1@atdot.net>
---
bootstraptest/test_ractor.rb | 11 +++++++++++
missing/dtoa.c | 13 ++++++++++---
2 files changed, 21 insertions(+), 3 deletions(-)
|
|
|
|
Ractor.allocate should not be allowed
Ractor.allocate and Ractor#dup should not be allowed like Thread.
[Bug #17642]
---
bootstraptest/test_ractor.rb | 18 ++++++++++++++++++
ractor.c | 2 ++
2 files changed, 20 insertions(+)
|
|
sync check_rvalue_consistency_force()
check_rvalue_consistency_force() uses is_pointer_to_heap() and
it should be synchronized with other ractors.
[Bug #17636]
---
gc.c | 149 ++++++++++++++++++++++++++++++++++---------------------------------
1 file changed, 76 insertions(+), 73 deletions(-)
|
|
abdc634f64a440afcdc7f23c9757d27aab4db8a9,083c5f08ec4e95c9b75810d46f933928327a5ab3,1ecda213668644d656eb0d60654737482447dd92,813fe4c256f89babebb8ab53821ae5eb6bb138c6: [Backport #17497]
remove unused decl
---
internal/vm.h | 6 ------
vm_args.c | 2 --
2 files changed, 8 deletions(-)
Check stack overflow in recursive glob_helper [Bug #17162]
---
dir.c | 2 ++
internal/vm.h | 1 +
vm_eval.c | 10 ++++++++++
3 files changed, 13 insertions(+)
global call-cache cache table for rb_funcall*
rb_funcall* (rb_funcall(), rb_funcallv(), ...) functions invokes
Ruby's method with given receiver. Ruby 2.7 introduced inline method
cache with static memory area. However, Ruby 3.0 reimplemented the
method cache data structures and the inline cache was removed.
Without inline cache, rb_funcall* searched methods everytime.
Most of cases per-Class Method Cache (pCMC) will be helped but
pCMC requires VM-wide locking and it hurts performance on
multi-Ractor execution, especially all Ractors calls methods
with rb_funcall*.
This patch introduced Global Call-Cache Cache Table (gccct) for
rb_funcall*. Call-Cache was introduced from Ruby 3.0 to manage
method cache entry atomically and gccct enables method-caching
without VM-wide locking. This table solves the performance issue
on multi-ractor execution.
[Bug #17497]
Ruby-level method invocation does not use gccct because it has
inline-method-cache and the table size is limited. Basically
rb_funcall* is not used frequently, so 1023 entries can be enough.
We will revisit the table size if it is not enough.
---
debug_counter.h | 3 +
vm.c | 12 +++
vm_callinfo.h | 12 ---
vm_core.h | 5 +
vm_eval.c | 288 ++++++++++++++++++++++++++++++++++++++++++--------------
vm_insnhelper.c | 11 ++-
vm_method.c | 14 ++-
7 files changed, 255 insertions(+), 90 deletions(-)
opt_equality_by_mid for rb_equal_opt
This patch improves the performance of sequential and parallel
execution of rb_equal() (and rb_eql()).
[Bug #17497]
rb_equal_opt (and rb_eql_opt) does not have own cd and it waste
a time to initialize cd. This patch introduces opt_equality_by_mid()
to check equality without cd.
Furthermore, current master uses "static" cd on rb_equal_opt
(and rb_eql_opt) and it hurts CPU caches on multi-thread execution.
Now they are gone so there are no bottleneck on parallel execution.
---
vm_insnhelper.c | 99 ++++++++++++++++++++++++++++++++++++---------------------
1 file changed, 63 insertions(+), 36 deletions(-)
|
|
Destroy VM-wise locks before freeing [Bug #15852]
---
thread.c | 7 -------
vm.c | 2 ++
2 files changed, 2 insertions(+), 7 deletions(-)
|
|
|
|
0d89aedb734372bc35d8a569a992d13e86e7923e,a6f5f3cccda381ae332aaa6467f2644611371fb5,97cf290063ab940d08819cd96cbcca0ef6d50e4c: [Backport #17338]
Assign TAG_NONE to ruby_tag_type instead of 0
---
eval.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Also `eclass` loop can raise in `rb_obj_is_kind_of`
---
eval.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Copy va_list of exception classes
The list is reused when an exception raised again after retrying
in the rescue procedure.
---
eval.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
|
|
|
|
969b824a0c7605e0e570631d967ad0de0c37d0bf,100e464bee46ae71ef048ed85a9bdd012935a3f7: [Backport #17599]
sync GC rest if needed
marking requires a barrier (stop all Ractors) and gc_enter() does it.
However, it doesn't check rest event which can start marking.
[Bug #17599]
---
gc.c | 3 +++
1 file changed, 3 insertions(+)
clear RVALUE on NEWOBJ event.
NEWOBJ event is called without clearing RVALUE values (v1, v2, v3).
This patch clear them before NEWOBJ tracepoint internal hook.
[Bug #17599]
---
gc.c | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)
|
|
Fix backtrace to not skip frames with iseq without pc
Previously, frames with iseq but no pc were skipped (even before
the refactoring in 3b24b7914c16930bfadc89d6aff6326a51c54295).
Because the entire backtrace was procesed before the refactoring,
this was handled by using later frames instead. However, after
the refactoring, we need to handle those frames or they get
lost.
Keep two iteration counters when iterating, one for the desired
backtrace size (so we generate the desired number of frames), and
one for the actual backtrace size (so we don't process off the end
of the stack). When skipping over an iseq frame with no pc,
decrement the counter for the desired backtrace, so it will
continue to process the expected number of backtrace frames.
Fixes [Bug #17581]
---
test/ruby/test_backtrace.rb | 12 ++++++++++++
vm_backtrace.c | 16 +++++++++-------
2 files changed, 21 insertions(+), 7 deletions(-)
|
|
Fixed fallback ENABLE_VIRTUAL_TERMINAL_PROCESSING value [Bug #17639]
---
ruby.c | 2 +-
win32/win32.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
|
|
ripper: fix a bug of Ripper::Lexer with syntax error and heredoc [Bug
#17644]
---
ext/ripper/lib/ripper/lexer.rb | 2 +-
test/ripper/test_lexer.rb | 12 ++++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
|
|
Do not allocate ractor-local storage in dfree function during GC
---
random.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
[Fixes #17622] Mark and move the previous ep
---
vm.c | 10 ++++++++++
1 file changed, 10 insertions(+)
|
|
|
|
Fixed codepage for utime [Bug #17626]
Should use the given codepage argument.
Co-Authored-By: Nobuyoshi Nakada <nobu@ruby-lang.org>
---
test/ruby/test_file_exhaustive.rb | 7 +++++++
win32/win32.c | 2 +-
2 files changed, 8 insertions(+), 1 deletion(-)
|
|
Fix documentation for Module#ruby2_keywords
It returns nil, not self.
Fixes [Bug #17560]
---
vm_method.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
6f727853cee41195b67ee5d793c1ac23fe1a6ae0,b2674c1fd725b43adf51af7935c780359d70c2a4: [Backport #17482]
only main thread can modify vm->ubf_async_safe
vm->ubf_async_safe is VM global resource and only main thread
can manipulate it.
[Bug #17482]
---
thread.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
unblock thread is only for main ractor.
other ractors should not have a unblock thread.
This patch fixes 6f727853cee41195b67ee5d793c1ac23fe1a6ae0.
---
thread.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
|
Fixed varargs in `rb_bug_without_die` [Bug #17603]
---
error.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
598b7988f4f332c2d974bde6bc8be299150e2dce,4a06cb31170789f6fc0b1ce069bccab9d731c8bf: [Backport #17604]
Bundle RBS 1.0.4 (#4136)
---
gems/bundled_gems | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Update TypeProf to 0.12.0 (#4132)
---
gems/bundled_gems | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
NetBSD build update. (#4079)
---
addr2line.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
|
|
Implement NameError::message#clone for Ractor
---
bootstraptest/test_ractor.rb | 13 +++++++++++++
error.c | 35 +++++++++++++++++++++++++++++++++--
test/objspace/test_objspace.rb | 9 +++++++++
3 files changed, 55 insertions(+), 2 deletions(-)
|
|
Removed YYUSE [Bug #17582]
Although it was used just to suppress an "unsed argument" warning
in the same manner as other bison-provided functions, it has been
dropped since Bision 3.7.5. And we always suppress that
warnings.
---
parse.y | 1 -
1 file changed, 1 deletion(-)
|
|
Forward keyword arguments for Pathname#each_line [Bug #17589]
---
ext/pathname/pathname.c | 4 ++--
test/pathname/test_pathname.rb | 26 ++++++++++++++++++++++++++
2 files changed, 28 insertions(+), 2 deletions(-)
|
|
Mark pattern labels as unremoveable
Peephole optimization doesn't play well with find pattern at
least. The only case when a pattern matching could have
unreachable patterns is when we have lasgn/dasgn node, which
shouldn't happen in real-life.
Fixes https://bugs.ruby-lang.org/issues/17534
---
compile.c | 2 +-
test/ruby/test_pattern_matching.rb | 10 ++++++++++
2 files changed, 11 insertions(+), 1 deletion(-)
|
|
Warn the defined location as deprecation as well as the main message
[Bug #17575]
---
test/ruby/test_defined.rb | 17 +++++++++++++++++
vm_method.c | 3 ++-
2 files changed, 19 insertions(+), 1 deletion(-)
|
|
9efd590a13d1e8b8a141c46eabb48c2a1c286d2b,a55eb9a2af7950d180d9d31ffde2bce66710f44f: [Backport #17572]
Rationalize floats in coerce [Bug #17572]
---
rational.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
Make reciprocal properly of non-integral rational [Bug #17572]
---
rational.c | 2 +-
test/ruby/test_rational.rb | 7 +++++++
2 files changed, 8 insertions(+), 1 deletion(-)
|
|
objspace_dump.c: Handle allocation path and line missing
---
ext/objspace/objspace_dump.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
|
|
Fixed premature return
After setting ruby2_keywords for bmethod, the rest of arguments
had been ignored. [Bug #17558]
---
test/ruby/test_keyword.rb | 9 +++++++++
vm_method.c | 2 +-
2 files changed, 10 insertions(+), 1 deletion(-)
|
|
|
|
Include missing AvailabilityMacros.h
---
random.c | 4 ++++
1 file changed, 4 insertions(+)
|
|
Fix Ripper with heredoc.
---
ext/ripper/lib/ripper/lexer.rb | 1 +
test/ripper/test_lexer.rb | 10 ++++++++++
2 files changed, 11 insertions(+)
|
|
Don't try to clear cache on garbage objects
Method cache can be cleared during lazy sweeping. An object that will
be collected during lazy sweep *should not* have it's method cache
cleared. Soon-to-be-collected objects can be in an inconsistent state and
this can lead to a crash. This patch just leaves early if the object is
going to be collected.
Fixes [Bug #17536]
Co-Authored-By: John Hawthorn <john@hawthorn.email>
Co-Authored-By: Alan Wu <XrXr@users.noreply.github.com>
---
vm_method.c | 1 +
1 file changed, 1 insertion(+)
|
|
efcdf68e6443ab70fbff1703b9dabbfc5090df31,5e26619660f20272a53c7f839dde36cce034bb35: [Backport #17539]
Guard callinfo
Callinfo was being written in to an array and the GC would not see the
reference on the stack. `new_insn_send` creates a new callinfo object,
then it calls `new_insn_core`. `new_insn_core` allocates a new INSN
linked list item, which can end up calling `xmalloc` which will trigger
a GC:
https://github.com/ruby/ruby/blob/70cd351c7c71c48ee18d7c01e851a89614086f8f/compile.c#L968-L969
Since the callinfo object isn't on the stack, the GC won't see it, and
it can get collected. This patch just refactors `new_insn_send` to keep
the object on the stack
Co-authored-by: John Hawthorn <john@hawthorn.email>
---
compile.c | 7 +++++--
test/ruby/test_gc.rb | 10 ++++++++++
2 files changed, 15 insertions(+), 2 deletions(-)
Fix WB for callinfo
The WB for callinfo needs to be executed *after* the reference is
written. Otherwise we get a WB miss.
---
compile.c | 1 +
1 file changed, 1 insertion(+)
|