87158 Commits

Author SHA1 Message Date
Hiroshi SHIBATA
a8f36c3263 Added workflow dispatch 2024-08-01 13:38:33 +08:00
Hiroshi SHIBATA
f2b7622330 We should run release.sh with release tag 2024-08-01 13:38:33 +08:00
Hiroshi SHIBATA
277a6e8f1a Added draft release action with tagging 2024-08-01 13:38:33 +08:00
Hiroshi SHIBATA
fc253d7ef9 Removed refs/tags from ruby version 2024-08-01 13:38:33 +08:00
Hiroshi SHIBATA
346bb6c08b Create docker image with release tag automatically 2024-08-01 13:38:33 +08:00
Aaron Patterson
bbeebc9258 Only set shape id for CCs on attr_set + ivar
Only ivar reader and writer methods should need the shape ID set on the
inline cache.  We shouldn't accidentally overwrite parts of the CC union
when it's not necessary.
2024-07-31 16:23:28 -07:00
tomoya ishida
16b0242808 [ruby/rdoc] Add new ruby parser that uses Prism
(https://github.com/ruby/rdoc/pull/1144)

* Add a new ruby parser RDoc::Parser::PrismRuby

* Add a new ruby parser testcase independent from parser's internal implementation

* unknown meta method

* Use MethodSignatureVisitor only to scan params, block_params and calls_super

* Add calls_super test

* Drop ruby 2.6. Prism requires ruby >= 2.7

* Remove duplicated documentation comment from prism_ruby.rb

* Add test for wrong argument passed to metaprogramming method

* Rename visit_call_[DSL_METHOD_NAME] to make it distinguishable from visit_[NODE_TYPE]_node

* Method receiver switch of true/false/nil to a case statement

* Extract common part of add_method(by def keyword) and add meta_comment method

* Reuse consecutive comments array when collecting comments

* Simplify DSL call_node handling

* Refactor extracting method visibility arguments

https://github.com/ruby/rdoc/commit/fde99f1be6
2024-07-31 20:50:00 +00:00
Peter Zhu
e68e958231 [PRISM] Increase test-bundler-parallel to 40 minutes
It's timing out frequently recently, so increasing the timeout should
fix it.
2024-07-31 16:37:21 -04:00
Burdette Lamar
f5d193d525
[DOC] Adds "Further Considerations" to documentation_guide.md (#11281) 2024-07-31 16:09:15 -04:00
Jeremy Evans
cc81437260 Rewrite Array.new documentation
Use plain paragraphs instead of a nested unordered list.

Remove some examples, including examples that produce warnings in
verbose mode or raise exceptions.

Explicitly document the common pitfall of using an expression as a
default value instead of using a block.
2024-07-31 13:04:42 -07:00
David Rodríguez
290089c1a2 [rubygems/rubygems] Remove some file_uri_for calls
https://github.com/rubygems/rubygems/commit/3570ba20ed
2024-07-31 20:03:18 +00:00
Peter Zhu
6358397490 Fix leak of AST when Ripper#compile_error jumps
For example, the following script leaks:

    class MyRipper < Ripper
      def initialize(src, &blk)
        super(src)
        @blk = blk
      end

      def compile_error(msg) = @blk.call(msg)
    end

    def call_parse = MyRipper.new("/") { |msg| return msg }.parse

    10.times do
      100_000.times do
        call_parse
      end

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

Before:

    93952
    169040
    244224
    318784
    394432
    468224
    544048
    618560
    693776
    768384

After:

    19776
    19776
    20352
    20880
    20912
    21408
    21328
    21152
    21472
    20944
2024-07-31 14:47:44 -04:00
Takashi Kokubun
70b4f45d9f
YJIT: Decouple Context from encoding details (#11283) 2024-07-31 10:51:40 -04:00
Stan Lo
27c22f822a [ruby/rdoc] Drop unnecessary file_name parameter from Parser.for
method.
(https://github.com/ruby/rdoc/pull/1135)

* Unify top_level creation in tests

* Remove unnecessary file_name param from Parser.for

It should be always the same as the top_level's absolute_name, so there's
no point of taking it as a separate parameter.

https://github.com/ruby/rdoc/commit/97c497dfbb
2024-07-31 14:36:41 +00:00
Nobuyoshi Nakada
12a5400a88 [ruby/io-console] Remove no longer used variable
https://github.com/ruby/io-console/commit/651797ff8a
2024-07-31 13:20:01 +00:00
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
e4f5296f065110fa83eb450d3a861253e76e534f.

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 28a1c4f33e3349a98c04b8e068d9c674eb936064
28a1c4f33e3349a98c04b8e068d9c674eb936064 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