summaryrefslogtreecommitdiff
path: root/array.c
AgeCommit message (Collapse)Author
2022-03-26[DOC] Use simple references to operator methodsNobuyoshi Nakada
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-25Fix formatting errors in What's Here for Array, Hash, ENV (#5718)Burdette Lamar
Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2022-03-25[DOC] Repair format and links in What's Here sections (#5711)Burdette Lamar
* Repair format and links in What's Here for Comparable and Array * Repair format for What's Here in enum.c Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2022-03-22[Feature #18634] Implement Arrays on Variable Width AllocationPeter Zhu
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. Notes: Merged: https://github.com/ruby/ruby/pull/5660
2022-03-14Assume that refcnt of shared root is non-negativePeter Zhu
The refcnt of a shared root array should always be non-negative.
2022-03-14Assume that shared_root exists in rb_ary_decrement_sharePeter Zhu
All callers of rb_ary_decrement_share guarantee that shared_root is not 0.
2022-03-12Fix crash on GC stress and RGENGC_CHECK_MODE=2Peter Zhu
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-11Add rb_ary_resetPeter Zhu
rb_ary_reset will free heap allocated arrays and unshare shared arrays.
2022-03-11Refactor duplicate code in rb_array_replacePeter Zhu
In both cases in the if statement, we free heap allocated arrays and unshare shared arrays.
2022-03-07Use rb_ary_unshare for shared array in rb_ary_replacePeter Zhu
rb_ary_unshare will perform FL_UNSET_SHARED and rb_ary_decrement_share.
2022-03-03Doc: fix documentation typo for Array#minRogerio Bordignon
Notes: Merged: https://github.com/ruby/ruby/pull/5621
2022-03-01[DOC] Fix documentation for Array#deleteVivek Bharath Akupatni
Never returns self. Notes: Merged: https://github.com/ruby/ruby/pull/5605 Merged-By: nobu <nobu@ruby-lang.org>
2022-02-23Use rb_ary_behead for rb_ary_shiftPeter Zhu
rb_ary_shift is just a special case of rb_ary_behead where we behead only 1 element. Notes: Merged: https://github.com/ruby/ruby/pull/5590
2022-02-14Use RARRAY_SHARED_ROOT_FLAG for checking re-enterPeter Zhu
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. Notes: Merged: https://github.com/ruby/ruby/pull/5547
2022-02-12[DOC] Simplify operator method referencesNobuyoshi Nakada
2022-02-08[DOC] Adjustments to links in array.c (#5532)Burdette Lamar
Mostly suppressing links to itself. Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2022-02-08[DOC] Fix broken links to literals.rdocNobuyoshi Nakada
2022-02-08[DOC] Simplify links to global methodsNobuyoshi Nakada
2022-02-07[DOC] Use RDoc link style for links in the same class/modulePeter Zhu
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 Notes: Merged: https://github.com/ruby/ruby/pull/5530
2022-02-07[DOC] Use RDoc link style for links to other classes/modulesPeter Zhu
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 Notes: Merged: https://github.com/ruby/ruby/pull/5530
2021-12-03Adding links to literals and Kernel (#5192)Burdette Lamar
* Adding links to literals and Kernel Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2021-11-15Use `Primitive.mandatory_only?` for `Array#sample`Koichi Sasada
Notes: Merged: https://github.com/ruby/ruby/pull/5112
2021-11-08[Feature #18290] Remove all usages of rb_gc_force_recyclePeter Zhu
This commit removes usages of rb_gc_force_recycle since it is a burden to maintain and makes changes to the GC difficult. Notes: Merged: https://github.com/ruby/ruby/pull/4363
2021-10-13Remove repeated 'the' (#4966)180909
Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2021-10-03Using NIL_P macro instead of `== Qnil`S.H
Notes: Merged: https://github.com/ruby/ruby/pull/4925 Merged-By: nobu <nobu@ruby-lang.org>
2021-09-15[DOC] Fix broken links [ci skip]Nobuyoshi Nakada
* 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-14Bsearch doc for Array and Range (#4838)Burdette Lamar
This PR creates doc/bsearch.rdoc to provide common documentation for bsearch in Array and Range. Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2021-09-11Using RB_BIGNUM_TYPE_P macroS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/4805
2021-09-10include/ruby/internal/intern/array.h: add doxygen卜部昌平
Must not be a bad idea to improve documents. [ci skip] Notes: Merged: https://github.com/ruby/ruby/pull/4815
2021-09-02Guard array when appendingAaron Patterson
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-08-31Fix a code in the Array#min documentation.universato
Notes: Merged: https://github.com/ruby/ruby/pull/4463
2021-08-29Fix length calculation for Array#slice!Mike Dalessio
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) Notes: Merged: https://github.com/ruby/ruby/pull/4787
2021-08-02Using RBOOL macroS.H
Notes: Merged: https://github.com/ruby/ruby/pull/4695 Merged-By: nobu <nobu@ruby-lang.org>
2021-07-29should not share same `def` for specialized methodKoichi Sasada
Because the key of redefine table is `def`, `def` should be unique for each optimized method (`alias` is not allowed). Notes: Merged: https://github.com/ruby/ruby/pull/4493
2021-06-21What's Here for Numeric and ComparableBurdette Lamar
2021-06-17Adjust styles [ci skip]Nobuyoshi Nakada
* --braces-after-func-def-line * --dont-cuddle-else * --procnames-start-lines * --space-after-for * --space-after-if * --space-after-while
2021-05-21Do not allow array modifications after freeze inside sort!Jeremy Evans
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] Notes: Merged: https://github.com/ruby/ruby/pull/4335 Merged-By: jeremyevans <code@jeremyevans.net>
2021-05-08Fix example code in Array#max docMasataka Pocke Kuwabara
`[0, 1, 2, 3].max(6)` actually returns `[3, 2, 1, 0]`, but the doc said it returns `[3, 2, 1]`. Notes: Merged: https://github.com/ruby/ruby/pull/4475
2021-05-04Correctly update array capacity after reallocPeter Zhu
Reallocating to a smaller size in the transient heap may result in no change in the actual capacity but the capacity of the array is still updated to the smaller value. This commit changes `ary_heap_realloc` to return the new capacity which can be used by the caller to correctly update the capacity. Notes: Merged: https://github.com/ruby/ruby/pull/4448
2021-04-21array.c (rb_ary_zip): take only as many as needed from an Enumerator (#4389)Yusuke Endoh
[Bug #17814] Notes: Merged-By: mame <mame@ruby-lang.org>
2021-04-16Add Array#intersect?Travis Hunter
Notes: Merged: https://github.com/ruby/ruby/pull/1972
2021-03-29[DOC] Improve an example of Array#count comparison [ci skip]Nobuyoshi Nakada
2021-03-28[Doc] Fix Array#count comparing strategyKenichi Kamiya
Notes: Merged: https://github.com/ruby/ruby/pull/4332
2021-03-20Ensure the receiver is modifiable before shrinking [Bug #17736]Nobuyoshi Nakada
* Ensure the receiver is modifiable before shinking [Bug #17736] * Assert the receivers are not modified Notes: Merged: https://github.com/ruby/ruby/pull/4296 Merged-By: nobu <nobu@ruby-lang.org>
2021-02-12Define rb_to_array which converts with to_aNobuyoshi Nakada
2021-02-07[DOC] {Array,MatchData}#values_at understand ranges [ci skip]Nobuyoshi Nakada
2021-02-06Improve performance of Array#- when it is called with empty arrayMasaki Matsushita
This change make Array#- return a copy of the receiver when the other array is empty.
2021-02-06[DOC] Fixed a markup in Array#sum [ci skip]Nobuyoshi Nakada
2021-01-20Explicit references to EnumerableBurdetteLamar
2021-01-18Revert "[Document][Array] Add missing call-seq for Array#append"Marc-Andre Lafortune
This reverts commit ac1a4bccbda4358436a7a907a7f09d047f562740. See https://github.com/ruby/ruby/pull/4088