summaryrefslogtreecommitdiffhomepage
path: root/src/array.c
AgeCommit message (Collapse)Author
2020-10-12Reorganize `Integer` system.Yukihiro "Matz" Matsumoto
- Integrate `Fixnum` and `Integer` - Remove `Integral` - `int / int -> int` - Replace `mrb_fixnum()` to `mrb_int()` - Replace `mrb_fixnum_value()` to `mrb_int_value()`. - Use `mrb_integer_p()` instead of `mrb_fixnum_p()`
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-12Rename float configuration option names.Yukihiro "Matz" Matsumoto
- `MRB_WITHOUT_FLOAT` => `MRB_NO_FLOAT` - `MRB_USE_FLOAT` => `MRB_USE_FLOAT32` The former is to use `USE_XXX` naming convention. The latter is to make sure `float` is 32bit float and not floating point number in general.
2020-10-12Skip array embedding if `MRB_NO_BOXING` and `MRB_32BIT`; fix #4382Yukihiro "Matz" Matsumoto
On some platforms, `sizeof(mrb_value) > sizeof(void*)*3`, which makes `MRB_ARY_EMBED_LEN_MAX` zero. And zero sized array cause compile errors.
2020-10-12Adjust PR #5060 to the latest `mruby3` branch.Yukihiro "Matz" Matsumoto
2020-10-12Use `mrb_field_write_barrier` instead of `mrb_write_barrier` for `push`.Yukihiro "Matz" Matsumoto
When the array is very big, the simpler `mrb_write_barrier` causes calling `gc_mark_children` for big arrays repeatedly. That would hinder performance very badly.
2020-10-12Skip `mrb_get_args()` in `mrb_ary_push()`.Yukihiro "Matz" Matsumoto
2020-10-12Avoid use of designated initializers to generate `irep` struct.Yukihiro "Matz" Matsumoto
Since it's not supported on VC without `/std:c++latest`. That means it doesn't work for `cxx_api` build on Windows VC.
2020-10-12Use `static const struct mrb_irep each_irep` to ininitalize `each`.Yukihiro "Matz" Matsumoto
2020-10-12Constify `irep` members.Yukihiro "Matz" Matsumoto
- `pool` - `syms` - `reps`
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-10-12Use `MRB_QSYM()` instead of `MRB_OPSYM()`.Yukihiro "Matz" Matsumoto
2020-10-12Use `MRB_OPSYM()` instead of `mrb_intern_lit()`.Yukihiro "Matz" Matsumoto
2020-10-12Add `MRB_SYM()` for inline symbols.Yukihiro "Matz" Matsumoto
2020-08-30Fix `mrb_ary_splat()` to copy the array always.Yukihiro "Matz" Matsumoto
2020-08-29Fix the bug caused by `to_a` returning a frozen array.Yukihiro "Matz" Matsumoto
Reported by @shuujii.
2020-08-29Fix `mrb_ary_splat` to copy the array; fix #5067Yukihiro "Matz" Matsumoto
2020-07-22Avoid using `mrb_ary_modify` from the internal function.Yukihiro "Matz" Matsumoto
`mrb_ary_modify` calls `mrb_write_barrier`, so can cause the same problem of the past `push`. It is provided for use-level API.
2020-07-22Use `mrb_field_write_barrier` instead of `mrb_write_barrier` for `push`.Yukihiro "Matz" Matsumoto
When the array is very big, the simpler `mrb_write_barrier` causes calling `gc_mark_children` for big arrays repeatedly. That would hinder performance very badly.
2020-06-22Skip `mrb_get_args()` in `mrb_ary_{aget,aset}` unless necessary.Yukihiro "Matz" Matsumoto
Use simpler `mrb_get_argc()` and `mrb_get_arg1()` instead.
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.
2020-05-24Do not destruct rest arguments for __send__Yusuke Endoh
Formerly, `__send__(*args)` modified `args` with `Array#shift`. This bug affects optcarrot. This changeset avoids the array destruction by using `args = args[1, len-1]`.
2020-04-24Support `undef` for `mrb_ary_splice()` instead of `[]`dearblue
When removing elements from an array, it is possible to avoid creating an empty array. Before this patch: ```c mrb_ary_splice(mrb, ary, head, len, mrb_ary_new(mrb)); ``` After this patch: ```c mrb_ary_splice(mrb, ary, head, len, mrb_undef_value()); ```
2019-12-13Fix arguments check to `Array#each`KOBAYASHI Shuji
#### Before this patch: ``` $ mruby -e '[].each(1){}' #=> no error ``` #### After this patch: ``` $ mruby -e '[].each(1){}' #=> ArgumentError: wrong number of arguments ```
2019-11-08Avoid crashing of `Array#unshift`; fix #4808Yukihiro "Matz" Matsumoto
On cases like `a.unshift(*a)`.
2019-09-18Remove `mrb_get_args(mrb, "")`; ref 30f37872KOBAYASHI Shuji
2019-09-14Add a macro `mrb_frozen_p` that points to `MRB_FROZEN_P`.Yukihiro "Matz" Matsumoto
2019-08-18Prohibit changes to iseq in principledearblue
2019-08-17Implement `Array#each` using inline mruby bytecode.Yukihiro "Matz" Matsumoto
2019-08-05Use new specifiers/modifiers of `mrb_vfromat()`KOBAYASHI Shuji
The binary sizes (gems are only `mruby-bin-mruby`) are reduced slightly in my environment than before the introduction of new specifiers/modifiers (5116789a) with this change. ------------+-------------------+-------------------+-------- BINARY | BEFORE (5116789a) | AFTER (This PR) | RATIO ------------+-------------------+-------------------+-------- mruby | 593416 bytes | 593208 bytes | -0.04% libmruby.a | 769048 bytes | 767264 bytes | -0.23% ------------+-------------------+-------------------+-------- BTW, I accidentally changed `tasks/toolchains/visualcpp.rake` at #4613, so I put it back.
2019-06-23Fix argument specs to `Array`KOBAYASHI Shuji
2019-05-25Name the return value of `mrb_range_beg_len()`dearblue
2019-04-09Extract frozen checking to functionKOBAYASHI Shuji
2019-04-06Move `Array#(append|prepend)` from core to `mruby-ary-ext`KOBAYASHI Shuji
They are not included in ISO standard.
2018-12-15Make mrb_ary_clear() function callable from C againTakashi Sawanaka
2018-11-19Removed `to_ary` conversion method.Yukihiro "Matz" Matsumoto
2018-10-29Add argument check to `Array#clear`; fix #4144Yukihiro "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
2018-09-07Clear terminated spacedearblue
2018-04-25Fix array replace leak error in mruby-uri.Takeshi Watanabe
2018-04-18`ary_dup()` should not use `ary_replace(); fix #4004Yukihiro "Matz" Matsumoto
Otherwise the duplicated object may have shared entities that should not be modified in-line.
2018-04-18A new function `ary_from_values()`; ref #4004Yukihiro "Matz" Matsumoto
2018-04-17Make `ary_replace()` to share entry buffers if possible.Yukihiro "Matz" Matsumoto
2018-04-17Make `ary_concat()` to replace the receiver when it is empty.Yukihiro "Matz" Matsumoto
2018-04-17Make `ary_replace()` to take `struct RArray*` argument.Yukihiro "Matz" Matsumoto
2018-04-17Implement `Array#__svalue` in C.Yukihiro "Matz" Matsumoto
2018-03-19Set array length after expanding capacity.Takeshi Watanabe
2017-12-12Modifying frozen objects will raise `FrozenError`.Yukihiro "Matz" Matsumoto
`FrozenError` is a subclass of `RuntimeError` which used to be raised. [Ruby2.5]
2017-11-13The number of argument should be retrieved by `mrb_get_argc`; fix #3848Yukihiro "Matz" Matsumoto
You should not access `mrb->c->ci->argc` directly.
2017-10-11Add MRB_WITHOUT_FLOATYAMAMOTO Masaya