<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/test/ruby/test_array.rb, branch v3_4_9</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>Optimize instructions when creating an array just to call `include?` (#12123)</title>
<updated>2024-11-26T19:31:08+00:00</updated>
<author>
<name>Randy Stauner</name>
<email>randy.stauner@shopify.com</email>
</author>
<published>2024-11-26T19:31:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=1dd40ec18a55ff46f52d0ba44ff5d7923f57c08f'/>
<id>1dd40ec18a55ff46f52d0ba44ff5d7923f57c08f</id>
<content type='text'>
* Add opt_duparray_send insn to skip the allocation on `#include?`

If the method isn't going to modify the array we don't need to copy it.
This avoids the allocation / array copy for things like `[:a, :b].include?(x)`.

This adds a BOP for include? and tracks redefinition for it on Array.

Co-authored-by: Andrew Novoselac &lt;andrew.novoselac@shopify.com&gt;

* YJIT: Implement opt_duparray_send include_p

Co-authored-by: Andrew Novoselac &lt;andrew.novoselac@shopify.com&gt;

* Update opt_newarray_send to support simple forms of include?(arg)

Similar to opt_duparray_send but for non-static arrays.

* YJIT: Implement opt_newarray_send include_p

---------

Co-authored-by: Andrew Novoselac &lt;andrew.novoselac@shopify.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* Add opt_duparray_send insn to skip the allocation on `#include?`

If the method isn't going to modify the array we don't need to copy it.
This avoids the allocation / array copy for things like `[:a, :b].include?(x)`.

This adds a BOP for include? and tracks redefinition for it on Array.

Co-authored-by: Andrew Novoselac &lt;andrew.novoselac@shopify.com&gt;

* YJIT: Implement opt_duparray_send include_p

Co-authored-by: Andrew Novoselac &lt;andrew.novoselac@shopify.com&gt;

* Update opt_newarray_send to support simple forms of include?(arg)

Similar to opt_duparray_send but for non-static arrays.

* YJIT: Implement opt_newarray_send include_p

---------

Co-authored-by: Andrew Novoselac &lt;andrew.novoselac@shopify.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>Uncomment test accidentally commented in 1656350</title>
<updated>2024-08-22T23:47:40+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2024-08-22T23:47:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=fdba458e85bc66f35194f15a55aa8c27a4b5ce4a'/>
<id>fdba458e85bc66f35194f15a55aa8c27a4b5ce4a</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Don't use gc_impl.h inside of gc/gc.h</title>
<updated>2024-08-22T17:50:17+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2024-08-21T19:20:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=165635049a2f5af83efe2bd64b08e7b59e925e18'/>
<id>165635049a2f5af83efe2bd64b08e7b59e925e18</id>
<content type='text'>
Using gc_impl.h inside of gc/gc.h will cause gc/gc.h to use the functions
in gc/default.c when builing with shared GC support because gc/gc.h is
included into gc.c before the rb_gc_impl functions are overridden by the
preprocessor.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Using gc_impl.h inside of gc/gc.h will cause gc/gc.h to use the functions
in gc/default.c when builing with shared GC support because gc/gc.h is
included into gc.c before the rb_gc_impl functions are overridden by the
preprocessor.
</pre>
</div>
</content>
</entry>
<entry>
<title>array.c: Remove outdated assertions</title>
<updated>2024-07-03T15:16:17+00:00</updated>
<author>
<name>Jean Boussier</name>
<email>jean.boussier@gmail.com</email>
</author>
<published>2024-07-03T14:17:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=786cf9db488dd83a8c13c88485602c778e5d9564'/>
<id>786cf9db488dd83a8c13c88485602c778e5d9564</id>
<content type='text'>
Following [Feature #20589] it can happen that we change the
capacity of a frozen array, so these assertions no longer make
sense.

Normally we don't hit them because `Array#freeze` shrinks the
array, but if somehow the Array was frozen using `Object#freeze`
then we may shrink it after it was frozen.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Following [Feature #20589] it can happen that we change the
capacity of a frozen array, so these assertions no longer make
sense.

Normally we don't hit them because `Array#freeze` shrinks the
array, but if somehow the Array was frozen using `Object#freeze`
then we may shrink it after it was frozen.
</pre>
</div>
</content>
</entry>
<entry>
<title>Add regression test for mutating pack's format string</title>
<updated>2024-07-03T00:59:48+00:00</updated>
<author>
<name>Aaron Patterson</name>
<email>tenderlove@ruby-lang.org</email>
</author>
<published>2024-07-03T00:17:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=93b19d56de64fdee790a96ddf96fcd08d889ac93'/>
<id>93b19d56de64fdee790a96ddf96fcd08d889ac93</id>
<content type='text'>
It doesn't look like there was a test added for this bug, so I'm adding
it.

Code is from here:

  https://web.archive.org/web/20160908192307/http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-dev/24445
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It doesn't look like there was a test added for this bug, so I'm adding
it.

Code is from here:

  https://web.archive.org/web/20160908192307/http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-dev/24445
</pre>
</div>
</content>
</entry>
<entry>
<title>Resize ary when `Array#sort!` block modifies embedded ary</title>
<updated>2024-04-13T23:41:47+00:00</updated>
<author>
<name>Zack Deveau</name>
<email>zack.ref@gmail.com</email>
</author>
<published>2024-01-19T20:01:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=c479492a6701dcef3d3a96de8946ecf7beb079d4'/>
<id>c479492a6701dcef3d3a96de8946ecf7beb079d4</id>
<content type='text'>
In cases where `rb_ary_sort_bang` is called with a block and
tmp is an embedded array, we need to account for the block
potentially impacting the capacity of ary.

ex:
```
var_0 = (1..70).to_a
var_0.sort! do |var_0_block_129, var_1_block_129|
  var_0.pop
  var_1_block_129 &lt;=&gt; var_0_block_129
end.shift(3)
```

The above example can put the array into a corrupted state
resulting in a heap buffer overflow and possible segfault:
```
ERROR: AddressSanitizer: heap-buffer-overflow on address [...]
WRITE of size 560 at 0x60b0000034f0 thread T0 [...]
```

This commit adds a conditional to determine when the capacity
of ary has been modified by the provided block. If this is
the case, ensure that the capacity of ary is adjusted to
handle at minimum the len of tmp.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In cases where `rb_ary_sort_bang` is called with a block and
tmp is an embedded array, we need to account for the block
potentially impacting the capacity of ary.

ex:
```
var_0 = (1..70).to_a
var_0.sort! do |var_0_block_129, var_1_block_129|
  var_0.pop
  var_1_block_129 &lt;=&gt; var_0_block_129
end.shift(3)
```

The above example can put the array into a corrupted state
resulting in a heap buffer overflow and possible segfault:
```
ERROR: AddressSanitizer: heap-buffer-overflow on address [...]
WRITE of size 560 at 0x60b0000034f0 thread T0 [...]
```

This commit adds a conditional to determine when the capacity
of ary has been modified by the provided block. If this is
the case, ensure that the capacity of ary is adjusted to
handle at minimum the len of tmp.
</pre>
</div>
</content>
</entry>
<entry>
<title>Disable callcc when ASAN is enabled</title>
<updated>2024-03-04T02:07:26+00:00</updated>
<author>
<name>KJ Tsanaktsidis</name>
<email>kj@kjtsanaktsidis.id.au</email>
</author>
<published>2024-02-17T06:30:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=5621d794a2fa9293d1da489d6b0ee0e7c73c9128'/>
<id>5621d794a2fa9293d1da489d6b0ee0e7c73c9128</id>
<content type='text'>
callcc's implementation is fundamentally incompatible with ASAN. Since
callcc is deprecated and almost never used, it's probably OK to disable
callcc when ruby is compiled with ASAN.

[Bug #20273]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
callcc's implementation is fundamentally incompatible with ASAN. Since
callcc is deprecated and almost never used, it's probably OK to disable
callcc when ruby is compiled with ASAN.

[Bug #20273]
</pre>
</div>
</content>
</entry>
<entry>
<title>Skip under_gc_compact_stress on s390x (#10073)</title>
<updated>2024-02-22T22:34:19+00:00</updated>
<author>
<name>Takashi Kokubun</name>
<email>takashikkbn@gmail.com</email>
</author>
<published>2024-02-22T22:34:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=bccf4b30fa251dd4394d4ad477bad53c624d2aba'/>
<id>bccf4b30fa251dd4394d4ad477bad53c624d2aba</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix ary_make_partial_step for compaction</title>
<updated>2023-12-21T15:39:03+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2023-12-19T01:55:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=e191bf42d2077a025c21888573f8b81688e5ea28'/>
<id>e191bf42d2077a025c21888573f8b81688e5ea28</id>
<content type='text'>
ary could change embeddedness due to compaction, so we should only get
the pointer after allocations.

The included test was crashing with:

    TestArray#test_slice_gc_compact_stress
    ruby/lib/pp.rb:192: [BUG] Segmentation fault at 0x0000000000000038
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
ary could change embeddedness due to compaction, so we should only get
the pointer after allocations.

The included test was crashing with:

    TestArray#test_slice_gc_compact_stress
    ruby/lib/pp.rb:192: [BUG] Segmentation fault at 0x0000000000000038
</pre>
</div>
</content>
</entry>
<entry>
<title>Array#rassoc should try to convert to array implicitly. Fixes #20003</title>
<updated>2023-11-29T00:39:15+00:00</updated>
<author>
<name>Tema Bolshakov</name>
<email>either.free@gmail.com</email>
</author>
<published>2023-11-12T20:12:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=e4a11a1283da07fd1d94535298c605caf299a834'/>
<id>e4a11a1283da07fd1d94535298c605caf299a834</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
