| Age | Commit message (Collapse) | Author |
|
|
|
|
|
|
|
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.
|
|
We no longer need 4 bytes alignment after we moved to the byte oriented
instructions.
|
|
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
|
|
That stands for "local variable information".
|
|
But we need more work:
- recursive `irep` dump (`irep->reps`)
- pool values dump (`irep->pool`)
|
|
Since it's not supported on VC without `/std:c++latest`. That means it
doesn't work for `cxx_api` build on Windows VC.
|
|
|
|
|
|
|
|
- `pool`
- `syms`
- `reps`
|
|
- `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.
|
|
|
|
- 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
|
|
- :
|
|
Except for support files e.g. `mruby-test/driver.c`, which are not
target of symbol collection via `rake gensym`.
|
|
`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.
|
|
|
|
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
|
|
|
|
For example, `MRB_OPSYM(add)` refers a symbol for `+`.
|
|
|
|
|
|
|
|
|
|
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]>
|
|
- 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 *`.
|
|
since mrb_str_to_str() also does it.
|
|
|
|
Reported by @shuujii.
|
|
Should have handled the case `to_a` returns `nil`.
|
|
|
|
|
|
|
|
|
|
|
|
Note that the home brew version of `mrb_static_assert` only works within
the function body. This reverts commit 8f99689.
|
|
|
|
|
|
|
|
|
|
|
|
Extend the `cipush()` and `cipop()` functions
|
|
|
|
- Returns the updated call info.
- Unify the processing around `cipush()`.
- `cipop()` restores the stack.
|
|
Use type tag for hash code in `ht_hash_func()`
|
|
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.
|
|
|