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

86862 Коммитов

Автор SHA1 Сообщение Дата
Nobuyoshi Nakada 196d59f690
Parenthesize macro arguments 2024-08-16 15:43:43 +09:00
Nobuyoshi Nakada 129b4936bf
Simplify and clarify bitmask calculation 2024-08-16 15:43:43 +09:00
Jun Aruga 08db4bc672 [ruby/openssl] test_s_generate_parameters: Consider a DSA error in FIPS.
DSA kengen is not FIPS-approved. The `EVP_PKEY_paramgen` in the
`OpenSSL::PKey.generate_parameters("DSA")` raises a DSA error in FIPS by the
following commit. Split the test for DSA.

https://github.com/openssl/openssl/commit/49a35f0#diff-605396c063194975af8ce31399d42690ab18186b422fb5012101cc9132660fe1R611-R614

https://github.com/ruby/openssl/commit/5ca6eb4eca
2024-08-16 06:09:15 +00:00
Raed Rizqie 018bd07f07
Fix some warnings
* Fix unused functions when no `mmap`.

  ```
  shape.c:285:1: warning: unused function 'redblack_insert' [-Wunused-function]
    285 | redblack_insert(redblack_node_t * tree, ID key, rb_shape_t * value)
        | ^~~~~~~~~~~~~~~
  ```

* Fix unknown warning group '-Wmaybe-uninitialized' with clang.

  ```
  thread_win32.c:596:1: warning: unknown warning group '-Wmaybe-uninitialized', ignored [-Wunknown-warning-option]
    596 | COMPILER_WARNING_IGNORED(-Wmaybe-uninitialized)
        | ^
  ```

Co-authored-by: Nobuyoshi Nakada <nobu.nakada@gmail.com>
2024-08-16 14:51:21 +09:00
Naoto Ono c06fbb192f Fix flaky TestSetTraceFunc#test_remove_in_trace by filtering trace events 2024-08-16 09:47:07 +09:00
Jeremy Evans abc04e898b Avoid hash allocation for certain proc calls
Previous, proc calls such as:

```ruby
proc{|| }.(**empty_hash)
proc{|b: 1| }.(**r2k_array_with_empty_hash)
```

both allocated hashes unnecessarily, due to two separate code paths.

The first call goes through CALLER_SETUP_ARG/vm_caller_setup_keyword_hash,
and is simple to fix by not duping an empty keyword hash that will be
dropped.

The second case is more involved, in setup_parameters_complex, but is
fixed the exact same way as when the ruby2_keywords hash is not empty,
by flattening the rest array to the VM stack, ignoring the last
element (the empty keyword splat).  Add a flatten_rest_array static
function to handle this case.

Update test_allocation.rb to automatically convert the method call
allocation tests to proc allocation tests, at least for the calls
that can be converted.  With the code changes, all proc call
allocation tests pass, showing that proc calls and method calls
now allocate the same number of objects.

I've audited the allocation tests, and I believe that all of the low
hanging fruit has been collected.  All remaining allocations are
either caller side:

* Positional splat + post argument
* Multiple positional splats
* Literal keywords + keyword splat
* Multiple keyword splats

Or callee side:

* Positional splat parameter
* Keyword splat parameter
* Keyword to positional argument conversion for methods that don't accept keywords
* ruby2_keywords method called with keywords
2024-08-15 13:00:09 -07:00
Peter Zhu 2c6e16eb51 Don't assume st_data_t and VALUE are the same in rb_gc_impl_object_id 2024-08-15 14:33:13 -04:00
Kevin Newton de28ef7db4 [PRISM] Use src encoding not ext encoding 2024-08-15 13:34:25 -04:00
Kevin Newton eb08a2805c [PRISM] test_invalid_jump assertion updates for prism 2024-08-15 13:34:25 -04:00
Kevin Newton a402b18c4e [PRISM] test_syntax_check assertion updates for prism 2024-08-15 13:34:25 -04:00
Kevin Newton 2d66ef717d
Show anonymous and ambiguous params in ISeq disassembly
Previously, in the disasesmbly for ISeqs, there's no way to know if the
anon_rest, anon_kwrest, or ambiguous_param0 flags are set. This commit
extends the names of the rest, kwrest, and lead params to display this
information. They are relevant for the ISeqs' runtime behavior.
2024-08-15 16:59:30 +00:00
BurdetteLamar 33bffde923 [DOC] Tweaks for Array#at 2024-08-15 12:52:09 -04:00
Kevin Newton 5cb6954baa [ruby/prism] Fix up lex result constants
https://github.com/ruby/prism/commit/084baca463
2024-08-15 16:50:00 +00:00
BurdetteLamar d2361ba156 [DOC] Tweaks for Array#push 2024-08-15 12:49:46 -04:00
BurdetteLamar edda29a117 [DOC] Fix Related for Array#all? 2024-08-15 12:48:27 -04:00
BurdetteLamar 1f994683b6 [DOC] Tweaks for Array#any? 2024-08-15 12:46:18 -04:00
Kevin Newton cbf508da58 [ruby/prism] Special error for too short unicode errors
https://github.com/ruby/prism/commit/9f1f7d08bd
2024-08-15 16:40:05 +00:00
Peter Zhu 8312c5be74 Fix GC_ASSERT for gc.c and gc/default.c
gc.c mistakenly defined GC_ASSERT as blank, which caused it to be a
no-op. This caused all assertions in gc.c and gc/default.c to not do
anything. This commit fixes it by moving the definition of GC_ASSERT
to gc/gc.h.
2024-08-15 10:38:24 -04:00
Stan Lo 923e36ab21 [ruby/rdoc] Fix sidebar scroll again and add missing footer back
(https://github.com/ruby/rdoc/pull/1154)

* Add missing footers

In #1152 the footer partial was only added to the index.rhtml file.
This commit adds the footer partial to the other template files.

* Remove unnecessary middle divs in nav

* Simplify sidebar's overflow settings

Because sidebar needs to be scrollable, its overflow should default to auto.
Currently it's set to hidden and force individual elements to set overflow auto,
which overcomplicates things.

https://github.com/ruby/rdoc/commit/b8c2bcd8db
2024-08-15 13:33:00 +00:00
Kentaro Takeyama 2a933609e7 Delete unnecessary rubocop disable comment 2024-08-15 17:16:25 +09:00
tomoya ishida 8a7e6f6852
Improve base time of assert_linear_performance (#11369)
Remove `.ceil` from base time calculation that makes 10x gap.
This will make the assertion more strict and also less flaky.
2024-08-15 06:55:57 +00:00
dependabot[bot] a1d8ef6ebf Bump github/codeql-action from 3.26.1 to 3.26.2
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.26.1 to 3.26.2.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](29d86d22a3...429e197704)

---
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-08-15 12:09:37 +09:00
Peter Zhu fd974f5d74 Increase timeout of test_finalizer
The test is timing out on lpi4a so a longer timeout should fix it.
2024-08-14 16:23:22 -04:00
Kevin Newton 09bf3c9d6a [PRISM] Trigger moreswitches off shebang 2024-08-14 15:39:03 -04:00
tomoya ishida 002e785e77 [ruby/irb] Fix kill pager pid throwing Errno::ESRCH when pager
process already terminated
(https://github.com/ruby/irb/pull/989)

https://github.com/ruby/irb/commit/949f032e9b
2024-08-14 18:06:53 +00:00
Peter Zhu 0610f1b083 Fix crash when GC runs during finalizers at shutdown
We need to remove from the finalizer_table after running all the
finalizers because GC could trigger during the finalizer which could
reclaim the finalizer table array.

The following code crashes:

    1_000_000.times do
      o = Object.new
      ObjectSpace.define_finalizer(o, proc { })
    end
2024-08-14 13:49:52 -04:00
Burdette Lamar 85f99b3828
[DOC] Tweaks to Array#all? (#11365) 2024-08-14 13:47:28 -04:00
Kevin Newton a952ea243f [ruby/prism] Callback on shebang switches
Add the ability to receive a callback when the parser encounters a
shebang that contains additional switches after the Ruby engine.
This is necessary because some command-line flags may be present
there that will alter the parse.

https://github.com/ruby/prism/commit/afc5000331
2024-08-14 17:40:43 +00:00
Koichi ITO 88954a0e9a [ruby/prism] Tweak inspect representation of `Prism::Location`
This PR tweaks inspect representation of `Prism::Location`.

## Before

During debugging, the meaning of `@location=https://github.com/ruby/prism/commit/21474836481` was unclear:

```console
$ ruby -Ilib -rprism -e 'p Prism.lex("puts :hi").value.map(&:first)[1]'
#<Prism::Token:0x000000010cd74e40 @source=#<Prism::ASCIISource:0x000000010cb5f808 @source="puts :hi", @start_line=1, @offsets=[0]>,
@type=:SYMBOL_BEGIN, @value=":", @location=https://github.com/ruby/prism/commit/21474836481>
```

## After

This PR clarifies the contents of the location object, aligning with what I think user expects:

```console
$ ruby -Ilib -rprism -e 'p Prism.lex("puts :hi").value.map(&:first)[1]'
#<Prism::Token:0x000000010e174d50 @source=#<Prism::ASCIISource:0x000000010df5efe8 @source="puts :hi", @start_line=1, @offsets=[0]>,
@type=:SYMBOL_BEGIN, @value=":", @location=#<Prism::Location @start_offset=5 @length=1 start_line=1>>
```

Although it is uncertain whether Prism will accept this change in the inspect representation, it is submitted here as a suggestion.

https://github.com/ruby/prism/commit/e7421ce1c5
2024-08-14 16:28:43 +00:00
Peter Zhu 264175dbb9 [DOC] Update comment about how object ID is calculated
The object ID no longer treats symbols in a special way so we can simplify
the comment about how it is calculated.
2024-08-14 10:51:02 -04:00
git d095474113 Update bundled gems list as of 2024-08-14 2024-08-14 07:01:44 +00:00
tomoya ishida f2f177edb3 [ruby/irb] Improve easter_egg logo resolution
(https://github.com/ruby/irb/pull/987)

https://github.com/ruby/irb/commit/ab394db93f
2024-08-14 04:06:07 +00:00
Naoto Ono e7046f1f57 Increase the default timeout in assert_darwin_vm_dump_works 2024-08-14 12:24:15 +09:00
dependabot[bot] 983d91cf1b Bump github/codeql-action from 3.26.0 to 3.26.1
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.26.0 to 3.26.1.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](eb055d739a...29d86d22a3)

---
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-08-14 12:14:52 +09:00
Sorah Fukumori b20957bdfe [ruby/resolv] test_dns: Fix failure on Windows
(https://github.com/ruby/resolv/pull/58)

test_dns: Fix failure on Windows

1. Switch to #with_udp_and_tcp helper method for EACCES retries on Windows;
   the given UDP socket is unnecessary though.
2. Using 127.0.0.1 should be fine, as it must give different host:port pair.
3. On Windows, 5 retries of bind(2) appears still flaky, doubling it for sure.

follow-up: https://github.com/ruby/resolv/pull/50
follow-up: 6252914e95

https://github.com/ruby/resolv/commit/0a0d57e369
2024-08-13 23:13:10 +00:00
Kasumi Hanazuki 094e53360d [ruby/resolv] Reuse open TCP connection
[RFC7766] Section 5 recommends stub resolvers to reuse open TCP
connections to a nameserver.

[RFC7766]: https://datatracker.ietf.org/doc/html/rfc7766

https://github.com/ruby/resolv/commit/9bf1b08f5c
2024-08-13 21:09:08 +00:00
Igor Pstyga 4be9b72fbb [ruby/resolv] Fix TCP fallback with multiple nameservers
Under the following conditions the exception
`Resolv::DNS::Requester::RequestError: host/port don't match` is raised:
- Multiple nameservers are configured for Resolv::DNS
- A nameserver falls back from UDP to TCP
- TCP request hits Resolv::DNS timeout
- Resolv::DNS retries the next nameserver

More details here https://bugs.ruby-lang.org/issues/8285

https://github.com/ruby/resolv/commit/7d524df80e

Co-authored-by: Julian Mehnle <julian@mehnle.net>
2024-08-13 21:09:08 +00:00
Alan Wu 525008cd78
Delete newarraykwsplat
The pushtoarraykwsplat instruction was designed to replace newarraykwsplat,
and we now meet the condition for deletion mentioned in
77c1233f79.
2024-08-13 20:56:35 +00:00
Peter Zhu b80b839926 Don't set stack end in rb_gc_mark_roots
We don't need to set the stack end in rb_gc_mark_roots because it is
already set in mark_current_machine_context.
2024-08-13 15:53:14 -04:00
John Hawthorn 87a85550ed Re-initialize vm->ractor.sched.lock after fork
Previously under certain conditions it was possible to encounter a
deadlock in the forked child process if ractor.sched.lock was held.

Co-authored-by: Nathan Froyd <froydnj@gmail.com>
2024-08-13 11:52:24 -07:00
Stan Lo 908305a297 Sync rdoc 2024-08-13 09:10:15 -04:00
Kevin Newton a6581114b0 [ruby/prism] Fix up spacing in generated node.rb
https://github.com/ruby/prism/commit/50d79b734b
2024-08-13 12:41:07 +00:00
Naoto Ono 436d23f80d Make sure to wait for the thread to exit in TestProcess#test_wait_and_sigchild 2024-08-13 14:47:48 +09:00
Koichi Sasada d5afa2cc95 do not show unused block on `send`
Some case it is difficult to know the calling method uses a block
or not with `send` on a general framework. So this patch stops
showing unused block warning on `send`.

example with test/unit:

```ruby
require 'test/unit'

class T < Test::Unit::TestCase
  def setup
  end

  def test_foo = nil
end
```

=> /home/ko1/ruby/install/master/lib/ruby/gems/3.4.0+0/gems/test-unit-3.6.2/lib/test/unit/fixture.rb:284: warning: the block passed to 'priority_setup' defined at /home/ko1/ruby/install/master/lib/ruby/gems/3.4.0+0/gems/test-unit-3.6.2/lib/test/unit/priority.rb:183 may be ignored

because test/unit can call any setup method (`priority_setup` in this case) with a block.

Maybe we can show the warning again when we provide a way to recognize
the calling method uses a block or not.
2024-08-13 12:17:56 +09:00
Lars Kanis eedf6c35b3
Revert change of "mingw-ucrt" platform string
... of commit 00176cd40f.

The reverted change was made only for constistency, as discussed in
  https://github.com/ruby/ruby/pull/11358#issuecomment-2282222369

But the platform string "mingw-ucrt" should not be changed.
It is used as RUBY_PLATFORM and as the rubygems platform, so that there should
be a good reason to change the name of an established platform.
"mingw-ucrt" was introduced intentionally in commit
576b2e64cd.

Related to GH-11358
2024-08-12 21:48:29 -04:00
Naoto Ono 00e2e24e6f Launchable: Fix condition for bootstraptest 2024-08-13 10:28:14 +09:00
Kevin Newton d012f6d49f [ruby/prism] Add sample for generating tags
https://github.com/ruby/prism/commit/7c9ca47ac5
2024-08-12 18:44:18 +00:00
Peter Zhu 568d7ab7f5 Fix memory leak reported in -test-/random/loop.c
RUBY_TYPED_DEFAULT_FREE will only free the rand_loop_t, but it will cause
the buf to be leaked. This commit fixes the memory leak by implementing
a free function for the rand_loop_t type.
2024-08-12 09:33:20 -04:00
tompng 992596fb7a Fix next inside block argument stack underflow
[Bug #20344]
Fix compile_next adding removable adjust label
2024-08-12 18:09:32 +09:00
git 2a7da0b6e7 Update bundled gems list as of 2024-08-12 2024-08-12 07:01:02 +00:00