96196 Commits

Author SHA1 Message Date
John Hawthorn
73e930f9f9 JIT: Move EC offsets to jit_bindgen_constants
Co-authored-by: Alan Wu <alanwu@ruby-lang.org>
2025-12-18 13:43:45 -08:00
John Hawthorn
b1c3060bed Co-authored-by: Luke Gruber <luke.gru@gmail.com>
Co-authored-by: Alan Wu <alanwu@ruby-lang.org>

YJIT: Support calling bmethods in Ractors

Co-authored-by: Luke Gruber <luke.gru@gmail.com>

Suggestion from Alan
2025-12-18 13:43:45 -08:00
John Hawthorn
345ea0c8e1 YJIT: Support calling bmethods in Ractors
Co-authored-by: Luke Gruber <luke.gru@gmail.com>
2025-12-18 13:43:45 -08:00
John Hawthorn
63b082cf0e Store ractor_id directly on EC
This is easier to access as ec->ractor_id instead of pointer-chasing through
ec->thread->ractor->ractor_id

Co-authored-by: Luke Gruber <luke.gru@gmail.com>
2025-12-18 13:43:45 -08:00
Luke Gruber
aace29d485
Check for NULL fields in TYPEDDATA memsize functions (#15633)
Some TYPEDDATA objects allocate struct fields using the GC right after
they get created, and in that case the VM can try to perform a GC and join
a barrier if another ractor started one. If we're dumping the heap in another
ractor, this acquires a barrier and it will call the `rb_obj_memsize` function on this
object. We can't assume these struct fields are non-null. This also goes for C extensions,
which may cause problems with heap dumping from a ractor if their memsize functions aren't
coded correctly to check for NULL fields. Because dumping the heap from a ractor is likely a
rare scenario and it has only recently been introduced, we'll have to see how this works in
practice and if it causes bugs.
2025-12-18 15:42:49 -05:00
Luke Gruber
a7eb1879ad
[DOC] small improvements to ractor class docs (#15584)
* Ractor.yield no longer exists
* Ractor.shareable_proc returns a copy of the given proc
* Improve wording for monitoring/unmonitoring ports
2025-12-18 15:08:36 -05:00
Jean Boussier
fb1dd92d30 thread_sync.c: rename mutex_trylock internal function
[Bug #21793]

To fix a naming conflict on solaris.
2025-12-18 21:07:55 +01:00
Jean Boussier
8cf4f373ff thread_sync.c: declare queue_data_type as parent of szqueue_data_type.
Allows to remove some duplicated code like szqueue_length, etc.
2025-12-18 20:57:05 +01:00
Jean Boussier
bbc684d830 thread_sync.c: simplify check_array
If the queue was allocated without calling initialize,
`ary` will be `0`.
2025-12-18 20:57:05 +01:00
Jean Boussier
57c4cd9a47 thread_sync.c: eliminate GET_EC() from queue_do_pop
We receive the ec as argument, it's much cheaper to pass it
around that to look it up again.
2025-12-18 20:57:05 +01:00
John Hawthorn
28c2a5b2a4 Fix env debug assertion failure w/ Ractors+JITs
Previously when using a JIT and Ractors at the same time with debug
assertions turned on this could rarely fail with:

    vm_core.h:1448: Assertion Failed: VM_ENV_FLAGS:FIXNUM_P(flags)

When using Ractors, any time the VM lock is acquired, that may join a
barrier as another Ractor initiates GC. This could be made to happen
reliably by replacing the invalidation with a call to rb_gc().

This assertion failure happens because

    VM_STACK_ENV_WRITE(ep, 0, (VALUE)env);

Is setting VM_ENV_DATA_INDEX_FLAGS to the environment, which is not a
valid set of flags (it should be a fixnum). Although we update cfp->ep,
rb_execution_context_mark will also mark the PREV_EP, and until the
recursive calls to vm_make_env_each all finish the "next" ep may still
be pointing to the stack env we've just escaped.

I'm not completely sure why we need to store this on the stack - why is
setting cfp->ep not enough? I'm also not sure why
rb_execution_context_mark needs to mark the prev_ep.
2025-12-18 11:03:23 -08:00
Luke Gruber
74bfb1606d
Remove assertion in encoded_iseq_trace_instrument (#15616)
`encoded_iseq_trace_instrument` is safe to call in a ractor if the iseq
is new. In that case, the VM lock is not taken. This assertion was added in
4fb537b1ee28bb37dbe551ac65c279d436c756bc.
2025-12-18 13:51:33 -05:00
Jean Boussier
0e719239c2 thread_sync: Mutex keep rb_thread_t * instead of VALUE
We never need the actual thread object and this avoid any issue
if the thread object is ever moved.
2025-12-18 19:37:14 +01:00
Luke Gruber
bfd28d581c
make rb_singleton_class ractor safe (#15591)
Since singleton classes are created lazily, we need to make sure that
we lock around their creation.  Unfortunately, that means we need to
lock around every shareable object's call to `singleton_class`,
including classes and modules.
2025-12-18 12:37:27 -05:00
Stan Lo
f133ebb2db
Bump RDoc to 7.0.1 (#15628)
This improves several enhancements to the Aliki theme. And since Aliki
also became the default theme, we don't need to specify the generator name
anymore.
2025-12-18 16:12:47 +00:00
git
9f266ae674 Update default gems list at 0e85881e0cded6ec82ef105b5ff2d0 [ci skip] 2025-12-18 07:47:43 +00:00
Hiroshi SHIBATA
0e85881e0c [ruby/delegate] v0.6.1
https://github.com/ruby/delegate/commit/90ffceb6d6
2025-12-18 16:46:29 +09:00
Hiroshi SHIBATA
0006591407 Reapply "Merge pull request #52 from ruby/revert-49"
This reverts commit 02e4b58b615d0dd83a6af5cd7c2b8861724011ee.
2025-12-18 16:46:29 +09:00
Hiroshi SHIBATA
2fcad967aa Revert "Allow use of DelegateClass in ractor"
This reverts commit 6e0f2b31f0f4a2a942f3c1daad1bb64852fe6815.
2025-12-18 16:46:29 +09:00
Hiroshi SHIBATA
1e69d688e5 [ruby/delegate] v0.6.0
https://github.com/ruby/delegate/commit/aef34e8c8b
2025-12-18 16:46:29 +09:00
Luke Gruber
e6ca8908c1 Allow use of DelegateClass in ractor
Use `eval` instead of `define_method` when defining delegate methods for
`DelegateClass`.
2025-12-18 16:46:29 +09:00
Hiroshi SHIBATA
a21fe2adfe [ruby/delegate] Reapply "Merge pull request #46 from byroot/use-forward-send"
This reverts commit https://github.com/ruby/delegate/commit/fc2bd0498af0.

https://github.com/ruby/delegate/commit/7d5c1e0842

Co-authored-by: Jean Boussier <byroot@ruby-lang.org>
2025-12-18 16:46:29 +09:00
Hiroshi SHIBATA
bdf99bf0dc [ruby/delegate] v0.5.0
https://github.com/ruby/delegate/commit/fa35b20eca
2025-12-18 16:46:29 +09:00
Luke Gruber
01e9f95cc3 [ruby/delegate] Allow use of DelegateClass in ractors
Tempfile uses DelegateClass and Tempfile should be able to be used
by different ractors.

https://github.com/ruby/delegate/commit/cad194260b
2025-12-18 16:46:29 +09:00
Nobuyoshi Nakada
85ff21c9e5 RBOOL is unnecessary in C boolean context
Fix a `-Wint-in-bool-context` warning.

```
proc.c:688:33: warning: '?:' using integer constants in boolean context [-Wint-in-bool-context]
  688 |     if (RBOOL(get_local_variable_ptr(&env, idItImplicit, FALSE))) {
```
2025-12-18 16:42:20 +09:00
dependabot[bot]
74b18b5382 Bump github.com/microsoft/vcpkg from master to 2025.12.12
Bumps [github.com/microsoft/vcpkg](https://github.com/microsoft/vcpkg) from master to 2025.12.12. This release includes the previously tagged commit.
- [Release notes](https://github.com/microsoft/vcpkg/releases)
- [Commits](74e6536215...84bab45d41)

---
updated-dependencies:
- dependency-name: github.com/microsoft/vcpkg
  dependency-version: 2025.12.12
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-18 16:39:01 +09:00
Étienne Barrié
769c6a1c54 [DOC] Use Arrays in examples for Array#find 2025-12-17 21:22:39 -08:00
Nobuyoshi Nakada
b816f7bac5
[DOC] Fix documents of rb_intern_str and so on
* `rb_intern_str`: the argument must be `T_STRING`, no conversion.

* `rb_intern_str`, `rb_check_id`, `rb_to_id`, `rb_check_symbol`: raise
  `EncodingError` unless the "name" argument is a valid string in its
  encoding.
2025-12-18 11:27:05 +09:00
Nobuyoshi Nakada
f2d2a757d1
[DOC] Re-fill the paragraph 2025-12-18 10:14:40 +09:00
Augustin Gottlieb
cfa3e7cf75
[DOC] Fix double-word typos in comments
Found via `grep` for repeated words.

* set.c: Fix "or or"
* include/ruby/internal/symbol.h: Fix "is is"
* include/ruby/internal/ctype.h: Fix "in in"
v4.0.0-preview3
2025-12-18 09:34:32 +09:00
Alan Wu
656de67d5c JITs: Pass down GNU make jobserver resources when appropriate
To fix warnings from rustc on e.g. Make 4.3, which is in Ubuntu 24.04:

> warning: failed to connect to jobserver from environment variable
2025-12-17 14:49:32 -05:00
Victor Shepelev
ef3ac3e68c
Adjust Set documentation (#15547) 2025-12-17 21:22:55 +02:00
Luke Gruber
839410f073 Fix heap dump with ractor barrier
When a ractor was being initialized and it would join the heap dump barrier when
allocating its queue or its ports, the heap dump code calls `rb_obj_memsize` on
the ractor and this function assumed `ports` was never NULL. We need to check for
the NULL case in case the ractor is still being initialized. Hopefully other T_DATA
objects don't suffer from the same issue, otherwise we could revert the ractor barrier
during heap dump or not use `rb_obj_memsize` on T_DATA during the heap dump.
2025-12-17 11:12:57 -08:00
Luke Gruber
601ac78caf
[DOC] Small changes to docs for ObjectSpace#each_object (#15564)
Change example to use user-defined class instead of `Numeric`.
2025-12-17 14:00:58 -05:00
Takashi Kokubun
f7120860b0 test_sync_default_gems.rb: Omit if git is v2.43 or older 2025-12-17 10:45:57 -08:00
Takashi Kokubun
dc2a62e14c test_commit_email.rb: Ensure #teardown doesn't fail
if test is omitted.

Follow up c4e090def134f9b109991b74c027648564963763
2025-12-17 10:22:00 -08:00
git
a9526ab50c Update bundled gems list as of 2025-12-17 2025-12-17 18:05:21 +00:00
tomoya ishida
7e13fbc0ed
Update bundled bigdecimal and rbs (#15611)
* Bundle rbs-3.10.0.pre.1

* Update rbs gem entry with commit hash

Updated rbs entry to include commit hash.

* Fix rbs entry in bundled_gems

* Update rbs gem to version 3.10.0.pre.2

Updated rbs gem version from 3.10.0.pre.1 to 3.10.0.pre.2.

* Update bundled bigdecimal to v4.0.1

---------

Co-authored-by: Soutaro Matsumoto <matsumoto@soutaro.com>
2025-12-18 03:04:49 +09:00
Luke Gruber
56b67f1684
ObjectSpace.{dump,dump_all,dump_shapes} needs vm barrier. (#15569)
This allows these methods to be called from ractors.

Add new exported function `rb_vm_lock_with_barrier()` that requires
users to include "vm_sync.h"
2025-12-17 12:17:30 -05:00
Misaki Shioi
41e24aeb1a
Improve NEWS.md for Socket (#15610) 2025-12-17 22:06:53 +09:00
Yusuke Endoh
aee4b24829 [ruby/error_highlight] Show no message when failing to get caller/callee snippets
Even with Ruby 4.0, snippets is not always available, such as in irb by
default. It would be better to just say nothing than to show a confusing
message.

https://github.com/ruby/error_highlight/commit/ef80ce73a1
2025-12-17 21:11:27 +09:00
Akinori Musha
c99670d668 Revert the default size of Enumerator::Producer to infinity
[Bug #21780]
2025-12-17 18:56:22 +09:00
Misaki Shioi
f45b1e3a1b
Update NEWS.md for Socket (#15608) 2025-12-17 18:53:34 +09:00
Nobuyoshi Nakada
bd4353ba7a CI: Assume all C source files are UTF-8 now 2025-12-17 17:38:52 +09:00
Nobuyoshi Nakada
f286e70019 win32: Set the source code charset to UTF-8 2025-12-17 17:38:52 +09:00
Nobuyoshi Nakada
61bab18890 Rename to struct rbimpl_size_overflow_tag
This struct is used for addition not only for multiplication, so
remove the word `mul`, and make the member names more descriptive.
2025-12-17 17:35:58 +09:00
Akinori Musha
79f36c544a Revert the override of Enumerator#to_set that performed size checks
[Bug #21780]
2025-12-17 17:30:24 +09:00
Misaki Shioi
54d3945ee5
Add host information to timeout error messages in TCPSocket.new and Socket.tcp (#15582)
This change adds host information to the error messages shown when a timeout occurs while passing timeout options to `TCPSocket.new` or `Socket.tcp`, for improved usability.
(When the `fast_fallback option` is enabled, there may be multiple possible destinations, so the host name is shown instead of an IP address.)

As part of this change, the error messages in `Addrinfo.getaddrinfo` and `Addrinfo#connect_internal`, both of which are used by `Socket.tcp`, have also been improved in the same way.
2025-12-17 16:16:32 +09:00
Yusuke Endoh
1506c489ee Update NEWS.md for improvements of error backtrace 2025-12-17 16:12:28 +09:00
git
38310fe79d Update default gems list at 26447b3597ab95af7cc220c641a1bd [ci skip] 2025-12-17 06:48:34 +00:00