| Age | Commit message (Collapse) | Author |
|
The file headers were pointing to each other's files.
|
|
Fixing keyword arguments with `super`
|
|
This reverts commit d3b7601af96c9e0eeba4c89359289661c755a74a.
|
|
|
|
fix #5627
|
|
Assign after `mrb_irep_incref()` in `mrb_proc_new()`
|
|
Call functions directly from `mrb_ensure_float_type()`
|
|
Adjusting the stack for after it enters the virtual machine
|
|
ref. 28ccc664e5dcd3f9d55173e9afde77c4705a9ab6
|
|
It may cause broken reference count numbers.
|
|
ref. commit 7f40b645d2773c8f50c48ae4adf90488e164da55
Currently, the build configurations `MRB_USE_COMPLEX` and `MRB_USE_RATIONAL` are not listed in the documentation.
In other words, they are hidden settings.
They are defined in `mrbgems/mruby-{complex,rational}/mrbgem.rake`.
So this patch assumes that it is safe to refer to these functions in core-gems directly from core functions.
However, applications that link with `libmruby_core.a` will have compatibility issues.
In fact, `mrbgems/mruby-bin-mrbc` links with `libmruby_core.a`, so I had to prepare a dummy function.
|
|
Remove code duplication.
|
|
Get object properties after `mrb_get_args()`
|
|
Since they are basically duplicated functionality. `mrb_as_float` is now
a macro defined using `mrb_ensure_float_type`; #5620
|
|
|
|
It should only call `to_f` for Rational and Complex numbers.
Ref #5540 #5613 #5620
|
|
That reduce memory consumption by iv/mt tables.
|
|
ref. #5613.
I mentioned in #5540 that there was no reentrant to the virtual machine, but in fact it was still a possibility at that point.
Also, the variable `ci` needs to be recalculated at the same time.
|
|
ref. #5613
I checked with Valgrind, and the methods that can cause use-after-free are `Array#rotate`, `Array#rotate!`, and `String#byteslice`.
Since `String#rindex` uses `RSTRING_LEN()` indirectly inside the function, no reference to the out-of-bounds range is generated.
|
|
|
|
|
|
|
|
Since `mrb_to_integer` and `mrb_to_float` does not convert the object
but checks types, they are named so by historical reason. We introduced
properly named functions.
This commit obsoletes the following functions:
* mrb_to_integer()
* mrb_to_int()
* mrb_to_float()
Use `mrb_ensure_int_type()` instead for the first 2 functions. Use
`mrb_ensure_float_type()` for the last.
|
|
mruby have removed `to_int` implicit conversion, so `mrb_to_integer`
should not call `to_i` for conversion.
|
|
The `ARY_PTR` and `ARY_LEN` may be modified in `mrb_get_args`.
|
|
|
|
|
|
|
|
|
|
Avoid losing the upper digits for mruby binary
|
|
The function may invoke the garbage collection and it requires
`mrb_state` to run.
|
|
- `rlen` keeps 16 bits.
- `ilen` keeps 32 bits.
Note that this change will break mruby binary format compatibility.
|
|
The existence of this member reduces memory and execution time.
|
|
|
|
|
|
|
|
|
|
It used to return wrong value for 14 positional arguments.
|
|
|
|
Now `iv_get()` returns `pos+1` if it finds the entry, so you don't need
to call `iv_put()`. You can replace the entry value by assigning to
`t->ptr[pos-1]`.
|
|
|
|
Instead embed deleted flag in the key (`mrb_sym` only occupies 30bits).
|
|
`iv_size()` is approximated by the allocated table size.
|
|
|
|
|
|
|
|
This is a fundamentally simplified reimplementation of #5317
by @shuujii
Instead of having array of `struct iv_elem`, we have sequences of keys
and values packed in single chunk of malloc'ed memory. We don't have to
worry about gaps from alignment, especially on 64 bit architecture,
where `sizeof(struct iv_elem)` probably consumes 16 bytes, but
`sizeof(mrb_sym)+sizeof(mrb_value)` is 12 bytes.
In addition, this change could improve memory access locality.
close #5317
|
|
|
|
Make "N for M" into the form "given N, expected M".
As I worked, I noticed that the `argnum_error()` function had a part to include the method name in the message.
I think this part is no longer needed by https://github.com/mruby/mruby/pull/5394.
- Before this patch
```console
% bin/mruby -e '[1, 2, 3].each 0'
trace (most recent call last):
[1] -e:1
-e:1:in each: 'each': wrong number of arguments (1 for 0) (ArgumentError)
```
- After this patch
```console
% bin/mruby -e '[1, 2, 3].each 0'
trace (most recent call last):
[1] -e:1
-e:1:in each: wrong number of arguments (given 1, expected 0) (ArgumentError)
```
|
|
The `__id__` method implemented in the C function has `MRB_ARGS_NONE()` specified, but it is also effective in the following cases.
```ruby
p nil.__id__ opts: 1 rescue p :a
p nil.method(:__id__).call 1 rescue p :b
p nil.method(:__id__).call opts: 1 rescue p :c
p nil.method(:__id__).to_proc.call 1 rescue p :d
p nil.method(:__id__).to_proc.call opts: 1 rescue p :e
p nil.method(:__id__).unbind.bind_call nil, 1 rescue p :f
p nil.method(:__id__).unbind.bind_call nil, opts: 1 rescue p :g
p nil.__send__ :__id__, 1 rescue p :h
p nil.__send__ :__id__, opts: 1 rescue p :i
```
After applying this patch, all items will output symbols in the same way as CRuby.
For this purpose, add `MRB_PROC_NOARG` to `struct RProc::flags`.
|