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

1141 Коммитов

Автор SHA1 Сообщение Дата
Peter Zhu 47f33c3848 Remove useless `#if 1` in array.c 2023-12-23 09:51:30 -05:00
Peter Zhu e191bf42d2 Fix ary_make_partial_step for compaction
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
2023-12-21 10:39:03 -05:00
Nobuyoshi Nakada 40fc9b070c
[DOC] No document for internal or debug methods 2023-12-18 20:17:45 +09:00
Tema Bolshakov e4a11a1283 Array#rassoc should try to convert to array implicitly. Fixes #20003 2023-11-29 09:39:15 +09:00
Peter Zhu 150ed44d87 Fix compaction during ary_make_partial
The ary_make_shared call may allocate, which can trigger a GC
compaction. This can cause the array to be embedded because it has a
length of 0.
2023-11-27 12:40:26 -05:00
Jean Boussier 9691532428 Get rid of flatten_memo_data_type
We can use an hidden Hash instead, it's simpler, triggers
write barriers, handle compaction, etc.
2023-11-22 17:10:03 +01:00
Peter Zhu 4cc5659293 Keep write-barrier status after splicing array
We don't need to remove the write-barrier protected status after
splicing an array. We can simply add it to the rememberset for marking
during the next GC.

The benchmark illustrates the performance impact on minor GC:

```
require "benchmark"

arys = 1_000_000.times.map do
  ary = Array.new(50)
  ary.insert(1, 3)
  ary
end

4.times { GC.start }

puts(Benchmark.measure do
  1000.times do
    GC.start(full_mark: false)
  end
end)
```

This branch:

```
  1.309910   0.004342   1.314252 (  1.314580)
```

Master branch:

```
 54.376091   0.219037  54.595128 ( 54.742996)
```
2023-09-04 08:50:27 -04:00
Nobuyoshi Nakada 247fa3ca76
[DOC] Remove typo 2023-08-29 19:40:52 +09:00
Kouhei Yanagita a28c5151f5 Fix Array#bsearch when block returns a non-integer numeric value 2023-08-29 18:00:44 +09:00
Peter Zhu c8d6419985 Refactor ary_make_partial 2023-08-18 10:25:36 -04:00
Burdette Lamar 6ccc660d85
[DOC] Don't suppress autolinks (#8207) 2023-08-11 17:53:53 -04:00
Kunshan Wang aeff31168a No computing embed_capa_max in ary_make_partial
ary_make_partial now uses the actual embed_capa of an allocated heap
array to guide whether make an embedded copy or a slice view.
2023-08-03 08:34:24 -04:00
Peter Zhu 62ecf78b87 Don't pass array into ary_heap_alloc
We no longer need a reference to the array when allocating the buffer
because we no longer allocate through the transient heap.
2023-07-13 14:48:14 -04:00
Peter Zhu 87e1486d31 Remove unused references to the transient heap 2023-07-13 14:48:14 -04:00
Peter Zhu 3223181284 Remove RARRAY_CONST_PTR_TRANSIENT
RARRAY_CONST_PTR now does the same things as RARRAY_CONST_PTR_TRANSIENT.
2023-07-13 14:48:14 -04:00
Peter Zhu de327ccb63 Remove RARRAY_PTR_USE_TRANSIENT
RARRAY_PTR_USE now does the same things as RARRAY_PTR_USE_TRANSIENT.
2023-07-13 14:48:14 -04:00
Peter Zhu 1e7b67f733 [Feature #19730] Remove transient heap 2023-07-13 09:27:33 -04:00
Nobuyoshi Nakada a5e1d549b5 [DOC] Mention the edge case of `any?`/`all?` 2023-06-01 21:44:53 +09:00
Peter Zhu 0938964ba1 Implement Hash ST tables on VWA 2023-05-17 09:19:40 -04:00
Nobuyoshi Nakada 0e5aecea11
[DOC] Move docs of `Array#first` and `Array#last` to array.rb 2023-05-10 15:47:39 +09:00
Jeremy Evans 986268afae Document that Array#{&,intersection,intersect?} use hash method [ci skip]
Fixes [Bug #19622]
2023-05-09 02:25:56 -07:00
git 21082eac50 * expand tabs. [ci skip]
Please consider using misc/expand_tabs.rb as a pre-commit hook.
2023-04-19 00:16:36 +00:00
Aaron Patterson c5fc1ce975 Emit special instruction for array literal + .(hash|min|max)
This commit introduces a new instruction `opt_newarray_send` which is
used when there is an array literal followed by either the `hash`,
`min`, or `max` method.

```
[a, b, c].hash
```

Will emit an `opt_newarray_send` instruction.  This instruction falls
back to a method call if the "interested" method has been monkey
patched.

Here are some examples of the instructions generated:

```
$ ./miniruby --dump=insns -e '[@a, @b].max'
== disasm: #<ISeq:<main>@-e:1 (1,0)-(1,12)> (catch: FALSE)
0000 getinstancevariable                    :@a, <is:0>               (   1)[Li]
0003 getinstancevariable                    :@b, <is:1>
0006 opt_newarray_send                      2, :max
0009 leave
$ ./miniruby --dump=insns -e '[@a, @b].min'
== disasm: #<ISeq:<main>@-e:1 (1,0)-(1,12)> (catch: FALSE)
0000 getinstancevariable                    :@a, <is:0>               (   1)[Li]
0003 getinstancevariable                    :@b, <is:1>
0006 opt_newarray_send                      2, :min
0009 leave
$ ./miniruby --dump=insns -e '[@a, @b].hash'
== disasm: #<ISeq:<main>@-e:1 (1,0)-(1,13)> (catch: FALSE)
0000 getinstancevariable                    :@a, <is:0>               (   1)[Li]
0003 getinstancevariable                    :@b, <is:1>
0006 opt_newarray_send                      2, :hash
0009 leave
```

[Feature #18897] [ruby-core:109147]

Co-authored-by: John Hawthorn <jhawthorn@github.com>
2023-04-18 17:16:22 -07:00
Matt Valentine-House 026321c5b9 [Feature #19474] Refactor NEWOBJ macros
NEWOBJ_OF is now our canonical newobj macro. It takes an optional ec
2023-04-06 11:07:16 +01:00
Peter Zhu 1da2e7fca3
[Feature #19579] Remove !USE_RVARGC code (#7655)
Remove !USE_RVARGC code

[Feature #19579]

The Variable Width Allocation feature was turned on by default in Ruby
3.2. Since then, we haven't received bug reports or backports to the
non-Variable Width Allocation code paths, so we assume that nobody is
using it. We also don't plan on maintaining the non-Variable Width
Allocation code, so we are going to remove it.
2023-04-04 17:30:06 -04:00
Takashi Kokubun 1b475fcd10 Remove an unneeded function copy 2023-04-01 23:09:05 -07:00
Koichi Sasada 0112a5b342 `Array#first` and `Array#last` in Ruby 2023-03-23 14:03:12 +09:00
Jean Boussier ca437aeb39 rb_ary_sum: don't enter fast path if initial isn't a native numeric type.
[Bug #19530]

If the initial value isn't one of the special cased types, we directly
jump to the slow path.
2023-03-15 09:12:59 +00:00
Nobuyoshi Nakada 00d6772e40
Adjust styles [ci skip] 2023-03-08 14:02:46 +09:00
Jimmy Miller 56df6d5f9d
YJIT: Handle splat+rest for args pass greater than required (#7468)
For example:

```ruby
def my_func(x, y, *rest)
    p [x, y, rest]
end

my_func(1, 2, 3, *[4, 5])
```
2023-03-07 17:03:43 -05:00
Takashi Kokubun 233ddfac54 Stop exporting symbols for MJIT 2023-03-06 21:59:23 -08:00
BurdetteLamar 3b239d2480 Remove (newly unneeded) remarks about aliases 2023-02-19 14:26:34 -08:00
Peter Zhu 84be7a4089 Keep shared arrays WB protected
Sharing an array will cause it to be WB unprotected due to the use
of `RARRAY_PTR`. We don't need to WB unprotect the array because we're
not writing to the buffer of the array.

The following script demonstrates this issue:

```
ary = [1] * 1000
shared = ary[10..20]
puts ObjectSpace.dump(ary)
```
2023-02-02 09:17:20 -05:00
Peter Zhu 5eeebd68cf Remove function ary_recycle_hash
Freeing the memory of a Hash should be done by the garbage collector
and not by array functions. This could potentially leak memory if
ary_recycle_hash was not implemented properly.
2023-01-24 13:34:21 -05:00
Peter Zhu 2861c8deaf Remove ARY_SET_SHARED
We don't need ARY_SET_SHARED since we already have rb_ary_set_shared.
2023-01-10 08:59:38 -05:00
Peter Zhu 7891f94071 Don't allow re-embedding frozen arrays
Frozen arrays should not move from heap allocated to embedded because
frozen arrays could be shared roots for other (shared) arrays. If the
frozen array moves from heap allocated to embedded it would cause issues
since the shared array would no longer know where to set the pointer
in the shared root.
2022-12-23 11:21:14 -05:00
Peter Zhu 4f73de67ed Fix typo in array.c
We should be using the size of RArray and not RString for arrays.
2022-12-22 13:16:55 -05:00
Jonathan Lim e1ca089b5d
[DOC] Correct Array#compact! description 2022-12-11 12:24:01 -05:00
Daniel Colson e69b91fae4 Introduce BOP_CMP for optimized comparison
Prior to this commit the `OPTIMIZED_CMP` macro relied on a method lookup
to determine whether `<=>` was overridden. The result of the lookup was
cached, but only for the duration of the specific method that
initialized the cmp_opt_data cache structure.

With this method lookup, `[x,y].max` is slower than doing `x > y ?
x : y` even though there's an optimized instruction for "new array max".
(John noticed somebody a proposed micro-optimization based on this fact
in https://github.com/mastodon/mastodon/pull/19903.)

```rb
a, b = 1, 2
Benchmark.ips do |bm|
  bm.report('conditional') { a > b ? a : b }
  bm.report('method') { [a, b].max }
  bm.compare!
end
```

Before:

```
Comparison:
         conditional: 22603733.2 i/s
              method: 19820412.7 i/s - 1.14x  (± 0.00) slower
```

This commit replaces the method lookup with a new CMP basic op, which
gives the examples above equivalent performance.

After:

```
Comparison:
              method: 24022466.5 i/s
         conditional: 23851094.2 i/s - same-ish: difference falls within
error
```

Relevant benchmarks show an improvement to Array#max and Array#min when
not using the optimized newarray_max instruction as well. They are
noticeably faster for small arrays with the relevant types, and the same
or maybe a touch faster on larger arrays.

```
$ make benchmark COMPARE_RUBY=<master@5958c305> ITEM=array_min
$ make benchmark COMPARE_RUBY=<master@5958c305> ITEM=array_max
```

The benchmarks added in this commit also look generally improved.

Co-authored-by: John Hawthorn <jhawthorn@github.com>
2022-12-06 12:37:23 -08:00
Yudai Takada 29e6d97517
Fix typos (#6775)
* s/Innteger/Integer/

* s/diretory/directory/

* s/Bufer/Buffer/

* s/defalt/default/

* s/covearge/coverage/
2022-11-20 21:07:18 -08:00
S-H-GAMELINKS 1f4f6c9832 Using UNDEF_P macro 2022-11-16 18:58:33 +09:00
Peter Zhu 9a6c3355c5 Set array capacity/shared immediately after alloc
If auto-compaction is enabled, then we have to set the capacity/shared
immediately after allocating a heap array. If compaction runs before
capacity/shared is set then it could cause the array to be re-embedded,
which can cause crashes.
2022-11-14 15:40:47 -05:00
Nobuyoshi Nakada 5ccb625fbb
Use `roomof` macro for rounding up divisions 2022-10-14 19:23:25 +09:00
Victor Shepelev ad651925e3
Add Data class implementation: Simple immutable value object 2022-09-30 18:23:19 +09:00
Matt Valentine-House 892f350a7d [Bug #19029] Don't start GC during compaction
RARRAY_PTR when called with a transient array detransients the array
before returning its pointer which allocates in the heap.

Because RARRAY_PTR was being used during compaction (when re-embedding
arrays that have moved between size pools) this introduces the
possibility that we can hit a malloc threshold, triggering GC, while in
the middle of compaction.

We should avoid this by using safer functions to get hold of the
pointer. Since we know that the array is not embedded here, we can use
ARY_HEAP_PTR and ARY_EMBED_PTR directly
2022-09-29 09:22:14 -04:00
Jeremy Evans cfb9624460
Fix Array#[] with ArithmeticSequence with negative steps (#5739)
* Fix Array#[] with ArithmeticSequence with negative steps

Previously, Array#[] when called with an ArithmeticSequence
with a negative step did not handle all cases correctly,
especially cases involving infinite ranges, inverted ranges,
and/or exclusive ends.

Fixes [Bug #18247]

* Add Array#slice tests for ArithmeticSequence with negative step to test_array

Add tests of rb_arithmetic_sequence_beg_len_step C-API function.

* Fix ext/-test-/arith_seq/beg_len_step/depend

* Rename local variables

* Fix a variable name

Co-authored-by: Kenta Murata <3959+mrkn@users.noreply.github.com>
2022-08-11 19:16:49 +09:00
Peter Zhu 1c16645216 Make array slices views rather than copies
Before this commit, if the slice fits in VWA, it would make a copy
rather than a view. This is slower as it requires a memcpy of the
contents.
2022-07-28 10:02:12 -04:00
Peter Zhu 4325e90205 Use rb_ary_hidden_new for rb_ary_hidden_new_fill 2022-07-26 09:12:09 -04:00
Peter Zhu efb91ff19b Rename rb_ary_tmp_new to rb_ary_hidden_new
rb_ary_tmp_new suggests that the array is temporary in some way, but
that's not true, it just creates an array that's hidden and not on the
transient heap. This commit renames it to rb_ary_hidden_new.
2022-07-26 09:12:09 -04:00
Peter Zhu 3f70aa6504 Remove ary_discard
ary_discard should not be used as it should be handled by the GC. The
only user of ary_discard is rb_ary_product, which doesn't neeed to use
ary_discard.
2022-07-26 09:12:09 -04:00
Peter Zhu e199ae3edc Remove reference counting for all frozen arrays
The RARRAY_LITERAL_FLAG was added in commit
5871ecf956 to improve CoW performance for
array literals by not keeping track of reference counts.

This commit reverts that commit and has an alternate implementation that
is more generic for all frozen arrays. Since frozen arrays cannot be
modified, we don't need to set the RARRAY_SHARED_ROOT_FLAG and we don't
need to do reference counting.
2022-07-22 13:29:21 -04:00
Peter Zhu 3a5ea7c688 Remove unused variable in array.c
array.c:460:14: warning: unused variable 'len' [-Wunused-variable]
        long len  = ARY_HEAP_LEN(ary);
2022-07-21 15:49:26 -04:00
Peter Zhu 9d862011e8 Remove check for shared root arrays
All shared root arrays should not be on the transient heap.
ary_make_shared evacuates arrays from the transient heap when creating
shared roots.
2022-07-21 15:17:59 -04:00
Takashi Kokubun 5b21e94beb Expand tabs [ci skip]
[Misc #18891]
2022-07-21 09:42:04 -07:00
Peter Zhu 80672b2d0e Add comment in array.c about flags 2022-07-21 09:02:45 -04:00
Peter Zhu d67fcdcc9f Add RARRAY_SHARED_FLAG 2022-07-21 09:02:45 -04:00
Peter Zhu 1c9acb6bb1 Refactor macros of array.c
Move some macros in array.c to internal/array.h so that other files
can also access these macros.
2022-07-21 09:02:45 -04:00
Peter Zhu 5871ecf956 Add RARRAY_LITERAL_FLAG for array literals
Array created as literals during iseq compilation don't need a
reference count since they can never be modified. The previous
implementation would mutate the hidden array's reference count,
causing copy-on-write invalidation.

This commit adds a RARRAY_LITERAL_FLAG for arrays created through
rb_ary_literal_new. Arrays created with this flag do not have reference
count stored and just assume they have infinite number of references.

Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2022-07-20 13:13:56 -04:00
Peter Zhu a1c0aa7701 Remove unused variable in array.c
vshared is no longer used.
2022-07-18 10:49:28 -04:00
Matt Valentine-House 214ed4cbc6 [Feature #18901] Support size pool movement for Arrays
This commit enables Arrays to move between size pools during compaction.
This can occur if the array is mutated such that it would fit in a
different size pool when embedded.

The move is carried out in two stages:

1. The RVALUE is moved to a destination heap during object movement
   phase of compaction
2. The array data is re-embedded and the original buffer free'd if
   required. This happens during the update references step
2022-07-12 08:50:33 -04:00
Alan Wu c416dbb3c7 Add missing write barriers to Array#replace
Previously it made object references without using write barriers,
creating GC inconsistencies.

See: http://ci.rvm.jp/results/trunk-gc-asserts@phosphorus-docker/3925529
2022-04-28 11:31:22 -04:00
Burdette Lamar de5aa98f39
Correct whitespace in array.c (#5791) 2022-04-11 15:23:25 -05:00
Burdette Lamar c789bdd311
[DOC] Enhanced RDoc for Array intro (#5781)
This covers the first few sections of the class doc for Array.
2022-04-10 08:33:49 -05:00
Nobuyoshi Nakada 300f4677c9
[DOC] Use simple references to operator methods
Method references is not only able to be marked up as code, also
reflects `--show-hash` option.
The bug that prevented the old rdoc from correctly parsing these
methods was fixed last month.
2022-03-26 21:13:16 +09:00
Burdette Lamar 1a002d9ade
Fix formatting errors in What's Here for Array, Hash, ENV (#5718) 2022-03-25 13:48:21 -05:00
Burdette Lamar f918f6e4e7
[DOC] Repair format and links in What's Here sections (#5711)
* Repair format and links in What's Here for Comparable and Array

* Repair format for What's Here in enum.c
2022-03-25 10:52:06 -05:00
Peter Zhu a51f30c671 [Feature #18634] Implement Arrays on Variable Width Allocation
This commit implements arrays on Variable Width Allocation. This allows
longer arrays to be embedded (i.e. contents directly follow the object
header) which improves performance through better cache locality.
2022-03-22 09:42:39 -04:00
Peter Zhu 412991268f Assume that refcnt of shared root is non-negative
The refcnt of a shared root array should always be non-negative.
2022-03-14 09:45:24 -04:00
Peter Zhu 45786667ec Assume that shared_root exists in rb_ary_decrement_share
All callers of rb_ary_decrement_share guarantee that
shared_root is not 0.
2022-03-14 09:45:18 -04:00
Peter Zhu 06594e7134 Fix crash on GC stress and RGENGC_CHECK_MODE=2
rb_ary_reset could leave the array in a bad state since it frees memory
but does not unset any flags. This can cause a crash on GC stress. This
commit changes rb_ary_reset to set the array as an empty embedded array.
2022-03-12 12:15:24 -05:00
Peter Zhu 9a4bddd761 Add rb_ary_reset
rb_ary_reset will free heap allocated arrays and unshare shared arrays.
2022-03-11 13:16:29 -05:00
Peter Zhu 42e5ec9414 Refactor duplicate code in rb_array_replace
In both cases in the if statement, we free heap allocated arrays and
unshare shared arrays.
2022-03-11 11:45:14 -05:00
Peter Zhu c445963575 Use rb_ary_unshare for shared array in rb_ary_replace
rb_ary_unshare will perform FL_UNSET_SHARED and
rb_ary_decrement_share.
2022-03-07 09:37:49 -05:00
Rogerio Bordignon 832252794e Doc: fix documentation typo for Array#min 2022-03-03 19:18:36 +01:00
Vivek Bharath Akupatni 11bcc0d9d6
[DOC] Fix documentation for Array#delete
Never returns self.
2022-03-01 09:46:22 +09:00
Peter Zhu 651b2e5959 Use rb_ary_behead for rb_ary_shift
rb_ary_shift is just a special case of rb_ary_behead where we behead
only 1 element.
2022-02-23 09:13:04 -05:00
Peter Zhu 26187a8520 Use RARRAY_SHARED_ROOT_FLAG for checking re-enter
RARRAY_SHARED_ROOT_FLAG is defined as FL_USER5, but we should use
RARRAY_SHARED_ROOT_FLAG instead of depending on that they're equal.
2022-02-14 09:35:54 -05:00
Nobuyoshi Nakada 50c972a1ae
[DOC] Simplify operator method references 2022-02-12 12:38:36 +09:00
Burdette Lamar 85ad8c65ca
[DOC] Adjustments to links in array.c (#5532)
Mostly suppressing links to itself.
2022-02-08 08:51:39 -06:00
Nobuyoshi Nakada 16fdc1ff46
[DOC] Fix broken links to literals.rdoc 2022-02-08 01:27:52 +09:00
Nobuyoshi Nakada bc5662d9d8
[DOC] Simplify links to global methods 2022-02-08 01:18:56 +09:00
Peter Zhu a32e5e1b97 [DOC] Use RDoc link style for links in the same class/module
I used this regex:

(?<=\[)#(?:class|module)-([A-Za-z]+)-label-([A-Za-z0-9\-\+]+)

And performed a global find & replace for this:

rdoc-ref:$1@$2
2022-02-07 09:52:06 -05:00
Peter Zhu f9a2802bc5 [DOC] Use RDoc link style for links to other classes/modules
I used this regex:

([A-Za-z]+)\.html#(?:class|module)-[A-Za-z]+-label-([A-Za-z0-9\-\+]+)

And performed a global find & replace for this:

rdoc-ref:$1@$2
2022-02-07 09:52:06 -05:00
Burdette Lamar 28fb6d6b9e
Adding links to literals and Kernel (#5192)
* Adding links to literals and Kernel
2021-12-03 07:12:28 -06:00
Koichi Sasada a24eeee556 Use `Primitive.mandatory_only?` for `Array#sample` 2021-11-15 15:58:56 +09:00
Peter Zhu aeae6e2842 [Feature #18290] Remove all usages of rb_gc_force_recycle
This commit removes usages of rb_gc_force_recycle since it is a burden
to maintain and makes changes to the GC difficult.
2021-11-08 14:05:54 -05:00
180909 724c657700
Remove repeated 'the' (#4966) 2021-10-13 23:05:44 -07:00
S.H dc9112cf10
Using NIL_P macro instead of `== Qnil` 2021-10-03 22:34:45 +09:00
Nobuyoshi Nakada a27c274f04
[DOC] Fix broken links [ci skip]
* As the "doc/" prefix is specified by the `--page-dir` option,
  remove from the rdoc references.
* Refer to the original .rdoc instead of the converted .html.
2021-09-15 14:16:14 +09:00
Burdette Lamar 1af5a0c574
Bsearch doc for Array and Range (#4838)
This PR creates doc/bsearch.rdoc to provide common documentation for bsearch in Array and Range.
2021-09-14 16:08:21 -05:00
S-H-GAMELINKS 032534dbdf Using RB_BIGNUM_TYPE_P macro 2021-09-11 09:13:24 +09:00
卜部昌平 ce54282b75 include/ruby/internal/intern/array.h: add doxygen
Must not be a bad idea to improve documents. [ci skip]
2021-09-10 20:00:06 +09:00
Aaron Patterson cd4f5b1322
Guard array when appending
This prevents early collection of the array.  The GC doesn't see the
array on the stack when Ruby is compiled with optimizations enabled

[ruby-core:105099] [Bug #18140]
2021-09-02 01:22:19 +09:00
universato b6691e9737 Fix a code in the Array#min documentation. 2021-08-31 20:56:52 +09:00
Mike Dalessio d43279edac Fix length calculation for Array#slice!
Commit 4f24255 introduced a bug which allows a length to be passed to
rb_ary_new4 which is too large, resulting in invalid memory access.

For example:

    (1..1000).to_a.slice!(-2, 1000)
2021-08-29 09:41:22 +09:00
S.H 378e8cdad6
Using RBOOL macro 2021-08-02 12:06:44 +09:00
Koichi Sasada fa0279d947 should not share same `def` for specialized method
Because the key of redefine table is `def`, `def` should be
unique for each optimized method (`alias` is not allowed).
2021-07-29 00:56:48 +09:00
Burdette Lamar c1741df1a1 What's Here for Numeric and Comparable 2021-06-21 10:38:16 -07:00
Nobuyoshi Nakada e4f891ce8d
Adjust styles [ci skip]
* --braces-after-func-def-line
* --dont-cuddle-else
* --procnames-start-lines
* --space-after-for
* --space-after-if
* --space-after-while
2021-06-17 10:13:40 +09:00
Jeremy Evans 8b00bfb7c2
Do not allow array modifications after freeze inside sort!
If freezing an array inside sort!, previously the array could be
modified after the freeze.  This checks whether the receiver is
frozen after every yield and potential call to #> or #<,
preventing modifications if the receiver is frozen inside the
block or by the #> or #< call.

Fixes [Bug #17739]
2021-05-21 18:33:56 -07:00