91966 Commits

Author SHA1 Message Date
Nobuyoshi Nakada
1395abd025
Win: Use VsDevCmd.bat instead of old vcvarsall.bat 2025-06-01 12:16:18 +09:00
Nobuyoshi Nakada
a64616fb4c
Win: Fix winget command to install 2025-06-01 10:24:06 +09:00
Nobuyoshi Nakada
63617a6ce1
Update rake version in bundler tests 2025-05-31 20:56:00 +09:00
Nobuyoshi Nakada
f2ddd923ed
Update rake version in lock files 2025-05-31 19:21:14 +09:00
git
32c708efbd Update bundled gems list as of 2025-05-31 2025-05-31 09:43:52 +00:00
tomoya ishida
49f35c917b
Bump bundled bigdecimal to 3.2.1 (#13482) 2025-05-31 09:31:17 +00:00
Daisuke Aritomo
2097d3794d Fix typo (s/ractore/ractor/) 2025-05-31 18:31:10 +09:00
Koichi Sasada
7b75b1f2da prepare IDs for Ractor::monitor
To prevent the following strange error, prepare IDs at first.

```
     <internal:ractor>:596:in 'Ractor#monitor': symbol :exited is already registered with 98610c (fatal)
             from <internal:ractor>:550:in 'Ractor#join'
             from <internal:ractor>:574:in 'Ractor#value'
             from bootstraptest.test_ractor.rb_2013_1309.rb:12:in '<main>'
```

BTW, the error should be fixed on ID management system.
2025-05-31 18:29:02 +09:00
Koichi Sasada
e8b31c273c rake 13.3.0 -> 13.2.1
`make test-bundler-parallel` prints many errors, so try to
downgrade rake version.

```
  219) bundle install --standalone run in a subdirectory with --binstubs creates stubs that can be symlinked
       Failure/Error:
               raise <<~ERROR
                 #{error_header}

                 ----------------------------------------------------------------------
                 #{stdboth}
                 ----------------------------------------------------------------------
               ERROR

       RuntimeError:

         Commands:
         $ /home/ko1/ruby/build/trunk/ruby -I/home/ko1/ruby/src/trunk/spec/bundler -r/home/ko1/ruby/src/trunk/spec/bundler/support/artifice/compact_index.rb -r/home/ko1/ruby/src/trunk/spec/bundler/support/hax.rb /home/ko1/ruby/src/trunk/tmp/2.13/gems/system/bin/bundle config set --local path /home/ko1/ruby/src/trunk/tmp/2.13/bundled_app/bundle
         # $? => 0
         Invoking `/home/ko1/ruby/build/trunk/ruby -I/home/ko1/ruby/src/trunk/spec/bundler -r/home/ko1/ruby/src/trunk/spec/bundler/support/artifice/compact_index.rb -r/home/ko1/ruby/src/trunk/spec/bundler/support/hax.rb /home/ko1/ruby/src/trunk/tmp/2.13/gems/system/bin/bundle install --standalone --binstubs` failed with output:

         ----------------------------------------------------------------------
         [DEPRECATED] The --binstubs option will be removed in favor of `bundle binstubs --all`
         Could not find compatible versions

         Because every version of rails depends on rake = 13.3.0
           and rake = 13.3.0 could not be found in rubygems repository https://gem.repo1/ or installed locally,
           rails cannot be used.
         So, because Gemfile depends on rails >= 0,
           version solving has failed.
         Fetching gem metadata from https://gem.repo1/...
         Resolving dependencies...
         ----------------------------------------------------------------------
       Shared Example Group: "bundle install --standalone" called from ./spec/bundler/install/gems/standalone_spec.rb:532
       # /home/ko1/ruby/src/trunk/spec/bundler/support/command_execution.rb:26:in 'Spec::CommandExecution#raise_error!'
       # /home/ko1/ruby/src/trunk/spec/bundler/support/subprocess.rb:66:in 'Spec::Subprocess#sh'
       # /home/ko1/ruby/src/trunk/spec/bundler/support/helpers.rb:216:in 'Spec::Helpers#sys_exec'
       # /home/ko1/ruby/src/trunk/spec/bundler/support/helpers.rb:107:in 'Spec::Helpers#bundle'
       # /home/ko1/ruby/src/trunk/spec/bundler/install/gems/standalone_spec.rb:482:in 'block (3 levels) in <top (required)>'
       # /home/ko1/ruby/src/trunk/spec/bundler/spec_helper.rb:107:in 'block (4 levels) in <top (required)>'
       # /home/ko1/ruby/src/trunk/spec/bundler/spec_helper.rb:107:in 'block (3 levels) in <top (required)>'
       # /home/ko1/ruby/src/trunk/spec/bundler/support/helpers.rb:355:in 'block in Spec::Helpers#with_gem_path_as'
       # /home/ko1/ruby/src/trunk/spec/bundler/support/helpers.rb:369:in 'Spec::Helpers#without_env_side_effects'
       # /home/ko1/ruby/src/trunk/spec/bundler/support/helpers.rb:350:in 'Spec::Helpers#with_gem_path_as'
       # /home/ko1/ruby/src/trunk/spec/bundler/spec_helper.rb:106:in 'block (2 levels) in <top (required)>'
```
2025-05-31 17:15:44 +09:00
Nobuyoshi Nakada
9dc9d5f5a6
[DOC] Fix indentation
RDoc markdown parser requires exact 4 spaces or tab as indentation.
Also the first nested bullet list must be separated from the enclosing
bullet list item by a blank line.
2025-05-31 16:49:21 +09:00
Koichi Sasada
57d10c6e80 NEWS entries for Ractor::Port 2025-05-31 13:06:22 +09:00
Koichi Sasada
c0c94ab183 skip failing test in a week
```
  1) Failure:
TestGc#test_gc_stress_at_startup [/home/chkbuild/chkbuild/tmp/build/20250530T213003Z/ruby/test/ruby/test_gc.rb:799]:
[Bug #15784]
pid 1748790 killed by SIGSEGV (signal 11) (core dumped).

1. [3/3] Assertion for "success?"
   | Expected #<Process::Status: pid 1748790 SIGSEGV (signal 11) (core dumped)> to be success?.
```
2025-05-31 13:05:16 +09:00
Koichi Sasada
7924296844 skip flaky test
```
  1) Failure:
TestProcess#test_warmup_frees_pages [/tmp/ruby/src/trunk-random1/test/ruby/test_process.rb:2772]:
<164348> expected but was
<165985>.
```

can someone investigate it?
2025-05-31 08:17:36 +09:00
git
e577edb12e Update bundled gems list as of 2025-05-30 2025-05-30 19:14:14 +00:00
Koichi Sasada
49b7a092fa skip tests for BigDecimal 3.2.0 2025-05-31 04:01:33 +09:00
Koichi Sasada
7013174185 fix for test-bundled-gems to catch up new API 2025-05-31 04:01:33 +09:00
Koichi Sasada
ef2bb61018 Ractor::Port
* Added `Ractor::Port`
  * `Ractor::Port#receive` (support multi-threads)
  * `Rcator::Port#close`
  * `Ractor::Port#closed?`
* Added some methods
  * `Ractor#join`
  * `Ractor#value`
  * `Ractor#monitor`
  * `Ractor#unmonitor`
* Removed some methods
  * `Ractor#take`
  * `Ractor.yield`
* Change the spec
  * `Racotr.select`

You can wait for multiple sequences of messages with `Ractor::Port`.

```ruby
ports = 3.times.map{ Ractor::Port.new }
ports.map.with_index do |port, ri|
  Ractor.new port,ri do |port, ri|
    3.times{|i| port << "r#{ri}-#{i}"}
  end
end

p ports.each{|port| pp 3.times.map{port.receive}}

```

In this example, we use 3 ports, and 3 Ractors send messages to them respectively.
We can receive a series of messages from each port.

You can use `Ractor#value` to get the last value of a Ractor's block:

```ruby
result = Ractor.new do
  heavy_task()
end.value
```

You can wait for the termination of a Ractor with `Ractor#join` like this:

```ruby
Ractor.new do
  some_task()
end.join
```

`#value` and `#join` are similar to `Thread#value` and `Thread#join`.

To implement `#join`, `Ractor#monitor` (and `Ractor#unmonitor`) is introduced.

This commit changes `Ractor.select()` method.
It now only accepts ports or Ractors, and returns when a port receives a message or a Ractor terminates.

We removes `Ractor.yield` and `Ractor#take` because:
* `Ractor::Port` supports most of similar use cases in a simpler manner.
* Removing them significantly simplifies the code.

We also change the internal thread scheduler code (thread_pthread.c):
* During barrier synchronization, we keep the `ractor_sched` lock to avoid deadlocks.
  This lock is released by `rb_ractor_sched_barrier_end()`
  which is called at the end of operations that require the barrier.
* fix potential deadlock issues by checking interrupts just before setting UBF.

https://bugs.ruby-lang.org/issues/21262
2025-05-31 04:01:33 +09:00
Kunshan Wang
d2a1ad00cb [ruby/mmtk] Fix environment variable parsing
Ues more idiomatic rust approaches.

https://github.com/ruby/mmtk/commit/ef125f9eae
2025-05-30 14:55:42 +00:00
Kunshan Wang
94688bdc7d [ruby/mmtk] Fix clippy warnings and formatting.
We also enable `#![warn(unsafe_op_in_unsafe_fn)]` in the whole mmtk_ruby
crate.

https://github.com/ruby/mmtk/commit/8b8025f71a
2025-05-30 14:55:42 +00:00
Kunshan Wang
d8774ec98f [ruby/mmtk] Bump MMTk and dependencies version
https://github.com/ruby/mmtk/commit/de252637ec
2025-05-30 14:55:41 +00:00
Kunshan Wang
60de513d05 [ruby/mmtk] Remove unused constant
Remove the unused constant HAS_MOVED_GFIELDSTBL and related methods.

In the mmtk/mmtk-ruby repo, we are now able to find the global field
(IV) table of a moved object during copying GC without using the
HAS_MOVED_GFIELDSTBL bit.  We synchronize some of the code, although we
haven't implemented moving GC in ruby/mmtk, yet.

See: 13080acdf5

https://github.com/ruby/mmtk/commit/400ba4e747
2025-05-30 14:55:41 +00:00
Tavian Barnes
f8db23afe5
ZJIT: Fold more fixnum operations (#13465) 2025-05-30 10:27:00 -04:00
Max Bernstein
65e9791c55
ZJIT: Assert that we're compiling a specific YARV insn to HIR (#13471) 2025-05-30 10:23:26 -04:00
Nobuyoshi Nakada
8872d3e10b
[Feature #21205] Fix up birthtime in ruby/spec 2025-05-30 20:55:12 +09:00
Nobuyoshi Nakada
18a036a613
[Feature #21205] Define File::Stat#birthtime by statx 2025-05-30 20:55:12 +09:00
Nobuyoshi Nakada
a333fb1ecc
Win: Add scripts to install and setup 2025-05-30 18:44:28 +09:00
Peter Zhu
9f91f3617b Fix memory leak with invalid yield in prism
[Bug #21383]

The following script leaks memory:

    10.times do
      20_000.times do
        eval("class C; yield; end")
      rescue SyntaxError
      end

      puts `ps -o rss= -p #{$$}`
    end

Before:

    16464
    25536
    29424
    35904
    39552
    44576
    46736
    51600
    56096
    59824

After:

    13488
    16160
    18240
    20528
    19760
    21808
    21680
    22272
    22064
    22336
2025-05-29 16:06:49 -04:00
John Hawthorn
6a62a46c3c Read {max_iv,variation}_count from prime classext
MAX_IV_COUNT is a hint which determines the size of variable width
allocation we should use for a given class. We don't need to scope this
by namespace, if we end up with larger builtin objects on some
namespaces that isn't a user-visible problem, just extra memory use.

Similarly variation_count is used to track if a given object has had too
many branches in shapes it has used, and to use too_complex when that
happens. That's also just a hint, so we can use the same value across
namespaces without it being visible to users.

Previously variation_count was being incremented (written to) on the
RCLASS_EXT_READABLE ext, which seems incorrect if we wanted it to be
different across namespaces
2025-05-29 16:02:07 -04:00
Luke Gruber
5b3f1c4c51 Take VM lock around manipulation of fiber pool for vacant stacks
When creating fibers in multiple ractors at the same time there were
issues with the manipulation of this structure, causing segfaults.

I didn't add any tests for this because I'm making a more general
PR in the very near future to be able to run test methods (test-all suite)
inside multiple ractors at the same time. This is how this bug was
caught, running test/ruby/test_fiber.rb inside 10 ractors at once.
2025-05-29 12:51:43 -04:00
Peter Zhu
38ecaca155 [ruby/mmtk] Remove dependance on internal/object.h
https://github.com/ruby/mmtk/commit/fdc13963f0
2025-05-29 14:46:49 +00:00
Hiroshi SHIBATA
9542e3db1c
Removed needless components of BuildTools 2025-05-29 17:52:58 +09:00
Nobuyoshi Nakada
857b1ae786 [ruby/prism] [DOC] No RDoc in include/prism/ast.h
https://github.com/ruby/prism/commit/1cae6e3b02
2025-05-29 04:46:00 +00:00
Nobuyoshi Nakada
8aa21634d8 [ruby/prism] [DOC] Simply use String#ljust
https://github.com/ruby/prism/commit/ba019ab4b4
2025-05-29 04:45:59 +00:00
Nobuyoshi Nakada
5e64d5c7d9 [ruby/prism] [DOC] Markup __FILE__ as code, not emphasis
https://github.com/ruby/prism/commit/571ba378f5
2025-05-29 04:45:59 +00:00
Nobuyoshi Nakada
82c74e4282 [ruby/prism] [DOC] Stop rdoc from processing non-rdoc comments
https://github.com/ruby/prism/commit/de1faa1680
2025-05-29 04:45:59 +00:00
Nobuyoshi Nakada
22451f370e [ruby/prism] [DOC] Add code fences
https://github.com/ruby/prism/commit/641775e5fe
2025-05-29 04:45:58 +00:00
Nobuyoshi Nakada
991cf2dd4d [ruby/prism] [DOC] Specify markdown mode to RDoc
https://github.com/ruby/prism/commit/12af4e144e
2025-05-29 04:45:58 +00:00
Hiroshi SHIBATA
6256c52667
Added VS2022 BuildTools instructions 2025-05-29 13:15:12 +09:00
Hiroshi SHIBATA
5131d5ef83
VS2022 17.13.x and winsdk-10.0.26100 issues are resolved now 2025-05-29 13:15:12 +09:00
Hiroshi SHIBATA
2a240103cc
Added instruction for installing gcc toolchain with ridk 2025-05-29 13:15:12 +09:00
Nobuyoshi Nakada
fa85d23ff4
[Bug #21380] Prohibit modification in String#split block
Reported at https://hackerone.com/reports/3163876
2025-05-29 11:10:58 +09:00
David Rodríguez
7082ef201e Remove unnecessary GEM_PATH modification 2025-05-29 10:09:28 +09:00
David Rodríguez
1a8d338337 Initialize gems tmp when initializing bundled_gems_spec suite
That way it works even if no Bundler specs have run before.
2025-05-29 10:09:28 +09:00
John Bampton
bb4d9f3f61 [ruby/resolv] Update resolv.rb - fix spelling
https://github.com/ruby/resolv/commit/65ce7f214b
2025-05-28 22:01:04 +00:00
Takashi Kokubun
cce89a6f69
ZJIT: Add --enable-zjit=dev_nodebug (#13456) 2025-05-28 17:20:10 -04:00
Max Bernstein
9a1d6cc799
ZJIT: Add CallableMethodEntry to type lattice (GH-13459)
This will be useful when we split Send into Lookup+Call.
For reasoning about various method types during optimization.
2025-05-28 20:59:51 +00:00
Peter Zhu
b5f5672034 Set iclass_is_origin flag for FrozenCore
We don't free the method table for FrozenCore since it is converted to
an iclass and doesn't have the iclass_is_origin flag set. This causes a
memory leak to be reported during RUBY_FREE_AT_EXIT:

    14  dyld                                  0x19f13ab98 start + 6076
    13  miniruby                              0x100644928 main + 96  main.c:62
    12  miniruby                              0x10064498c rb_main + 48  main.c:42
    11  miniruby                              0x10073be0c ruby_init + 16  eval.c:98
    10  miniruby                              0x10073bc6c ruby_setup + 232  eval.c:87
    9   miniruby                              0x100786b98 rb_call_inits + 168  inits.c:63
    8   miniruby                              0x1009b5010 Init_VM + 212  vm.c:4017
    7   miniruby                              0x10067aae8 rb_class_new + 44  class.c:834
    6   miniruby                              0x10067a04c rb_class_boot + 48  class.c:748
    5   miniruby                              0x10067a250 class_initialize_method_table + 32  class.c:721
    4   miniruby                              0x1009412a8 rb_id_table_create + 24  id_table.c:98
    3   miniruby                              0x100759fac ruby_xmalloc + 24  gc.c:5201
    2   miniruby                              0x10075fc14 ruby_xmalloc_body + 52  gc.c:5211
    1   miniruby                              0x1007726b4 rb_gc_impl_malloc + 92  default.c:8141
    0   libsystem_malloc.dylib                0x19f30d12c _malloc_zone_malloc_instrumented_or_legacy + 152
2025-05-28 13:25:37 -04:00
John Hawthorn
d1343e12d2 Use flag for RCLASS_IS_INITIALIZED
Previously we used a flag to set whether a module was uninitialized.
When checked whether a class was initialized, we first had to check that
it had a non-zero superclass, as well as that it wasn't BasicObject.

With the advent of namespaces, RCLASS_SUPER is now an expensive
operation, and though we could just check for the prime superclass, we
might as well take this opportunity to use a flag so that we can perform
the initialized check with as few instructions as possible.

It's possible in the future that we could prevent uninitialized classes
from being available to the user, but currently there are a few ways to
do that.
2025-05-28 11:44:07 -04:00
John Hawthorn
3935b1c401 Make class_alloc only accept type
If any other flags were passed other than type they were ignored, so we
might as well be more explicit that that's all this accepts. This also
fixes the incorrect (internal) documentation.

It also turns out type is always known in the caller, so I made it
explicit in the two places additional flags were being passed.
2025-05-28 11:10:09 -04:00
Jean Boussier
749bda96e5 Refactor attr_index_t caches
Ensure the same helpers are used for packing and unpacking.
2025-05-28 12:39:21 +02:00