| Age | Commit message (Collapse) | Author |
|
|
|
Partially allow overriding of `String#[]` methods
|
|
|
|
This is for the purpose of supporting `Regexp`.
- configuration and build
```console
% cat regexp_config.rb
MRuby::Lockfile.disable
MRuby::Build.new do
toolchain "clang"
enable_debug
gem core: "mruby-bin-mruby"
gem core: "mruby-print"
gem mgem: "mruby-onig-regexp"
#gem mgem: "mruby-regexp-pcre"
end
% rake MRUBY_CONFIG=regexp_config.rb
```
- mruby HEAD (bec074e)
```console
% build/host/bin/mruby -e 'p "abcdefg"[/.(?=...$)/]'
-e:1: can't convert OnigRegexp into Integer (TypeError)
```
- with this patch
```console
% build/host/bin/mruby -e 'p "abcdefg"[/.(?=...$)/]'
"d"
```
|
|
Existing call stack depth checks are unified into this check in
`cipush()`. The maximum depth is now specified by `MRB_CALL_LEVEL_MAX`
(the default is 512). The older `MRB_FUNCALL_DEPTH_MAX` is no longer
used.
|
|
The bug was introduced in 8be78bd.
|
|
Which represent `obj[int]` and `obj[int]=val` respectively where `obj`
is either `string`, `array` or `hash`, so that index access could be
faster. When `obj` is not assumed type or `R(a+1)` is not integer, the
instructions fallback to method calls.
|
|
|
|
It used to be compiled to the static string in the compiler. But the
encoding status actually depends on the runtime configuration. A new
method `Kernel#__ENCODING__` is introduced to implement the feature.
|
|
Rename `MRB_WORDBOX_USE_HEAP_FLOAT` to `MRB_WORDBOX_NO_FLOAT_TRUNCATE'.
|
|
This reverts commit 913a0a5a036664ab0d12a1af40b652412301c89f.
In some cases, `OP_HASHADD` operand may not be `Hash`. We should check
explicitly in those cases.
|
|
The invocation of `initialize` hook can cause infinite recursion too
easily. We stop invoking the method for safety, at the cost of less
flexibility.
The `initialize` methods (e.g. ones defined in `mrblib/10error.rb`) are
called only from `NoMethodError.new(args..)` forms.
|
|
|
|
|
|
|
|
|
|
- `OP_ARYPUSH` now takes operand for the number of pushing elements
- the code generator consume the stack no more than `64` for `mruby/c`
|
|
Add n elements at once. Reduces instructions for huge array
initialization. In addition, `gen_value` function in `codegen.c` was
refactored and clarified.
|
|
|
|
|
|
|
|
`acc` was used as an index of the receiver (if positive), or a flag for
methods implemented in C. We replace `regs[ci->acc]` by `ci[1].stack[0]`.
And renamed `acc` (originally meant accumulator position) to `cci`
(means callinfo for C implemented method).
|
|
The pool specified by `OP_STRING` (and `OP_SYMBOL`) should represent a
string, so that `IREP_TT_NFLAG` should be zero.
|
|
It generates a symbol by interning from the pool string.
|
|
|
|
|
|
|
|
`mrb_ro_data_p()` is available anyway.
|
|
|
|
Consistent naming: `integer` to represent integer packed in `mrb_value`
instead of `int`.
|
|
Consistent naming: `integer` to represent integer packed in `mrb_value`
instead of `inum`.
|
|
|
|
|
|
Otherwise `target_class` can be lost when it differs from `proc`'s
`target_class`, e.g. when called from `instance_eval`.
Also we should not pass `target_class` to `MRB_OBJ_ALLOC` since it
checks instance type from the class, and `target_class` may not have
proper information. ref #5272
|
|
|
|
|
|
|
|
|
|
To reduce number of string allocation.
|
|
Replace them by `mrb_ensure_string_type()`.
|
|
And merged to `mrb_f_integer()` which is only usage of the function.
|
|
They return the checking argument without modification, so the values
are already there. Maybe we should change the return type to `void` but
keep them unchanged for compatibility.
|
|
|
|
Allow `nil` for `c!` and `I!` specifiers of `mrb_get_args()`
|
|
|
|
It is `o`, `C`, `S`, `A` and `H` specifiers that are integrated.
As a side effect, the `C!` Specifier can now be used.
|
|
- Removed the `ARGV` macro.
The current path doesn't go into the mruby VM and there's also no need to separate variables.
- Use common functions to check object types.
- Use `mrb_ensure_string_type()` to check the string instead of `mrb_to_str()`.
This is for consistency with array and hash.
- Use `mrb_ensure_array_type()` to check the array instead of `to_ary()`.
- Use `mrb_ensure_hash_type()` to check the hash instead of `to_hash()`.
- Add and use `ensure_class_type()` to check class and module.
- Changed the argument index type from `mrb_int` to `int`.
Even if it is `int16_t`, it is enough.
`mrb_int` is overkill, especially if `MRB_32BIT` and `MRB_INT64` are defined.
|
|
|
|
`MRB_WORDBOX_USE_HEAP_FLOAT` instead of `MRB_USE_FLOAT_FULL_PRECISION`.
|
|
* use predefined `mrb_ro_data_p()` for user-mode Linux and macOS
* define `MRB_LINK_TIME_RO_DATA_P` if predefined one is used
* configure macro `MRB_USE_LINK_TIME_RO_DATA_P` is no longer used
* contributions for new platforms are welcome
|