Граф коммитов

86693 Коммитов

Автор SHA1 Сообщение Дата
git dedc496598 Update bundled gems list as of 2024-07-30 2024-07-31 07:00:28 +00:00
Nobuyoshi Nakada 92865d8760 Remove files to build libffi in mswin
These files were to build libffi from the bundled source, but are no
longer used since we stopped bundling the libffi sources in commit
e4f5296f06.

The gemspec file is unchanged because fiddle gem itself still supports
ruby 2.5.
2024-07-31 11:19:52 +09:00
Satoshi Tagomori 19ec803179 Reset the counter for two consecutive runs 2024-07-31 10:59:51 +09:00
Nobuyoshi Nakada 7aea269b89 [Feature #20563] Drop support for Windows older than 8/Sever 2012
Directly call APIs available on Windows 8/Server 2012 and later.
2024-07-31 09:57:38 +09:00
Nobuyoshi Nakada 7ef8051cbb [Feature #20563] Drop support for Windows older than Vista/2008
Directly call APIs available on Windows Vista/Server 2008 and later.
2024-07-31 09:57:38 +09:00
Burdette Lamar d2b8fd0f37
[DOC] Tweaks to Array.try_convert (#11260) 2024-07-30 16:31:33 -04:00
Burdette Lamar 91bb6afa75
[DOC] Tweaks for Array.new (#11259) 2024-07-30 10:09:06 -04:00
BurdetteLamar b44a154959 [DOC] Tweaks for Array#& 2024-07-30 10:06:41 -04:00
David Rodríguez 0dda30d9eb [rubygems/rubygems] Print a better debug message when lockfile does not include the current platform
https://github.com/rubygems/rubygems/commit/afb7a6d754
2024-07-30 14:02:03 +00:00
David Rodríguez 997642cfbd [rubygems/rubygems] The `simulate_platform` helper can take a string
https://github.com/rubygems/rubygems/commit/680bafac1a
2024-07-30 14:02:02 +00:00
David Rodríguez cf6efd1bb7 [rubygems/rubygems] Simplify logic to add current platform a bit
https://github.com/rubygems/rubygems/commit/e102516e27
2024-07-30 14:02:02 +00:00
David Rodríguez 1164b6a7ba [rubygems/rubygems] Fix `gem list` regression when a regular gem shadows a default one
Previously, if you have bundler installed both as a regular gem and a
default gem, the default gem would be displayed by `gem list`.

https://github.com/rubygems/rubygems/commit/10a6b1736e
2024-07-30 14:01:43 +00:00
David Rodríguez 3d248b2eb3 [rubygems/rubygems] Always leave default gem executables around
https://github.com/rubygems/rubygems/commit/775c35e197
2024-07-30 14:01:32 +00:00
David Rodríguez ec13ccdf53 [rubygems/rubygems] Allow smoother breaking changes in test env
https://github.com/rubygems/rubygems/commit/0fc3feae19
2024-07-30 13:54:29 +00:00
Peter Zhu b37ffb9345 Move incorrectly placed tests
The tests for Integer#ceil was accidentally placed in test_truncate.
2024-07-30 09:02:23 -04:00
Peter Zhu a7167d0cee Fix ceil when ndigits is large
[Bug #20654]

This commit fixes Integer#ceil and Float#ceil when the number is
negative and ndigits is large such that 10**ndigits is a bignum.

Previously, it would return 0 in such cases. However, this would cause
unexpected behaviour such as:

    puts 1.ceil(-5) # => 100000
    puts 1.ceil(-10) # => 10000000000
    puts 1.ceil(-20) # => 0

This commit changes the last result so that it will return
100000000000000000000.
2024-07-30 08:21:28 -04:00
Peter Zhu 3af2a7fbe1 Fix floor when ndigits is large
[Bug #20654]

This commit fixes Integer#floor and Float#floor when the number is
negative and ndigits is large such that 10**ndigits is a bignum.

Previously, it would return 0 in such cases. However, this would cause
unexpected behaviour such as:

    puts -1.floor(-5) # => -100000
    puts -1.floor(-10) # => -10000000000
    puts -1.floor(-20) # => 0

This commit changes the last result so that it will return
-100000000000000000000.
2024-07-30 08:21:28 -04:00
tomoya ishida 1870505f47
Fix wrong unreachable chunk remove when jump destination label is unremovable 2024-07-30 15:31:58 +09:00
Satoshi Tagomori 77f8107efa Delete the rjit definition already deleted in C 2024-07-30 15:31:24 +09:00
Satoshi Tagomori 6c5c30b542 Use tmpdir for various environments (including Windows) 2024-07-30 15:31:24 +09:00
Satoshi Tagomori 50a0552bd7 Fix test code and extension to avoid using gvars and Kernel methods 2024-07-30 15:31:24 +09:00
Yusuke Endoh ac5ac48a36 Revert 28a1c4f33e
28a1c4f33e seems to call an improper
ensure clause. [Bug #20655]
Than fixing it properly, I bet it would be much better to simply revert
that commit. It reduces the unneeded complexity. Jumping into a block
called by a C function like Hash#each with callcc is user's fault.
It does not need serious support.
2024-07-30 15:31:24 +09:00
Satoshi Tagomori c884db0b5b [BUG #20655] Add tests to use rb_ensure and call cont.call 2024-07-30 15:31:24 +09:00
Misaki Shioi b3baa11ee9
Improve Socket.tcp (#11187)
[Feature #20646]Improve Socket.tcp

This is a proposed improvement to `Socket.tcp`, which has implemented Happy Eyeballs version 2 (RFC8305) in PR9374.

1. Background
I implemented Happy Eyeballs version 2 (HEv2) for Socket.tcp in PR9374, but several issues have been identified:

- `IO.select` waits for name resolution or connection establishment in v46w, but it does not consider the case where both events occur simultaneously when it returns a value.
  - In this case, Socket.tcp can only capture one event and needs to execute an unnecessary loop to capture the other one, calling `IO.select` one extra time.
- `IO.select` waits for both IPv6/IPv4 name resolution (in start), but when it returns a value, it doesn't consider the case where name resolution for both address families is complete.
  - In this case, `Socket.tcp` can only obtain the addresses of one address family and needs to execute an unnecessary loop obtain the other addresses, calling `IO.select` one extra time.
- The consideration for `connect_timeout` was insufficient. After initiating one or more connections, it raises a 'user specified timeout' after the `connect_timeout` period even if there were addresses that have been resolved and have not yet tried to connect.
- It does not retry with another address in case of a connection failure.
- It executes unnecessary state transitions even when an IP address is passed as the `host` argument.
- The regex for IP addresses did not correctly specify the start and end.

2. Proposal & Outcome
To overcome the aforementioned issues, this PR introduces the following changes:

- Previously, each loop iteration represented a single state transition. This has been changed to execute all processes that meet the execution conditions within a single loop iteration.
  - This prevents unnecessary repeated loops and calling `IO.select`
- Introduced logic to determine the timeout value set for `IO.select`. During the Resolution Delay and Connection Attempt Delay, the user-specified timeout is ignored. Otherwise, the timeout value is set to the larger of `resolv_timeout` and `connect_timeout`.
  - This ensures that the `connect_timeout` is only detected after attempting to connect to all resolved addresses.
- Retry with another address in case of a connection failure.
  - This prevents unnecessary repeated loops upon connection failure.
- Call `tcp_without_fast_fallback` when an IP address is passed as the host argument.
  - This prevents unnecessary state transitions when an IP address is passed.
- Fixed regex for IP addresses.

Additionally, the code has been reduced by over 100 lines, and redundancy has been minimized, which is expected to improve readability.

3. Performance
No significant performance changes were observed in the happy case before and after the improvement.
However, improvements in state transition deficiencies are expected to enhance performance in edge cases.

```ruby
require 'socket'
require 'benchmark'

Benchmark.bmbm do |x|
  x.report('fast_fallback: true') do
    30.times { Socket.tcp("www.ruby-lang.org", 80) }
  end

  x.report('fast_fallback: false') do # Ruby3.3時点と同じ
    30.times { Socket.tcp("www.ruby-lang.org", 80, fast_fallback: false) }
  end
end
```

Before:

```
~/s/build ❯❯❯ ../install/bin/ruby ../ruby/test.rb

                           user     system      total        real
fast_fallback: true    0.021315   0.040723   0.062038 (  0.504866)
fast_fallback: false   0.007553   0.026248   0.033801 (  0.533211)
```

After:

```
~/s/build ❯❯❯ ../install/bin/ruby ../ruby/test.rb

                           user     system      total        real
fast_fallback: true    0.023081   0.040525   0.063606 (  0.406219)
fast_fallback: false   0.007302   0.025515   0.032817 (  0.418680)
```
2024-07-30 12:58:31 +09:00
yui-knk 7ea678b24b Add array test cases for `TestParse#test_define_singleton_error` 2024-07-30 12:48:24 +09:00
dependabot[bot] cdda284cbe Bump ossf/scorecard-action from 2.3.3 to 2.4.0
Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 2.3.3 to 2.4.0.
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](dc50aa9510...62b2cac7ed)

---
updated-dependencies:
- dependency-name: ossf/scorecard-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-30 08:37:16 +09:00
Nobuyoshi Nakada 30f57637ee Wait for server threads to finish 2024-07-30 07:33:43 +08:00
dependabot[bot] 0afbc73b2a [rubygems/rubygems] Bump rb-sys
Bumps [rb-sys](https://github.com/oxidize-rb/rb-sys) from 0.9.98 to 0.9.99.
- [Release notes](https://github.com/oxidize-rb/rb-sys/releases)
- [Commits](https://github.com/oxidize-rb/rb-sys/compare/v0.9.98...v0.9.99)

---
updated-dependencies:
- dependency-name: rb-sys
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

https://github.com/rubygems/rubygems/commit/da7b71d188
2024-07-29 23:24:49 +00:00
Aaron Patterson 2c1655314a Revert moving things to Ruby
This is slowing down benchmarks on x86, so lets revert it for now.
2024-07-29 14:18:11 -07:00
Randy Stauner acbb8d4fb5 Expand opt_newarray_send to support Array#pack with buffer keyword arg
Use an enum for the method arg instead of needing to add an id
that doesn't map to an actual method name.

$ ruby --dump=insns -e 'b = "x"; [v].pack("E*", buffer: b)'

before:

```
== disasm: #<ISeq:<main>@-e:1 (1,0)-(1,34)>
local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1])
[ 1] b@0
0000 putchilledstring                       "x"                       (   1)[Li]
0002 setlocal_WC_0                          b@0
0004 putself
0005 opt_send_without_block                 <calldata!mid:v, argc:0, FCALL|VCALL|ARGS_SIMPLE>
0007 newarray                               1
0009 putchilledstring                       "E*"
0011 getlocal_WC_0                          b@0
0013 opt_send_without_block                 <calldata!mid:pack, argc:2, kw:[#<Symbol:0x000000000023110c>], KWARG>
0015 leave
```

after:

```
== disasm: #<ISeq:<main>@-e:1 (1,0)-(1,34)>
local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1])
[ 1] b@0
0000 putchilledstring                       "x"                       (   1)[Li]
0002 setlocal_WC_0                          b@0
0004 putself
0005 opt_send_without_block                 <calldata!mid:v, argc:0, FCALL|VCALL|ARGS_SIMPLE>
0007 putchilledstring                       "E*"
0009 getlocal                               b@0, 0
0012 opt_newarray_send                      3, 5
0015 leave
```
2024-07-29 16:26:58 -04:00
Peter Zhu 86a762ce56 [ruby/reline] Fix memory leak in setupterm
(https://github.com/ruby/reline/pull/733)

The allocated Fiddle::Pointer never gets freed because it doesn't have a
free function defined for when it gets garbage collected. This commit
changes it to use the default free function.

https://github.com/ruby/reline/commit/0796dcd497
2024-07-29 15:07:53 +00:00
Burdette Lamar 63bdf2d725 [ruby/rdoc] [DOC] Mods about markup formats
(https://github.com/ruby/rdoc/pull/1143)

https://github.com/ruby/rdoc/commit/011de3f2fd
2024-07-29 13:16:18 +00:00
BurdetteLamar df1cc04301 Add remark about call-seq 2024-07-29 09:15:19 -04:00
Burdette Lamar 477f672592
[DOC] rb_ary_s_create (#11256) 2024-07-29 09:11:35 -04:00
dependabot[bot] d2184e8d46 Bump github/codeql-action from 3.25.14 to 3.25.15
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.25.14 to 3.25.15.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](5cf07d8b70...afb54ba388)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-29 12:31:45 +09:00
dependabot[bot] 14eb38608a Bump ruby/setup-ruby from 1.188.0 to 1.190.0
Bumps [ruby/setup-ruby](https://github.com/ruby/setup-ruby) from 1.188.0 to 1.190.0.
- [Release notes](https://github.com/ruby/setup-ruby/releases)
- [Changelog](https://github.com/ruby/setup-ruby/blob/master/release.rb)
- [Commits](50ba3386b0...a6e6f86333)

---
updated-dependencies:
- dependency-name: ruby/setup-ruby
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-29 12:31:19 +09:00
yui-knk 3f40cebabc Specify `LAST_NODE` for `NODE_DEFINED`
For example:

```
defined?(1)
```

Before:

```
# @ NODE_SCOPE (id: 2, line: 1, location: (1,0)-(1,11))
# +- nd_tbl: (empty)
# +- nd_args:
# |   (null node)
# +- nd_body:
#     @ NODE_DEFINED (id: 1, line: 1, location: (1,0)-(1,11))*
#     +- nd_head:
#     |   @ NODE_INTEGER (id: 0, line: 1, location: (1,9)-(1,10))
#     |   +- val: 1
```

After:

```
# @ NODE_SCOPE (id: 2, line: 1, location: (1,0)-(1,11))
# +- nd_tbl: (empty)
# +- nd_args:
# |   (null node)
# +- nd_body:
#     @ NODE_DEFINED (id: 1, line: 1, location: (1,0)-(1,11))*
#     +- nd_head:
#         @ NODE_INTEGER (id: 0, line: 1, location: (1,9)-(1,10))
#         +- val: 1
```
2024-07-29 08:01:52 +09:00
Peter Zhu e798f45cc2 Error when --with-shared-gc doesn't specify a directory 2024-07-26 13:20:04 -04:00
Yuta Saito a65c205a1b [ruby/prism] Add explicit check for PRISM_HAS_NO_FILESYSTEM
https://github.com/ruby/prism/commit/89c22f0e6c
2024-07-26 17:07:50 +00:00
Yuta Saito 1992bd31a5 [ruby/prism] Fallback to pm_string_file_init on platforms without memory-mapped files
> ..., and on other POSIX systems we'll use `read`.

As `pm_string_mapped_init`'s doc comment says, it should fall back to
`read(2)`-based implementation on platforms without memory-mapped files
like WASI, but it didn't. This commit fixes it by calling `pm_string_file_init`
in the fallback case.
Also `defined(_POSIX_MAPPED_FILES)` check for `read(2)`-based path is
unnecessary, and it prevents the fallback from being executed, so this
change removes it.

https://github.com/ruby/prism/commit/b3d9064b71
2024-07-26 17:07:50 +00:00
git cb5c460594 * expand tabs. [ci skip]
Please consider using misc/expand_tabs.rb as a pre-commit hook.
2024-07-26 15:44:44 +00:00
Alan Wu 158177e399 Improve allocation throughput by outlining cache miss code path
Previously, GCC 11 on x86-64 inlined the heavy weight logic for
potentially triggering GC into newobj_alloc(). This slowed down
the hotter code path where the ractor cache hits, causing a degradation
to allocation throughput.

Outline the logic into a separate function and have it never inlined.

This restores allocation throughput to the same level as
98eeadc ("Development of 3.4.0 started.").

To evaluate, instrument miniruby so it allocates a bunch of objects and
then exits:

    diff --git a/eval.c b/eval.c
    --- a/eval.c
    +++ b/eval.c
    @@ -92,6 +92,15 @@ ruby_setup(void)
         }
         EC_POP_TAG();

    +rb_gc_disable();
    +rb_execution_context_t *ec = GET_EC();
    +long const n = 20000000;
    +for (long i = 0; i < n; ++i) {
    +    rb_wb_protected_newobj_of(ec, 0, T_OBJECT, 40);
    +}
    +printf("alloc %ld\n", n);
    +exit(0);
    +
         return state;
     }

With `3.3-equiv` being 98eeadc, and `pre` being f2728c3393
and `post` being this commit, I have:

    $ hyperfine -L buildtag post,pre,3.3-equiv '/ruby/build-{buildtag}/miniruby'
    Benchmark 1: /ruby/build-post/miniruby
      Time (mean ± σ):     873.4 ms ±   2.8 ms    [User: 377.6 ms, System: 490.2 ms]
      Range (min … max):   868.3 ms … 877.8 ms    10 runs

    Benchmark 2: /ruby/build-pre/miniruby
      Time (mean ± σ):     960.1 ms ±   2.8 ms    [User: 430.8 ms, System: 523.9 ms]
      Range (min … max):   955.5 ms … 964.2 ms    10 runs

    Benchmark 3: /ruby/build-3.3-equiv/miniruby
      Time (mean ± σ):     886.9 ms ±   2.8 ms    [User: 379.5 ms, System: 501.0 ms]
      Range (min … max):   883.0 ms … 890.8 ms    10 runs

    Summary
      '/ruby/build-post/miniruby' ran
        1.02 ± 0.00 times faster than '/ruby/build-3.3-equiv/miniruby'
        1.10 ± 0.00 times faster than '/ruby/build-pre/miniruby'

These results are from a Skylake server with GCC 11.
2024-07-26 11:44:34 -04:00
Alan Wu a06cfa7e89 Fix a -Wmaybe-uninitialized
With the body of functions available, GCC noticed that lev is
uninitialized in rb_gc_vm_lock_no_barrier() in single ractor
mode.
2024-07-26 11:44:34 -04:00
Alan Wu 0ada02abe2 Put the default GC implementation back into gc.o
We discovered that having gc.o and gc_impl.o in separate translation
units diminishes codegen quality with GCC 11 on x86-64. This commit
solves that problem by including default/gc.c into gc.c, letting the
optimizer have visibility into the body of functions again in builds
not using link-time optimization, which are common.

This effectively restores things to the way they were before
[Feature #20470] from the optimizer's perspective while maintaining the
ability to build gc/default.c as a DSO.

There were a few functions duplicated across gc.c and gc/default.c.
Extract them and put them into gc/gc.h.
2024-07-26 11:44:34 -04:00
Alan Wu cef959df90 Delete unused rb_gc_impl_get_finalizers() not in gc_impl.h 2024-07-26 11:44:34 -04:00
BurdetteLamar aaa542d894 Doc for some #ceil and #floor 2024-07-26 11:22:18 -04:00
BurdetteLamar 78f1b835a0 Doc for some #ceil and #floor 2024-07-26 11:22:18 -04:00
Peter Zhu 7464514ca5 Fix memory leak in String#start_with? when regexp times out
[Bug #20653]

This commit refactors how Onigmo handles timeout. Instead of raising a
timeout error, onig_search will return a ONIGERR_TIMEOUT which the
caller can free memory, and then raise a timeout error.

This fixes a memory leak in String#start_with when the regexp times out.
For example:

    regex = Regexp.new("^#{"(a*)" * 10_000}x$", timeout: 0.000001)
    str = "a" * 1000000 + "x"

    10.times do
      100.times do
        str.start_with?(regex)
      rescue
      end

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

Before:

    33216
    51936
    71152
    81728
    97152
    103248
    120384
    133392
    133520
    133616

After:

    14912
    15376
    15824
    15824
    16128
    16128
    16144
    16144
    16160
    16160
2024-07-26 08:42:38 -04:00
David Rodríguez 67e1ea0028 [rubygems/rubygems] Remove inconsistent whitespace from CLI flags
RuboCop sometimes accepts extra spaces for alignment, but in this case I
don't see any consistent alignment.

https://github.com/rubygems/rubygems/commit/a8c767e14b
2024-07-26 12:16:56 +00:00
David Rodríguez bfaccd6433 [rubygems/rubygems] Make all tests still pass when switching from truffleruby to cruby
https://github.com/rubygems/rubygems/commit/4f3d9fa3bf
2024-07-26 08:05:53 +00:00