Commit graph

92496 commits

Author SHA1 Message Date
Erik Berlin
e6cd79cd31 Consolidate octal and hexadecimal parsing logic
Both ruby_scan_oct and ruby_scan_hex call the generic ruby_scan_digits
helper, avoiding duplicate implementations.
2025-06-27 21:54:01 +09:00
Alan Wu
8e75a36129 ZJIT: Add TODOs and omitted test for nested scope local access 2025-06-27 20:42:38 +09:00
Alan Wu
b125fb56c9 ZJIT: Function::find(): Use find_vec!() more 2025-06-27 20:42:38 +09:00
Alan Wu
ed4b8d35a2 ZJIT: Function::find(): Use clone() instead of doing it manually 2025-06-27 20:42:38 +09:00
Alan Wu
7874321e82 ZJIT: Add codegen for GetLocal and SetLocal
They're only used when level≠0. Same EP hopping logic as interpreter and
YJIT. Change assert_compiles() to get ISeq by method name since the old
code didn't support methods defined using define_method() which I need
for the new test.
2025-06-27 20:42:38 +09:00
Alan Wu
ff09cf199d ZJIT: getlocal and setlocal to HIR 2025-06-27 20:42:38 +09:00
Nobuyoshi Nakada
fe9a3be296
Fix the unknown warning group on wasm 2025-06-27 16:29:11 +09:00
Nobuyoshi Nakada
64a52c25fe [ruby/io-console] Fix a name error
e0398acad4
2025-06-27 07:25:37 +00:00
Nobuyoshi Nakada
528b75cc14 [ruby/io-console] Ignore printed control char
It's something we don't expect and might be coming from somewhere
else.

c5e47a900c
2025-06-27 07:23:09 +00:00
Nobuyoshi Nakada
495613ffd3 [ruby/io-console] Revert "Ignore ^C at interrupt"
This reverts commit f0646b2b6a.

2e0e01263a
2025-06-27 07:23:09 +00:00
Nobuyoshi Nakada
7ce3392449
[Bug #21453] Override files in gemspec file before eval
`executables` are often extracted from the `files` in gemspec files.
2025-06-27 15:16:39 +09:00
Hiroshi SHIBATA
8bba087ae5 Added entry open_timeout feature of Socket.tcp to NEWS.md 2025-06-27 11:15:17 +09:00
Hiroshi SHIBATA
cf3acead9d Use https://github.com/ruby/power_assert/pull/58 2025-06-27 11:14:50 +09:00
Kenyon Ralph
d6eecec2ec
[DOC] Fix backquote exit status docs
It is `exitstatus`, not `status`, per 3d5619c8b1/process.c (L581)
2025-06-27 10:09:31 +09:00
Takashi Kokubun
f8cd26736f
ZJIT: Stop loading an extra parameter (#13719) 2025-06-26 14:06:49 -07:00
Peter Zhu
26508bbc46 Fix flaky TestGc#test_heaps_grow_independently
The test sometimes fails with "Expected 2062788 to be < 2000000" because
heap 0 has not been cleared yet by GC. This commit fixes it to run GC
before the assertion to ensure that it does not flake.
2025-06-26 16:38:39 -04:00
Max Bernstein
aca692cd41
ZJIT: Disable profiling instructions before asserting opcodes in tests (#13720) 2025-06-26 16:24:22 -04:00
Aaron Patterson
3d5619c8b1 Introduce Namespace#eval
This commit adds an `eval` method to `Namespace` that takes a string and
evaluates the string as Ruby code within the context of that namespace.

For example:

```ruby
n = Namespace.new

n.eval("class TestClass; def hello; 'from namespace'; end; end")

instance = n::TestClass.new
instance.hello # => "from namespace"
```

[Feature #21365]
2025-06-26 10:18:14 -07:00
Jean Boussier
242343ff80 variable.c: Refactor generic_field_set / generic_ivar_set
These two functions are very similar, they can share most of their
logic.
2025-06-26 16:25:57 +02:00
Peter Zhu
a4948c30fd Add debug message to assertion for checking GC mode
We assert that the GC is not in a cycle in gc_start, but it does not show
what phase we're in if the assertion fails. This commit adds a debug
message for when the assertion fails.
2025-06-26 09:37:55 -04:00
Peter Zhu
80f53eba40 Support message in GC_ASSERT
RUBY_ASSERT_MESG_WHEN supports a format string at the end for additional
information. This commit adds support for that in GC_ASSERT.
2025-06-26 09:37:55 -04:00
Nobuyoshi Nakada
b1c09faf67
Win32: Use SIG_GET to get the current value of the signal 2025-06-26 17:38:36 +09:00
Hiroshi SHIBATA
7d01905ef1 typeprof, rbs and repl_type_completor are working with HEAD now 2025-06-26 17:37:04 +09:00
Erik Berlin
5e9be99ef5 Fix loop variable type in compile.c 2025-06-26 13:28:24 +09:00
Nobuyoshi Nakada
4b1de7378d [ruby/uri] [DOC] State that uri library is needed to call Kernel#URI
So that the example works as-is.

30212d311e
2025-06-26 01:46:48 +00:00
Nobuyoshi Nakada
4eba511c1b [ruby/uri] Fix a typo
b636e83d99

Co-authored-by: Olle Jonsson <olle.jonsson@gmail.com>
2025-06-26 01:39:20 +00:00
Nobuyoshi Nakada
228cc794f5 [ruby/uri] Use Lo category chars as escaped chars
TruffleRuby does not allow Symbol categories as identifiers.

5531d42375
2025-06-26 01:39:20 +00:00
Nobuyoshi Nakada
42f753d829 [ruby/uri] Escape reserved characters in scheme name
Fix https://github.com/ruby/uri/pull/89

d543c0dafa
2025-06-26 01:39:19 +00:00
David Rodríguez
90085f62fb [rubygems/rubygems] Simulate Bundler 4 in a better way
Overriding the version constant feels too magic and creates a set of
problems. For example, Bundler will lock the simulated version, and that
can cause issues when the lockfile is used under an environment not
simulating Bundler 4 (it will try to auto-install and auto-switch to a
version that does not exist).

On top of that, it can only be configured with an ENV variable which is
not too flexible.

This commit takes a different approach of using a setting, which is
configurable through ENV or `bundle config`, and pass the simulated
version to `Bundler::FeatureFlag`. The real version is still the one set
by `VERSION`, but anything that `Bundler::FeatureFlag` controls will use
the logic of the "simulated version".

In particular, all feature flags and deprecation messages will respect
the simulated version, and this is exactly the set of functionality that
we want users to be able to easily try before releasing it.

8129402193
2025-06-26 08:06:48 +09:00
David Rodríguez
938ab128a4 [rubygems/rubygems] Remove unnecessary version check
The `inject` command is deprecated, so these specs only run for Bundler
3 and checking this is unnecessary.

c89fb788f8
2025-06-26 08:06:47 +09:00
David Rodríguez
54e51f1fc3 [rubygems/rubygems] Make yet one more update spec independent of running version
07762f6c1f
2025-06-26 08:06:46 +09:00
David Rodríguez
782d8287c3 [rubygems/rubygems] Remove hardcoded version check from one clean spec
9244cca381
2025-06-26 08:06:46 +09:00
David Rodríguez
7e0358e04f [rubygems/rubygems] Make one more update spec independent of running version
dcd8e8210f
2025-06-26 08:06:45 +09:00
David Rodríguez
18618810a2 [rubygems/rubygems] Use Gem::Version` methods instead of string splitting
75fed35264
2025-06-26 08:06:44 +09:00
David Rodríguez
f32dbc9bb0 [rubygems/rubygems] Centralize managing major version dependent behavior in FeatureFlag class
7708e5b784
2025-06-26 08:06:44 +09:00
David Rodríguez
168e7fc300 [rubygems/rubygems] Remove redundant receivers
d7b9c4532e
2025-06-26 08:06:43 +09:00
David Rodríguez
a9860b6cb1 [rubygems/rubygems] No need to reset this variable
f96fedf1f1
2025-06-26 08:06:42 +09:00
David Rodríguez
a2fb1d7dca [rubygems/rubygems] Reorganize post bundle message specs to run independently of major version
70c69c45ba
2025-06-26 08:06:42 +09:00
David Rodríguez
4e74f55db7 [rubygems/rubygems] Use nicer indentation
7e959adce6
2025-06-26 08:06:41 +09:00
David Rodríguez
428627ab68 [rubygems/rubygems] Simplify pristine spec to not need checking major version
bd2a170330
2025-06-26 08:06:40 +09:00
John Hawthorn
6b7f56d2db Never use flags on T_NODE
Previously, any time we used FL_TEST or variations we would need to add
an additional test that it wasn't a T_NODE. I think that was only needed
historically and we can avoid generating that extra code.
2025-06-25 15:58:53 -07:00
Luke Gruber
3c66eb3358 Change def->method_serial to be atomic
`rb_method_definition_create` can be called across different ractors at the same time, so `def->method_serial` should be atomic.
2025-06-25 15:43:57 -07:00
Luke Gruber
328e3029d8 Get String#crypt working with multi-ractor in cases where !HAVE_CRYPT_R
In commit 12f7ba5ed4, ractor safety was added to String#crypt, however
in certain cases it can cause a deadlock. When we lock a native mutex,
we cannot allocate ruby objects because they might trigger GC which
starts a VM barrier. If the barrier is triggered and other native threads
are waiting on this mutex, they will not be able to be woken up in order to join
the barrier. To fix this, we don't allocate ruby objects when we hold the
lock.

The following could reproduce the problem:

```ruby
strings = []
10_000.times do |i|
  strings << "my string #{i}"
end

STRINGS = Ractor.make_shareable(strings)

rs = []
100.times do
  rs << Ractor.new do
    STRINGS.each do |s|
      s.dup.crypt(s.dup)
    end
  end
end
while rs.any?
  r, obj = Ractor.select(*rs)
  rs.delete(r)
end
```

I will not be adding tests because I am almost finished a PR to enable
running test-all test cases inside many ractors at once, which is how I
found the issue.

Co-authored-by: jhawthorn <john@hawthorn.email>
2025-06-25 14:11:08 -07:00
Kazuki Yamaguchi
a1996b32a9 [ruby/openssl] pkey: use EVP_PKEY_new_raw_{private,public}_key_ex() if available
Algorithms implemented only in OpenSSL 3 providers may not have a
corresponding NID. The *_ex() variants have been added in OpenSSL 3.0
to handle such algorithms, by taking algorithm names as a string.

e730e457cc
2025-06-25 17:13:11 +00:00
Kazuki Yamaguchi
0c6075bd42 [ruby/openssl] pkey: handle EVP_PKEY_KEYMGMT return by EVP_PKEY_id()
For algorithms implemented solely in an OpenSSL 3 provider, without an
associated EVP_PKEY_METHOD, EVP_PKEY_id() returns a special value
EVP_PKEY_KEYMGMT.

Let OpenSSL::PKey::PKey#oid raise an exception as necessary.
Update PKey#inspect to include the string returned by
EVP_PKEY_get0_type_name(), if available.

bd3e32270e
2025-06-25 17:13:11 +00:00
Kazuki Yamaguchi
ca0a315f36 [ruby/openssl] ossl.h: include <openssl/provider.h> in ossl.h
Move the #include from ossl_provider.c to ossl.h. As OpenSSL 3 provider
functions will be used in multiple source files, having it in the
common header file is convenient.

f831bb66bc
2025-06-25 17:13:10 +00:00
Peter Zhu
aed7a95f9d Move RUBY_ATOMIC_VALUE_LOAD to ruby_atomic.h
Deduplicates RUBY_ATOMIC_VALUE_LOAD by moving it to ruby_atomic.h.
2025-06-25 13:04:25 -04:00
Burdette Lamar
ec071c849f
[DOC] Tweaks for String#byterindex (#13485) 2025-06-25 10:51:45 -04:00
David Rodríguez
077dbb8d42 [rubygems/rubygems] Remove unnecessary loading of fileutils from path specs
These specs load artifice before Bundler boots because of their global
rubygems source. Artifice in turn loads `rack`, `rack-test`, and
`tmpdir` which in turn load `fileutils`.

Because of this, a missing `require` of `fileutils` in RubyGems would
not be caught by specs.

Loading artifice is not necessary for most of these specs, so remove the
global source to avoid it.

aad871c997
2025-06-25 22:41:55 +09:00
David Rodríguez
c17d381d67 [rubygems/rubygems] Remove message long gone from the code base from expectations
2eaada3508
2025-06-25 22:41:52 +09:00