summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-array-ext/src/array.c
AgeCommit message (Collapse)Author
2021-12-30Get object properties after `mrb_get_args()`dearblue
ref. #5613 I checked with Valgrind, and the methods that can cause use-after-free are `Array#rotate`, `Array#rotate!`, and `String#byteslice`. Since `String#rindex` uses `RSTRING_LEN()` indirectly inside the function, no reference to the out-of-bounds range is generated.
2021-05-27array.c: unify `mrb_ary_ref` and `mrb_ary_entry`Yukihiro "Matz" Matsumoto
Use only `mrb_ary_entry` hereafter.
2021-05-15mruby-array-ext/array.c: implement `Array#rotate` in C.Yukihiro "Matz" Matsumoto
The Ruby version of `Array#rotate!` generated a rotated array and replaced the receiver, but the C version rotates the receiver array in-place. So the performance is improved a lot both in speed and memory consumption. Look for the comments in `array.c` for the in-place rotating algorithm, if you are interested.
2021-05-14mruby-array-ext/array.c: implement `Array#compact` in C.Yukihiro "Matz" Matsumoto
2021-01-26Revert "Minimize the changes in #5277"Yukihiro "Matz" Matsumoto
This reverts commit dc51d89ac22acc60b9bfeed87115863565b74085.
2021-01-22Minimize the changes in #5277Yukihiro "Matz" Matsumoto
Instead of including `mruby/presym.h` everywhere, we provided the fallback `mruby/presym.inc` under `include/mruby` directory, and specify `-I<build-dir>/include` before `-I<top-dir>/include` in `presym.rake`. So even when someone drops `-I<build-dir>/include` in compiler options, it just compiles without failure.
2021-01-11Avoid including `presym.inc` in existing header filesKOBAYASHI Shuji
Addressed an issue where existing programs linking `libmruby.a` could only be built by adding `<build-dir>/include` to compiler's include path.
2020-10-22Prohibit array changes by "a"/"*" specifier of `mrb_get_args()`dearblue
The "a"/"*" specifier of the `mrb_get_args()` function will now return `const mrb_value *`. This is because it is difficult for the caller to check if it is an array object and write-barrier if necessary. And it requires calling `mrb_ary_modify()` on the unmodified array object, which is also difficult (this is similar to #5087).
2020-10-12Rename `MRB_TT_FIXNUM` to `MRB_TT_INTEGER`.Yukihiro "Matz" Matsumoto
We still have `#define MRB_TT_FIXNUM MRB_TT_INTEGER` for compatibility.
2020-10-12Use `mrb_funcall_id()` extensively.Yukihiro "Matz" Matsumoto
Except for support files e.g. `mruby-test/driver.c`, which are not target of symbol collection via `rake gensym`.
2020-06-25Use `mrb_get_argc()` to improve performance.Yukihiro "Matz" Matsumoto
2020-06-20Add `mrb_get_arg1()` that retrieves single (and only) argument.Yukihiro "Matz" Matsumoto
`mrb_get_arg1()` raises `ArgumentError` if the method does not receive one argument. And replaces all `mrb_get_args(mrb, "o", &arg)` by the new function.
2019-09-26Use type predicate macros instead of `mrb_type` if possibleKOBAYASHI Shuji
For efficiency with `MRB_WORD_BOXING` (implement type predicate macros for all `enum mrb_vtype`).
2019-06-23Fix argument specs to `Array`KOBAYASHI Shuji
2019-05-25Name the return value of `mrb_range_beg_len()`dearblue
2018-09-20Make `#to_h` to take a block; [ruby-core:89088]Yukihiro "Matz" Matsumoto
2018-09-18Array size may be changed in `mrb_get_args()` reentry.Yukihiro "Matz" Matsumoto
fix #4116; fix #4117; fix #4118; fix #4119; fix #4120
2017-10-17Use a new function: `mrb_get_argc()`; ref #3826Yukihiro "Matz" Matsumoto
2017-08-11Remove unnecessary inline function `ary_elt`.Yukihiro "Matz" Matsumoto
And the function does not conform the naming convention anyway.
2017-07-27Embed small size array elements in the heap.Yukihiro "Matz" Matsumoto
It reduces the memory consumption and sometimes improve the performance as well. For example, the consumed memory size of `bench/bm_ao_render.rb` is reduced from 1.2GB to 1GB, and its total execution time become 18.795 sec from 22.229 sec.
2017-04-02Fixed out of bounds access; fix #3572, ref #3553Yukihiro "Matz" Matsumoto
2017-03-28Avoid inline local variable declarations; fix #3554Yukihiro "Matz" Matsumoto
2017-03-28Implement Array#slice!Kenji Okimoto
2016-11-16Fixed a memory problem in Array#to_hYukihiro "Matz" Matsumoto
Reported from Alex Snaps via Mathieu Leduc-Hamel, both from shopify.com. Thank you!
2015-11-27include changed from by quotes ("") to by brackets (<>); close #3032Yukihiro "Matz" Matsumoto
2015-10-21Revert "Mark core gems with mrbgem tag"Seba Gamboa
This reverts commit 5cdcce8dbddd94ecb9503a0a1d47370c4ef97177.
2015-10-20Remove obvious warnings from docsSeba Gamboa
2015-10-20Mark core gems with mrbgem tagSeba Gamboa
2014-06-02Add Array#to_hMitsutaka Mimura
2014-05-25no one uses Array.try_convert, so removed it that discourages duck typing; ↵Yukihiro "Matz" Matsumoto
close #2317
2014-05-03use proper length for mrb_get_values_at()Yukihiro "Matz" Matsumoto
separate mrb_range_beg_len() into two: the one truncates range into the sequence size, and the one does not. #values_at uses the latter.
2014-05-02Implement Struct#values_at and Array#values_at .take_cheeze
Add API `mrb_get_values_at()` to mruby/range.h .
2013-04-25rename every ARGS_XXX to MRB_ARGS_XXX; ref #1206Yukihiro "Matz" Matsumoto
2013-03-15rename methodskandhas
2013-03-15add mrbgem: mrb-array-extskandhas