summaryrefslogtreecommitdiffhomepage
path: root/src
AgeCommit message (Collapse)Author
2020-10-12Use functions that take symbols to reduce string litrals in C.Yukihiro "Matz" Matsumoto
2020-10-12Provide functions that take symbols instead of `const char*`.Yukihiro "Matz" Matsumoto
- mrb_define_class_id - mrb_define_module_id - mrb_define_method_id - mrb_define_singleton_method_id - mrb_define_module_function_id - mrb_define_const_id - mrb_undef_method_id - mrb_undef_class_method_id - mrb_class_defined_id - mrb_class_get_id - mrb_class_defined_under_id - mrb_class_get_under_id - mrb_module_get_id - mrb_module_get_under_id - mrb_define_class_under_id - mrb_define_module_under_id - mrb_exc_get_id
2020-10-12Add functions that take symbols as arguments.Yukihiro "Matz" Matsumoto
- :
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-12Define a new function `mrb_funcall_id()`.Yukihiro "Matz" Matsumoto
`mrb_funcall_id()` takes `mrb_sym` instead of `char*` for a method name. You can use `MRB_SYM()`/`MRB_QSYM()` to specify the method to call.
2020-10-12Use `MRB_QSYM()` instead of `MRB_OPSYM()`.Yukihiro "Matz" Matsumoto
2020-10-12Rename `MRB_OPSYM()` to `MRB_QSYM()`.Yukihiro "Matz" Matsumoto
Where `QSYM` means quoted symbols, which cannot be represented C symbols, so specify aliases instead. - operators: name of the operation, e.g. add for `+` - predicates: add `_p` suffix instead of `?` - bang methods: add `_b` suffix instead of `!` - instance variables: add `a_` prefix instead of `@` - global variables: add `d_` prefix instead of `@` - class variables: unsupported; don't use them
2020-10-12Use `MRB_OPSYM()` instead of `mrb_intern_lit()`.Yukihiro "Matz" Matsumoto
2020-10-12Create `MRB_OPSYM()` macro to refer symbols corresponding operators.Yukihiro "Matz" Matsumoto
For example, `MRB_OPSYM(add)` refers a symbol for `+`.
2020-10-12Fix `presym_find` for strings without `NUL` terminators.Yukihiro "Matz" Matsumoto
2020-10-12Update `presym_find` to use more efficient binary search.Yukihiro "Matz" Matsumoto
2020-10-12Add `MRB_SYM()` for inline symbols.Yukihiro "Matz" Matsumoto
2020-10-12Support `presym` in `symbol.c`.Yukihiro "Matz" Matsumoto
2020-10-12Fix argument error when built with MRB_WITHOUT_FLOAT flagssmallkirby
Fixed inproper argument of mrb_fixnum_value() called in integral_div(), when built with MRB_WITHOUT_FLOAT flag. Co-authored-by: taiyoslime <[email protected]> Co-authored-by: n4o847 <[email protected]>
2020-09-25Prohibit string changes by "s"/"z" specifier of `mrb_get_args()`dearblue
- The `s` specifier is a string pointer obtained without performing `mrb_str_modify()`, so it cannot be changed. - The `z` specifier cannot be changed because it is a string pointer obtained by `RSTRING_CSTR()` which returns `const char *`.
2020-09-18Remove redundant type-checkWataru Ashihara
since mrb_str_to_str() also does it.
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 a bug introduced by the last commit.Yukihiro "Matz" Matsumoto
Should have handled the case `to_a` returns `nil`.
2020-08-29Fix `mrb_obj_ceqq` to avoid array copying.Yukihiro "Matz" Matsumoto
2020-08-29Fix `mrb_ary_splat` to copy the array; fix #5067Yukihiro "Matz" Matsumoto
2020-08-11Fix `mrb_int` and `size_t` combination warnings.Yukihiro "Matz" Matsumoto
2020-08-08Return `NaN` for `0/0`; d8e060dYukihiro "Matz" Matsumoto
2020-08-08Should not use `mrb_float_value()` with `MRB_WITHOUT_FLOAT`.Yukihiro "Matz" Matsumoto
2020-08-08Reintroduce `mrb_static_assert`; #5051Yukihiro "Matz" Matsumoto
Note that the home brew version of `mrb_static_assert` only works within the function body. This reverts commit 8f99689.
2020-08-07Avoid `division by zero` undefined behavior.Yukihiro "Matz" Matsumoto
2020-08-06Use `memcpy` to copy stack.Yukihiro "Matz" Matsumoto
2020-08-06Use `memset()` to clear stack unless `MRB_NAN_BOXING`.Yukihiro "Matz" Matsumoto
2020-08-06Remove block clear of `callinfo`.Yukihiro "Matz" Matsumoto
2020-08-06Remove `mrb_static_assert` from the core; #5051Yukihiro "Matz" Matsumoto
2020-08-05Merge pull request #5052 from dearblue/cistacksYukihiro "Matz" Matsumoto
Extend the `cipush()` and `cipop()` functions
2020-08-03Initialized local variables in `mrb_hash_shift()`.Yukihiro "Matz" Matsumoto
2020-07-26Extend the `cipush()` and `cipop()` functionsdearblue
- Returns the updated call info. - Unify the processing around `cipush()`. - `cipop()` restores the stack.
2020-07-25Merge pull request #5049 from shuujii/use-type-tag-for-hash-code-in-ht_hash_funcYukihiro "Matz" Matsumoto
Use type tag for hash code in `ht_hash_func()`
2020-07-25Use type tag for hash code in `ht_hash_func()`KOBAYASHI Shuji
The function corresponding to `ht_hash_func()` was as follows in the days of khash implementation (before d78acc7a). ```c mrb_hash_ht_hash_func(mrb_state *mrb, mrb_value key) { enum mrb_vtype t = mrb_type(key); ... switch (t) { ... default: hv = mrb_funcall(mrb, key, "hash", 0); h = (khint_t)t ^ (khint_t)mrb_fixnum(hv); break; } ... } ``` When switched to the segmented list implementation (d78acc7a), this function was changed as follows. ```c sg_hash_func(mrb_state *mrb, seglist *t, mrb_value key) { enum mrb_vtype tt = mrb_type(key); ... switch (tt) { ... default: hv = mrb_funcall(mrb, key, "hash", 0); h = (size_t)t ^ (size_t)mrb_fixnum(hv); break; } ... } ``` Since the argument `t` was added, the variable for type tag was changed from `t` to `tt`, but the variable used in the expression of `h` remained `t`. Probably this is an omission of change, so fixed it.
2020-07-24Change the logic to calculate object (`iv_tbl`) size; #5045Yukihiro "Matz" Matsumoto
2020-07-24Merge pull request #5045 from dearblue/memsize_ofYukihiro "Matz" Matsumoto
Improve `mruby-os-memsize`
2020-07-24Improve prototype for `mrb_objspace_page_slot_size()`; ref #5032dearblue
If it qualify a return type that is not a pointer with `const`, the compiler ignores it.
2020-07-24Avoid using FPU with `mruby-os-memsize`; ref #5032dearblue
And, in the calculation of the instance variable size, the fraction was always rounded down because of division of integers, so fix it. At the same time, test items that are no longer passed due to this change are deleted.
2020-07-23Fix a bug with `ht_index` called with `size==0`; fix #5046Yukihiro "Matz" Matsumoto
It happens when a hash made empty calls `rehash`.
2020-07-22Use more `mrb_field_write_barrier` for instance variables.Yukihiro "Matz" Matsumoto
2020-07-22Use more local variables.Yukihiro "Matz" Matsumoto
To make debugging easy, and to improve the performance little bit.
2020-07-22Move `gray_list` update from `gc_mark_children`.Yukihiro "Matz" Matsumoto
The responsibility moved to caller to avoid confusion. Currently the function is called from only 2 places, so it is relatively easy to ensure not to update `gray_list` in the caller. But the assumption may change in the future.
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-07-22Skip unnecessary `mark_context` if `mrb->c == mrb->root_c`.Yukihiro "Matz" Matsumoto
2020-07-21Fix the VM stack handling bug in 'mrb_yield_with_class()`; fix #5042Yukihiro "Matz" Matsumoto
2020-07-19Use `c` specifier for `mrb_get_args`.Yukihiro "Matz" Matsumoto
2020-07-19Add new specifier `c` to `mrb_get_args`.Yukihiro "Matz" Matsumoto
`C` retrieves a `mrb_value` that refers a class/module. `c` retrieves a `struct RClass*` pointer to a class/module.
2020-07-17Use `proc->env` to check `block_given?` if possible; fix #5039Yukihiro "Matz" Matsumoto
This bug has been there since mruby 1.4.0 (2018-04).