summaryrefslogtreecommitdiffhomepage
path: root/src
AgeCommit message (Collapse)Author
2020-10-12Fix `dump.c` for `MRB_INT32` env.Yukihiro "Matz" Matsumoto
2020-10-12Enable NUL (`\0`) again.Yukihiro "Matz" Matsumoto
2020-10-12Generate C struct from `irep` instead of binary dump.Yukihiro "Matz" Matsumoto
2020-10-12Generate C source file to represent `mrb_irep` structures.Yukihiro "Matz" Matsumoto
Type `mrbc -S -B<init> -o<outfile> <rbfiles...>` to generate the C source code that holds compiled `mrb_irep`. Appending the following code to the bottom of the generated code, `mruby` executes the compiled code: ```C int main() { mrb_state *mrb = mrb_open(); struct RProc *p = mrb_proc_new(mrb, &init_irep); mrb_vm_run(mrb, p, mrb_top_self(mrb), 0); mrb_close(mrb); return 0; } ``` Eventually static compile should use this representation, instead of `uint8_t` array that holds `mrb` data, so that we can skip interpreting `mrb` data.
2020-10-12Removed alignment pragma from `-B` output from `mrbc`.Yukihiro "Matz" Matsumoto
We no longer need 4 bytes alignment after we moved to the byte oriented instructions.
2020-10-12Replace entire `irep->pool`.Yukihiro "Matz" Matsumoto
Changes: - `pool format is completely replaced - supported types: `STR`, `INT32`, `INT64`, `FLOAT` - `FLOAT` may be replaced by binary representation in the future - insert `NUL` after string literals in `mrb` files - `irep->pool` no longer store values in `mrb_value` - instead it stores in `mrb_pool_value` - less allocation - `mrb_irep` can be stored in ROM
2020-10-12Rename `struct mrb_locals` to `struct mrb_lvinfo`.Yukihiro "Matz" Matsumoto
That stands for "local variable information".
2020-10-12Add `irep` C struct dump from `mrbc` with `-S` option.Yukihiro "Matz" Matsumoto
But we need more work: - recursive `irep` dump (`irep->reps`) - pool values dump (`irep->pool`)
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-12Make `call_irep` static.Yukihiro "Matz" Matsumoto
2020-10-12Use `static const struct mrb_irep each_irep` to ininitalize `each`.Yukihiro "Matz" Matsumoto
2020-10-12Stringify non C identifier symbols to stop macro errors by old gcc.Yukihiro "Matz" Matsumoto
2020-10-12Constify `irep` members.Yukihiro "Matz" Matsumoto
- `pool` - `syms` - `reps`
2020-10-12Change the arguments of following implicit conversion functions:Yukihiro "Matz" Matsumoto
- `mrb_convert_type` - `mrb_check_convert_type` Those function no longer take `tname` string representation of desired type, and take method symbols instead of `const char*` names. This is incompatible change. I hope no third-party gems use those functions.
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