Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into dev/gc-mmtk
Browse files Browse the repository at this point in the history
  • Loading branch information
peterzhu2118 committed Oct 4, 2024
2 parents 876ee98 + cd86393 commit feaa674
Show file tree
Hide file tree
Showing 97 changed files with 1,387 additions and 1,068 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ jobs:
run: sudo rm /usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb

- name: Initialize CodeQL
uses: github/codeql-action/init@e2b3eafc8d227b0241d48be5f425d47c2d750a13 # v3.26.10
uses: github/codeql-action/init@6db8d6351fd0be61f9ed8ebd12ccd35dcec51fea # v3.26.11
with:
languages: ${{ matrix.language }}

- name: Autobuild
uses: github/codeql-action/autobuild@e2b3eafc8d227b0241d48be5f425d47c2d750a13 # v3.26.10
uses: github/codeql-action/autobuild@6db8d6351fd0be61f9ed8ebd12ccd35dcec51fea # v3.26.11

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@e2b3eafc8d227b0241d48be5f425d47c2d750a13 # v3.26.10
uses: github/codeql-action/analyze@6db8d6351fd0be61f9ed8ebd12ccd35dcec51fea # v3.26.11
with:
category: '/language:${{ matrix.language }}'
upload: False
Expand Down Expand Up @@ -115,7 +115,7 @@ jobs:
continue-on-error: true

- name: Upload SARIF
uses: github/codeql-action/upload-sarif@e2b3eafc8d227b0241d48be5f425d47c2d750a13 # v3.26.10
uses: github/codeql-action/upload-sarif@6db8d6351fd0be61f9ed8ebd12ccd35dcec51fea # v3.26.11
with:
sarif_file: sarif-results/${{ matrix.language }}.sarif
continue-on-error: true
2 changes: 1 addition & 1 deletion .github/workflows/scorecards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ jobs:

# Upload the results to GitHub's code scanning dashboard.
- name: 'Upload to code-scanning'
uses: github/codeql-action/upload-sarif@e2b3eafc8d227b0241d48be5f425d47c2d750a13 # v3.26.10
uses: github/codeql-action/upload-sarif@6db8d6351fd0be61f9ed8ebd12ccd35dcec51fea # v3.26.11
with:
sarif_file: results.sarif
6 changes: 4 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,15 @@ The following default gems are updated.
The following bundled gems are updated.
* minitest 5.25.1
* power_assert 2.0.4
* rake 13.2.1
* test-unit 3.6.2
* rexml 3.3.8
* rss 0.3.1
* net-ftp 0.3.7
* net-ftp 0.3.8
* net-imap 0.4.16
* net-smtp 0.5.0
* rbs 3.6.0
* rbs 3.6.1
* typeprof 0.21.11
* debug 1.9.2
* racc 1.8.1
Expand All @@ -118,6 +119,7 @@ The following bundled gems are promoted from default gems.
* nkf 0.2.0
* syslog 0.1.2
* csv 3.3.0
* repl_type_completor 0.1.7
See GitHub releases like [GitHub Releases of Logger](https://github.com/ruby/logger/releases) or changelog for details of the default gems or bundled gems.
Expand Down
136 changes: 80 additions & 56 deletions array.c
Original file line number Diff line number Diff line change
Expand Up @@ -2725,9 +2725,15 @@ rb_ary_reverse_each(VALUE ary)

/*
* call-seq:
* array.length -> an_integer
* length -> integer
* size -> integer
*
* Returns the count of elements in +self+.
* Returns the count of elements in +self+:
*
* [0, 1, 2].length # => 3
* [].length # => 0
*
* Related: see {Methods for Querying}[rdoc-ref:Array@Methods+for+Querying].
*/

static VALUE
Expand Down Expand Up @@ -3398,7 +3404,7 @@ sort_2(const void *ap, const void *bp, void *dummy)
*
* Returns +self+ with its elements sorted in place.
*
* With no block, compares elements using operator <tt><=></tt>
* With no block, compares elements using operator <tt>#<=></tt>
* (see Comparable):
*
* a = 'abcde'.split('').shuffle
Expand Down Expand Up @@ -3501,7 +3507,7 @@ rb_ary_sort_bang(VALUE ary)
*
* Returns a new +Array+ whose elements are those from +self+, sorted.
*
* With no block, compares elements using operator <tt><=></tt>
* With no block, compares elements using operator <tt>#<=></tt>
* (see Comparable):
*
* a = 'abcde'.split('').shuffle
Expand Down Expand Up @@ -4483,10 +4489,10 @@ take_items(VALUE obj, long n)
*
* If an argument is not an array, it extracts the values by calling #each:
*
* a = [:a0, :a1, :a2, :a2]
* b = 1..4
* c = a.zip(b)
* c # => [[:a0, 1], [:a1, 2], [:a2, 3], [:a2, 4]]
* a = [:a0, :a1, :a2, :a2]
* b = 1..4
* c = a.zip(b)
* c # => [[:a0, 1], [:a1, 2], [:a2, 3], [:a2, 4]]
*
* When a block is given, calls the block with each of the sub-arrays (formed as above); returns +nil+:
*
Expand Down Expand Up @@ -5910,42 +5916,51 @@ ary_max_opt_string(VALUE ary, long i, VALUE vmax)

/*
* call-seq:
* array.max -> element
* array.max {|a, b| ... } -> element
* array.max(n) -> new_array
* array.max(n) {|a, b| ... } -> new_array
* max -> element
* max(n) -> new_array
* max {|a, b| ... } -> element
* max(n) {|a, b| ... } -> new_array
*
* Returns one of the following:
*
* - The maximum-valued element from +self+.
* - A new +Array+ of maximum-valued elements selected from +self+.
* - A new array of maximum-valued elements from +self+.
*
* Does not modify +self+.
*
* When no block is given, each element in +self+ must respond to method <tt><=></tt>
* with an Integer.
* With no block given, each element in +self+ must respond to method <tt>#<=></tt>
* with a numeric.
*
* With no argument and no block, returns the element in +self+
* having the maximum value per method <tt><=></tt>:
* having the maximum value per method <tt>#<=></tt>:
*
* [0, 1, 2].max # => 2
* [1, 0, 3, 2].max # => 3
*
* With an argument Integer +n+ and no block, returns a new +Array+ with at most +n+ elements,
* in descending order per method <tt><=></tt>:
* With non-negative numeric argument +n+ and no block,
* returns a new array with at most +n+ elements,
* in descending order, per method <tt>#<=></tt>:
*
* [0, 1, 2, 3].max(3) # => [3, 2, 1]
* [0, 1, 2, 3].max(6) # => [3, 2, 1, 0]
* [1, 0, 3, 2].max(3) # => [3, 2, 1]
* [1, 0, 3, 2].max(3.0) # => [3, 2, 1]
* [1, 0, 3, 2].max(9) # => [3, 2, 1, 0]
* [1, 0, 3, 2].max(0) # => []
*
* When a block is given, the block must return an Integer.
* With a block given, the block must return a numeric.
*
* With a block and no argument, calls the block <tt>self.size-1</tt> times to compare elements;
* returns the element having the maximum value per the block:
* With a block and no argument, calls the block <tt>self.size - 1</tt> times to compare elements;
* returns the element having the maximum return value per the block:
*
* ['0', '00', '000'].max {|a, b| a.size <=> b.size } # => "000"
* ['0', '', '000', '00'].max {|a, b| a.size <=> b.size }
* # => "000"
*
* With an argument +n+ and a block, returns a new +Array+ with at most +n+ elements,
* in descending order per the block:
* With non-negative numeric argument +n+ and a block,
* returns a new array with at most +n+ elements,
* in descending order, per the block:
*
* ['0', '00', '000'].max(2) {|a, b| a.size <=> b.size } # => ["000", "00"]
* ['0', '', '000', '00'].max(2) {|a, b| a.size <=> b.size }
* # => ["000", "00"]
*
* Related: see {Methods for Fetching}[rdoc-ref:Array@Methods+for+Fetching].
*/
static VALUE
rb_ary_max(int argc, VALUE *argv, VALUE ary)
Expand Down Expand Up @@ -6078,42 +6093,51 @@ ary_min_opt_string(VALUE ary, long i, VALUE vmin)

/*
* call-seq:
* array.min -> element
* array.min { |a, b| ... } -> element
* array.min(n) -> new_array
* array.min(n) { |a, b| ... } -> new_array
* min -> element
* min(n) -> new_array
* min {|a, b| ... } -> element
* min(n) {|a, b| ... } -> new_array
*
* Returns one of the following:
*
* - The minimum-valued element from +self+.
* - A new +Array+ of minimum-valued elements selected from +self+.
* - A new array of minimum-valued elements from +self+.
*
* Does not modify +self+.
*
* When no block is given, each element in +self+ must respond to method <tt><=></tt>
* with an Integer.
* With no block given, each element in +self+ must respond to method <tt>#<=></tt>
* with a numeric.
*
* With no argument and no block, returns the element in +self+
* having the minimum value per method <tt><=></tt>:
* having the minimum value per method <tt>#<=></tt>:
*
* [0, 1, 2].min # => 0
* [1, 0, 3, 2].min # => 0
*
* With Integer argument +n+ and no block, returns a new +Array+ with at most +n+ elements,
* in ascending order per method <tt><=></tt>:
* With non-negative numeric argument +n+ and no block,
* returns a new array with at most +n+ elements,
* in ascending order, per method <tt>#<=></tt>:
*
* [0, 1, 2, 3].min(3) # => [0, 1, 2]
* [0, 1, 2, 3].min(6) # => [0, 1, 2, 3]
* [1, 0, 3, 2].min(3) # => [0, 1, 2]
* [1, 0, 3, 2].min(3.0) # => [0, 1, 2]
* [1, 0, 3, 2].min(9) # => [0, 1, 2, 3]
* [1, 0, 3, 2].min(0) # => []
*
* When a block is given, the block must return an Integer.
* With a block given, the block must return a numeric.
*
* With a block and no argument, calls the block <tt>self.size-1</tt> times to compare elements;
* returns the element having the minimum value per the block:
* With a block and no argument, calls the block <tt>self.size - 1</tt> times to compare elements;
* returns the element having the minimum return value per the block:
*
* ['0', '00', '000'].min { |a, b| a.size <=> b.size } # => "0"
* ['0', '', '000', '00'].min {|a, b| a.size <=> b.size }
* # => ""
*
* With an argument +n+ and a block, returns a new +Array+ with at most +n+ elements,
* in ascending order per the block:
* With non-negative numeric argument +n+ and a block,
* returns a new array with at most +n+ elements,
* in ascending order, per the block:
*
* ['0', '00', '000'].min(2) {|a, b| a.size <=> b.size } # => ["0", "00"]
* ['0', '', '000', '00'].min(2) {|a, b| a.size <=> b.size }
* # => ["", "0"]
*
* Related: see {Methods for Fetching}[rdoc-ref:Array@Methods+for+Fetching].
*/
static VALUE
rb_ary_min(int argc, VALUE *argv, VALUE ary)
Expand Down Expand Up @@ -6161,12 +6185,12 @@ rb_ary_min(int argc, VALUE *argv, VALUE ary)
* array.minmax {|a, b| ... } -> [min_val, max_val]
*
* Returns a new 2-element +Array+ containing the minimum and maximum values
* from +self+, either per method <tt><=></tt> or per a given block:.
* from +self+, either per method <tt>#<=></tt> or per a given block:.
*
* When no block is given, each element in +self+ must respond to method <tt><=></tt>
* When no block is given, each element in +self+ must respond to method <tt>#<=></tt>
* with an Integer;
* returns a new 2-element +Array+ containing the minimum and maximum values
* from +self+, per method <tt><=></tt>:
* from +self+, per method <tt>#<=></tt>:
*
* [0, 1, 2].minmax # => [0, 2]
*
Expand Down Expand Up @@ -8601,11 +8625,11 @@ rb_ary_deconstruct(VALUE ary)
* - #first: Returns one or more leading elements.
* - #last: Returns one or more trailing elements.
* - #max: Returns one or more maximum-valued elements,
* as determined by <tt><=></tt> or a given block.
* as determined by <tt>#<=></tt> or a given block.
* - #min: Returns one or more minimum-valued elements,
* as determined by <tt><=></tt> or a given block.
* as determined by <tt>#<=></tt> or a given block.
* - #minmax: Returns the minimum-valued and maximum-valued elements,
* as determined by <tt><=></tt> or a given block.
* as determined by <tt>#<=></tt> or a given block.
* - #assoc: Returns the first element that is an array
* whose first element <tt>==</tt> a given object.
* - #rassoc: Returns the first element that is an array
Expand All @@ -8618,7 +8642,7 @@ rb_ary_deconstruct(VALUE ary)
* - #take: Returns leading elements as determined by a given index.
* - #drop_while: Returns trailing elements as determined by a given block.
* - #take_while: Returns leading elements as determined by a given block.
* - #sort: Returns all elements in an order determined by <tt><=></tt> or a given block.
* - #sort: Returns all elements in an order determined by <tt>#<=></tt> or a given block.
* - #reverse: Returns all elements in reverse order.
* - #compact: Returns an array containing all non-+nil+ elements.
* - #select (aliased as #filter): Returns an array containing elements selected by a given block.
Expand Down Expand Up @@ -8648,7 +8672,7 @@ rb_ary_deconstruct(VALUE ary)
* - #rotate!: Replaces +self+ with its elements rotated.
* - #shuffle!: Replaces +self+ with its elements in random order.
* - #sort!: Replaces +self+ with its elements sorted,
* as determined by <tt><=></tt> or a given block.
* as determined by <tt>#<=></tt> or a given block.
* - #sort_by!: Replaces +self+ with its elements sorted, as determined by a given block.
*
* === Methods for Deleting
Expand Down
4 changes: 2 additions & 2 deletions benchmark/string_concat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ benchmark:
"#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}" \
"#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}" \
"#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}#{CHUNK}"
interpolation_same_size_pool: |
interpolation_same_heap: |
buffer = "#{SHORT}#{SHORT}"
interpolation_switching_size_pools: |
interpolation_switching_heaps: |
buffer = "#{SHORT}#{LONG}"
4 changes: 2 additions & 2 deletions bootstraptest/test_literal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,14 @@
assert_equal 'bar', '[*:foo];:bar'
assert_equal '[1, 2]', 'def nil.to_a; [2]; end; [1, *nil]'
assert_equal '[1, 2]', 'def nil.to_a; [1, 2]; end; [*nil]'
assert_equal '[0, 1, {2=>3}]', '[0, *[1], 2=>3]', "[ruby-dev:31592]"
assert_equal '[0, 1, {2 => 3}]', '[0, *[1], 2=>3]', "[ruby-dev:31592]"


# hash
assert_equal 'Hash', '{}.class'
assert_equal '{}', '{}.inspect'
assert_equal 'Hash', '{1=>2}.class'
assert_equal '{1=>2}', '{1=>2}.inspect'
assert_equal '{1 => 2}', '{1=>2}.inspect'
assert_equal '2', 'h = {1 => 2}; h[1]'
assert_equal '0', 'h = {1 => 2}; h.delete(1); h.size'
assert_equal '', 'h = {1 => 2}; h.delete(1); h[1]'
Expand Down
2 changes: 1 addition & 1 deletion bootstraptest/test_ractor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ def test n
}

# threads in a ractor will killed
assert_equal '{:ok=>3}', %q{
assert_equal '{ok: 3}', %q{
Ractor.new Ractor.current do |main|
q = Thread::Queue.new
Thread.new do
Expand Down
Loading

0 comments on commit feaa674

Please sign in to comment.