| Age | Commit message (Collapse) | Author |
|
- `mrb_check_intern()` to return `mrb_value`
- `mrb_intern_check()` to return `mrb_sym` [NEW]
Other new functions:
- `mrb_intern_check_cstr()`
- `mrb_intern_check_str()`
|
|
* `mrb_kwargs` structure reordered (`values` and `rest` come last)
* take symbols instead of C `char*`
|
|
Caused from combination of `mrb_int`, `int` and `size_t`..
|
|
They are basically the copy of instance variable tables. On my Linux
box, memory consumption of `mrbtest` measured by `valgrind` is:
- old: 17,683,830 bytes
- new: 14,283,749 bytes
|
|
- 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()`
|
|
They used to return `mrb_value` but now return `mrb_sym` for consistency
with other `intern` functions. If symbols are not defined, `check`
functions return `0`, instead of `nil` in the past.
It causes API incompatibility but I believe few people use those
functions out of the core, and those changes are very easy to handle,
hopefully.
|
|
We still have `#define MRB_TT_FIXNUM MRB_TT_INTEGER` for compatibility.
|
|
* The `Fixnum` constant is now an alias for the `Integer` class.
* Remove `struct mrb_state::fixnum_class` member.
If necessary, use `struct mrb_state::integer_class` instead.
|
|
- `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.
|
|
If this assertion fails, you have to define `MRB_USE_METHOD_T_STRUCT`.
|
|
|
|
Clearing all method cache using `memset` is faster than conditional
clear by method id.
|
|
|
|
Introduced `MRB_NO_METHOD_CACHE` which is inverse of `MRB_METHOD_CACHE`
that should be enabled intestinally. In addition, the default cache is
made bigger (128 -> 256).
|
|
|
|
|
|
- `pool`
- `syms`
- `reps`
|
|
|
|
- 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
|
|
- :
|
|
|
|
- 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 *`.
|
|
|
|
`C` retrieves a `mrb_value` that refers a class/module.
`c` retrieves a `struct RClass*` pointer to a class/module.
|
|
C implementation used `mrb_funcall()` that bypassed many optimization.
|
|
`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.
|
|
When using `mrb_any_to_s()` for debugging purposes, giving an object
whose class is `NULL` no longer causes a SIGSEGV and no crash.
This is achieved by making `mrb_class_name()` and `mrb_str_cat_cstr()`
null safe.
|
|
The difference between `mrb_singleton_class` and `mrb_singleton_class_ptr`:
- `mrb_singleton_class_ptr` returns `struct RClass*`.
- `mrb_singleton_class_ptr` returns `NULL` on immediate values where
`mrb_singleton_class` raises exceptions.
|
|
|
|
This bug was introduced in 694089f to address #4832
|
|
The behavior when returning from a function without `va_end()` is
undefined.
|
|
The behavior of these two variables is the same.
|
|
#### Example (with `MRB_METHOD_CACHE`)
```ruby
GC.start
c = Class.new
p c #=> #<Class:0x7fd6a180e790>
c.new #=> cache `c.new`
c = nil
GC.start #=> `c` is GCed
r = Range.dup
p r #=> #<Class:0x7fd6a180e790>
# [same pointer as `c`]
r.new(2, 3) #=> ArgumentError: 'initialize':
# wrong number of arguments (2 for 0)
# [`c.new` is called instead of `r.new`]
```
#### Cause
An entry of method cache is identified by class pointer and method
id. However, reusing memory after GC may create a class with the same
pointer as the cached class.
#### Treatment
Cleared method caches of the class when the class is GCed.
|
|
The `#prepend_features` and `#module_function` methods are not haves for
class objects.
|
|
|
|
If ":" is after "|" and there is no "?" or "*", the keyword argument
could not be obtained and it was not initialized with `undef`.
For example: "|oo:"
|
|
This feature was reverted from Ruby 2.7.
|
|
|
|
|
|
- Use `mrb_sym_name_len` instead of `mrb_sym_name` (class name should not
be escaped).
- Avoid `mrb_str_dup` (it is unnecessary to be shared string because it is
changed).
|
|
|
|
Keyword arguments can now be retrieved with the `:` specifier and
`mrb_kwargs` data.
For the interface, I referred to CRuby's `rb_get_kwargs()`.
For implementation, I referred to `OP_KARG` or etc.
|
|
|
|
For efficiency with `MRB_WORD_BOXING` (implement type predicate macros for
all `enum mrb_vtype`).
|
|
* mrb_sym2name -> mrb_sym_name
* mrb_sym2name_len -> mrb_sym_name_len
* mrb_sym2str -> mrb_sym_str
|
|
We needed to preserve the original method name somewhere. We kept it in
the `env` structure pointed from aliased methods. #1457 and #1531 tried
to address this issue. But this patch is more memory efficient.
Limitation: this fix does not support `super` from methods defined by
`define_method`. This limitation may be addressed in the future, but
it's low priority.
|
|
As a side effect, all specifiers now accept the `!` modifier.
|
|
In terms of specifiers, argv is never referenced after a method call as
shown in #3090.
Reduction of object code can be expected.
If you need to refer to argv after a method call in the same loop,
update argv after the method call.
|
|
This is partial `aspec` check that only checks `MRB_ARGS_NONE()`.
|
|
|