95387 Commits

Author SHA1 Message Date
Burdette Lamar
319001192d
[DOC] Tweaks for String#dump and String#undump 2025-11-18 21:56:14 -05:00
dependabot[bot]
3ee08c8df8 Bump actions/checkout in /.github/actions/setup/directories
Bumps [actions/checkout](https://github.com/actions/checkout) from 5.0.0 to 5.0.1.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](08c6903cd8...93cb6efe18)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 5.0.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-19 11:52:11 +09:00
Nobuyoshi Nakada
a6cecda1dc [ruby/etc] Win32: Drop support for older MSVC
Ruby 2.7 supports MSVC 12.0/_MSC_VER 1800 or later.

https://github.com/ruby/etc/commit/6f4404ec88
2025-11-19 02:31:03 +00:00
Nobuyoshi Nakada
685903e56e [ruby/etc] Bump up the required ruby version to 2.7
https://github.com/ruby/etc/commit/d047bb6856
2025-11-19 02:31:03 +00:00
Peter Zhu
f040b94cf5 [ruby/mmtk] Ensure not blocking for GC in rb_gc_impl_before_fork
In rb_gc_impl_before_fork, it locks the VM and barriers all the Ractors
before calling mmtk_before_fork. However, since rb_mmtk_block_for_gc is
a barrier point, one or more Ractors could be paused there. However,
mmtk_before_fork is not compatible with that because it assumes that the
MMTk workers are idle, but the workers are not idle because they are
busy working on a GC.

This commit essentially implements a trylock. It will optimistically
lock but will release the lock if it detects that any other Ractors are
waiting in rb_mmtk_block_for_gc.

For example, the following script demonstrates the issue:

    puts "Hello #{Process.pid}"

    100.times do |i|
      puts "i = #{i}"
      Ractor.new(i) do |j|
        puts "Ractor #{j} hello"
        1000.times do |i|
          s = "#{j}-#{i}"
        end
        Ractor.receive
        puts "Ractor #{j} goodbye"
      end
      pid = fork { }
      puts "Child pid is #{pid}"
      _, status = Process.waitpid2 pid
      puts status.success?
    end

    puts "Goodbye"

We can see the MMTk worker thread is waiting to start the GC:

    #4  0x00007ffff66538b1 in rb_mmtk_stop_the_world () at gc/mmtk/mmtk.c:101
    #5  0x00007ffff6d04caf in mmtk_ruby::collection::{impl#0}::stop_all_mutators<mmtk::scheduler::gc_work::{impl#14}::do_work::{closure_env#0}<mmtk::plan::immix::gc_work::ImmixGCWorkContext<mmtk_ruby::Ruby, 0>>> (_tls=..., mutator_visitor=...) at src/collection.rs:23

However, the mutator thread is stuck in mmtk_before_fork trying to stop
that worker thread:

    #4  0x00007ffff6c0b621 in std::sys:🧵:unix::Thread::join () at library/std/src/sys/thread/unix.rs:134
    #5  0x00007ffff6658b6e in std:🧵:JoinInner<()>::join<()> (self=...)
    #6  0x00007ffff6658d4c in std:🧵:JoinHandle<()>::join<()> (self=...)
    #7  0x00007ffff665795e in mmtk_ruby::binding::RubyBinding::join_all_gc_threads (self=0x7ffff72462d0 <mmtk_ruby::BINDING+8>) at src/binding.rs:115
    #8  0x00007ffff66561a8 in mmtk_ruby::api::mmtk_before_fork () at src/api.rs:309
    #9  0x00007ffff66556ff in rb_gc_impl_before_fork (objspace_ptr=0x555555d17980) at gc/mmtk/mmtk.c:1054
    #10 0x00005555556bbc3e in rb_gc_before_fork () at gc.c:5429

https://github.com/ruby/mmtk/commit/1a629504a7
2025-11-19 02:08:49 +00:00
Peter Zhu
69b1c567d7 [ruby/mmtk] Add VM barrier in rb_gc_impl_before_fork
We need the VM barrier in rb_gc_impl_before_fork to stop the other Ractors
because otherwise they could be allocating objects in the fast path which
could be calling mmtk_add_obj_free_candidate. Since mmtk_add_obj_free_candidate
acquires a lock on obj_free_candidates in weak_proc.rs, this lock may not
be released in the child process after the Ractor dies.

For example, the following script demonstrates the issue:

    puts "Hello #{Process.pid}"

    100.times do |i|
      puts "i = #{i}"
      Ractor.new(i) do |j|
        puts "Ractor #{j} hello"
        1000.times do |i|
          s = "#{j}-#{i}"
        end
        Ractor.receive
        puts "Ractor #{j} goodbye"
      end
      pid = fork { }
      puts "Child pid is #{pid}"
      _, status = Process.waitpid2 pid
      puts status.success?
    end

    puts "Goodbye"

In the child process, we can see that it is stuck trying to acquire the
lock on obj_free_candidates:

    #5  0x00007192bfb53f10 in mmtk_ruby::weak_proc::WeakProcessor::get_all_obj_free_candidates (self=0x7192c0657498 <mmtk_ruby::BINDING+72>) at src/weak_proc.rs:52
    #6  0x00007192bfa634c3 in mmtk_ruby::api::mmtk_get_all_obj_free_candidates () at src/api.rs:295
    #7  0x00007192bfa61d50 in rb_gc_impl_shutdown_call_finalizer (objspace_ptr=0x578c17abfc50) at gc/mmtk/mmtk.c:1032
    #8  0x0000578c1601e48e in rb_ec_finalize (ec=0x578c17ac06d0) at eval.c:166
    #9  rb_ec_cleanup (ec=<optimized out>, ex=<optimized out>) at eval.c:257
    #10 0x0000578c1601ebf6 in ruby_cleanup (ex=<optimized out>) at eval.c:180
    #11 ruby_stop (ex=<optimized out>) at eval.c:292
    #12 0x0000578c16127124 in rb_f_fork (obj=<optimized out>) at process.c:4291
    #13 rb_f_fork (obj=<optimized out>) at process.c:4281

https://github.com/ruby/mmtk/commit/eb4b229858
2025-11-19 02:08:49 +00:00
Nobuyoshi Nakada
1f2913e741 Win32: Drop support for older than MSVC 14.0/_MSC_VER 1900
Visual C++ 2015 (14.0):
- _MSC_VER: 1900
- MSVCRT_VERSION: 140
2025-11-19 11:03:42 +09:00
Nobuyoshi Nakada
7743123551 Win32: Drop support for older than MSVC 12.0/_MSC_VER 1800
Visual C++ 2013 (12.0):
- _MSC_VER: 1800
- MSVCRT_VERSION: 120
2025-11-19 11:03:42 +09:00
Nobuyoshi Nakada
25f9e678bf Win32: Drop support for older than MSVC 10.0/_MSC_VER 1600
Visual C++ 2010 (10.0):
- _MSC_VER: 1600
- MSVCRT_VERSION: 100
2025-11-19 11:03:42 +09:00
Nobuyoshi Nakada
3dd39134cd Win32: Drop support for older than MSVC 9.0/_MSC_VER 1500
Visual C++ 2008 (9.0):
- _MSC_VER: 1500
- MSVCRT_VERSION: 90
2025-11-19 11:03:42 +09:00
Nobuyoshi Nakada
cdb9893c55 Win32: Drop support for older than MSVC 8.0/_MSC_VER 1400
Visual C++ 2005 (8.0):
- _MSC_VER: 1400
- MSVCRT_VERSION: 80
2025-11-19 11:03:42 +09:00
Alexander Momchilov
1979f8c07d [ruby/prism] Add docs for super nodes
https://github.com/ruby/prism/commit/69abcdbb18
2025-11-19 02:01:57 +00:00
Edouard CHIN
3b9539176b [ruby/rubygems] Warn users that bundle now display the help:
- In 31d67ecc05
  we enforced the new behaviour where running `bundle` no longer
  installs gems but displays the help.
  Users now have a way to configure their preferred default command using
  the `BUNDLE_DEFAULT_CLI_COMMAND` flag.

  With the preview of Ruby 4.0 now being released, some people will
  start to see this new change.

  The problem is that the previous behaviour had existed for like an
  eternity and we didn't warn users about this change in advance.
  I'd like to provide a deprecation/warning cycle because this is
  confusing users already and this breaks various CI setup that now
  needs to be changed immediately.

https://github.com/ruby/rubygems/commit/e415480ac5
2025-11-19 01:37:57 +00:00
Cody Cutrer
83b0cfe1b5 [ruby/rubygems] Handle BUNDLER_VERSION being set to an empty string
This is useful, in case you're using Docker, and an upstream
Dockerfile sets BUNDLER_VERSION to something you don't want.
It's impossible to unset it... only override to be the empty
string.

https://github.com/ruby/rubygems/commit/ffa3eb9ac6
2025-11-19 01:27:25 +00:00
John Hawthorn
1f299dd309 Fix crash in optimal size for large T_OBJECT
Previously any T_OBJECT with >= 94 IVARs would crash during compaction
attempting to make an object too large to embed.
2025-11-18 17:02:06 -08:00
Go Sueyoshi
4423facbff [ruby/rubygems] Add --ext=go to bundle gem
(https://github.com/ruby/rubygems/pull/8183)

* Add new gem templates

* Add `--ext=go` in `bundle gem`

* Add setup-go to .github/workflows/main.yml

* Embed go version in go.mod

* Use go in bundler CI

* Add example method to template

* Install Go in .circleci/config.yml

* Install Go in .gitlab-ci.yml

* Allow hard tabs in go template

* Run `rake update_manifest`

* Fix test

* Move go_gem to gemspec

Respect to 9b0ec80

* nits: 

* includes valid module name in go.mod

* generate header file

* Run `go mod tidy` to create `go.sum`

* Check if `go.sum` is generated only when Go is installed

To avoid test failure in environments where Go is not installed

* Run CI

* Workaround for hung up

c.f. https://github.com/rubygems/rubygems/actions/runs/11639408044/job/32415545422

* Write man for --ext=go

* Re-generate man with `./bin/rake man:build`

* pinning 📌

* Update with `./bin/rake man:build`

* nits: Extract to method

* nits: Use `sys_exec` instead of `system`

* Clean go module cache after test

Workaround following error

```
1) bundle gem gem naming with underscore --ext parameter set with go includes go_gem extension in extconf.rb
   Failure/Error: FileUtils.rm_r(dir)

   Errno::EACCES:
     Permission denied @ apply2files - /home/runner/work/rubygems/rubygems/bundler/tmp/2.2/home/go/pkg/mod/gopkg.in/yaml.v3@v3.0.1/decode_test.go
   # ./spec/support/helpers.rb:37:in `block in reset!'
   # ./spec/support/helpers.rb:21:in `each'
   # ./spec/support/helpers.rb:21:in `reset!'
   # ./spec/spec_helper.rb:130:in `block (2 levels) in <top (required)>'
   # /home/runner/work/rubygems/rubygems/lib/rubygems.rb:303:in `load'
   # /home/runner/work/rubygems/rubygems/lib/rubygems.rb:303:in `activate_and_load_bin_path'
```

Files installed with `go get` have permissions set to 444
ref. https://github.com/golang/go/issues/35615

```
$ ls -l /home/runner/work/rubygems/rubygems/bundler/tmp/2.2/home/go/pkg/mod/gopkg.in/yaml.v3@v3.0.1/decode_test.go
-r--r--r-- 1 runner runner 42320 Nov 15 06:38 /home/runner/work/rubygems/rubygems/bundler/tmp/2.2/home/go/pkg/mod/gopkg.in/yaml.v3@v3.0.1/decode_test.go
```

So they cannot be deleted by `FileUtils.rm_r`.
Therefore, this is necessary to execute `go clean -modcache` separately from `FileUtils.rm_r` to circumvent it.

* Remove needless changes

ref. https://github.com/ruby/rubygems/pull/8183#discussion_r2532902051

* ci: setup-go is needless

* Don't run go command in `bundle gem`

ref. https://github.com/ruby/rubygems/pull/8183#discussion_r2532765470

* Revert unrelated date changes

---------

https://github.com/ruby/rubygems/commit/260d7d60b3

Co-authored-by: Hiroshi SHIBATA <hsbt@ruby-lang.org>
2025-11-19 00:47:07 +00:00
Max Bernstein
0f89fa97e3
ZJIT: Inline BasicObject#! (#15201) 2025-11-18 19:36:29 -05:00
Alan Wu
32b8f97b34
ZJIT: Delete outdated optional param test [ci skip]
Name contradictory now, and we have other tests testing the same thing.
2025-11-18 23:50:36 +00:00
eileencodes
6f6a9ead96
[ruby/rubygems] Replace instance method look up in plugin installer
`Gem::Installer.instance_methods(false).include?(:generate_plugins)` is
63x slower than `Gem::Installer.method_defined?(:generate_plugins)` in a
microbenchmark. The latter is a direct lookup, whereas the former will
create an array, which will be slower.

```ruby
require "benchmark/ips"

Benchmark.ips do |x|
  x.report "instance_methods" do
    Gem::Installer.instance_methods(false).include?(:generate_plugins)
  end

  x.report "method_defined" do
    Gem::Installer.method_defined?(:generate_plugins)
  end

  x.compare!
end
```

```
$ ruby -I lib/ benchmark_methods.rb
ruby 3.4.4 (2025-05-14 revision https://github.com/ruby/rubygems/commit/a38531fd3f) +PRISM [arm64-darwin23]
Warming up --------------------------------------
    instance_methods    58.449k i/100ms
      method_defined     3.375M i/100ms
Calculating -------------------------------------
    instance_methods    541.874k (± 5.7%) i/s    (1.85 μs/i) -      2.747M in   5.087825s
      method_defined     34.263M (± 1.1%) i/s   (29.19 ns/i) -    172.135M in   5.024524s

Comparison:
      method_defined: 34263189.1 i/s
    instance_methods:   541874.3 i/s - 63.23x  slower
```

This does not make much difference in an overall benchmark or profile,
but this is more idiomatic Ruby than the prior code.

https://github.com/ruby/rubygems/commit/49dec52cb2
2025-11-19 07:47:19 +09:00
Jean Boussier
d5d12efde7 [ruby/json] parser.c: Remove unued JSON_ParserStruct.parsing_name
https://github.com/ruby/json/commit/ab5efca015
2025-11-18 22:45:59 +00:00
Jacob
f3f3e76882
Extract KW_SPECIFIED_BITS_MAX for JITs (GH-15039)
Rename to `VM_KW_SPECIFIED_BITS_MAX` now that it's in `vm_core.h`.
2025-11-18 22:32:11 +00:00
Shannon Skipper
cbe65ebbc3 ZJIT: Skip empty counter sections in stats 2025-11-18 16:57:47 -05:00
Shannon Skipper
6566003712 ZJIT: Avoid NaN% ratio appearing in stats 2025-11-18 16:57:47 -05:00
Luke Gruber
ff2d2fc1bd
YJIT: omit single ractor mode assumption for proc#call (#15092)
The comptime receiver, which is a proc, is either shareable or from this
ractor so we don't need to assume single-ractor mode. We should never get
the "defined with an un-shareable Proc in a different ractor" error.
2025-11-18 14:24:49 -05:00
Benoit Daloze
ce73b6c0b6 ZJIT: Pass the result of GuardNotFrozen to StoreField and WriteBarrier 2025-11-18 18:54:40 +01:00
Benoit Daloze
79633437e1 ZJIT: Rename the operand of Insn::GuardNotFrozen from val to recv
* When writing to an object, the receiver should be checked if it's frozen,
  not the value, so this avoids an error-prone autocomplete.
2025-11-18 18:54:40 +01:00
Benoit Daloze
0e10dfded0 ZJIT: Inline setting Struct fields
* Add Insn::StoreField and Insn::WriteBarrier
2025-11-18 18:54:40 +01:00
Godfrey Chan
f84bbb4238 ZJIT: add support for lazy RubyVM::ZJIT.enable
This implements Shopify#854:

- Splits boot-time and enable-time initialization,
  tracks progress with `InitializationState` enum

- Introduces `RubyVM::ZJIT.enable` Ruby method for
  enabling the JIT lazily, if not already enabled

- Introduces `--zjit-disable` flag, which can be
  used alongside the other `--zjit-*` flags but
  prevents enabling the JIT at boot time

- Adds ZJIT infra to support JIT hooks, but this
  is not currently exercised (Shopify/ruby#667)

Left for future enhancements:

- Support kwargs for overriding the CLI flags in
  `RubyVM::ZJIT.enable`

Closes Shopify#854
2025-11-18 08:35:09 -08:00
Benoit Daloze
c38486ffef ZJIT: Validate types for all instructions
* This can catch subtle errors early, so avoid a fallback case and
  handle every instruction explicitly.
2025-11-18 16:34:06 +01:00
Kazuki Yamaguchi
522b7d823f [ruby/openssl] ssl: fix test_pqc_sigalg on RHEL 9.7
RHEL 9.7 ships OpenSSL 3.5.1 with ML-DSA support, but it is disabled
for TLS by default, according to the system configuration file:
/etc/crypto-policies/back-ends/opensslcnf.config

Specify SSLContext#sigalgs to override the default list.

https://github.com/ruby/openssl/commit/fac3a26748
2025-11-18 12:49:38 +00:00
Hiroshi SHIBATA
f168a6d0c2 [ruby/rubygems] Handle to reverse order result in Ruby 3.2
https://github.com/ruby/rubygems/actions/runs/19458155903/job/55676075439?pr=3857

```
       -Did you mean 'methods' or 'method'?
       +Could not find gem 'methosd'.
       +Did you mean 'method' or 'methods'?
```

https://github.com/ruby/rubygems/commit/ab7d0fc7b0
2025-11-18 10:38:30 +00:00
Hiroshi SHIBATA
e78a96b729 [ruby/rubygems] Spelling with the latest version of did_you_mean
https://github.com/ruby/rubygems/commit/d604c1d1cb
2025-11-18 10:38:30 +00:00
Hiroshi SHIBATA
c87b36aba1 [ruby/rubygems] bin/rubocop -a
https://github.com/ruby/rubygems/commit/fee8dd2f08
2025-11-18 10:38:29 +00:00
Hiroshi SHIBATA
e3c483b51d [ruby/rubygems] Removed unused SimilarityDetector
https://github.com/ruby/rubygems/commit/40ace48651
2025-11-18 10:38:29 +00:00
Austin Pray
2c169e1588 [ruby/rubygems] More tests
https://github.com/ruby/rubygems/commit/210fa87f65
2025-11-18 10:38:28 +00:00
Austin Pray
55afec32ff [ruby/rubygems] fix tests
https://github.com/ruby/rubygems/commit/1dc669a0ab
2025-11-18 10:38:28 +00:00
Austin Pray
dd6ccb44f0 [ruby/rubygems] Progressively enhance if DidYouMean is available
https://github.com/ruby/rubygems/commit/a02353fb96
2025-11-18 10:38:28 +00:00
Austin Pray
6aa16246f7 [ruby/rubygems] Rubocop
https://github.com/ruby/rubygems/commit/a6bc30a827
2025-11-18 10:38:27 +00:00
Austin Pray
f3e8bc8770 [ruby/rubygems] use DidYouMean::SpellChecker for gem suggestions
replaces Bundler::SimilarityDetector with DidYouMean::SpellChecker

https://github.com/ruby/rubygems/commit/959bea1506
2025-11-18 10:38:26 +00:00
Hiroshi SHIBATA
a1c76c7e3a
Fixed conflict of vendor_gems.rb 2025-11-18 18:47:50 +09:00
Stan Lo
85abc59c32 [DOC] Add documentation about Ruby's VM stack 2025-11-18 16:43:24 +08:00
Scott Myron
f272aabb5c [ruby/json] Use #if instead of #ifdef when checking for JSON_DEBUG so debugging code is not generated when JSON_DEBUG=0.
https://github.com/ruby/json/commit/4f1adb10d3
2025-11-18 08:20:51 +00:00
Nobuyoshi Nakada
54c0738309 [ruby/resolv] Fix syntax error on older versions
https://github.com/ruby/resolv/commit/599f78c451
2025-11-18 07:17:31 +00:00
git
ccdf83f17a Update bundled gems list as of 2025-11-18 2025-11-18 06:52:35 +00:00
Hiroshi SHIBATA
2777021061
Downgrade net-http 0.7.0 because JRuby is not working 2025-11-18 14:55:25 +09:00
Hiroshi SHIBATA
59461d1237
Use released version of net-http-0.8.0 2025-11-18 14:55:03 +09:00
Hiroshi SHIBATA
0af941db7a
[ruby/rubygems] Update resolv-0.6.3
https://github.com/ruby/rubygems/commit/778426fb73
2025-11-18 14:54:01 +09:00
Hiroshi SHIBATA
32716e76ee
[ruby/rubygems] Update optparse-0.8.0
https://github.com/ruby/rubygems/commit/4e02243f66
2025-11-18 14:54:01 +09:00
Hiroshi SHIBATA
8cfed30403
[ruby/rubygems] Update fileutils-1.8.0
https://github.com/ruby/rubygems/commit/f8fe7a5208
2025-11-18 14:54:00 +09:00
Hiroshi SHIBATA
6ccc41998f
[ruby/rubygems] Update timeout-0.4.4
https://github.com/ruby/rubygems/commit/b6deff99c9
2025-11-18 14:53:59 +09:00