| Age | Commit message (Collapse) | Author |
|
zubycz-work_for_merge
|
|
Co-Authored-By: n4o847 <[email protected]>
Co-Authored-By: smallkirby <[email protected]>
|
|
- 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()`
|
|
As described in ISO 15.2.30.
|
|
* 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.
|
|
|
|
|
|
|
|
C implementation used `mrb_funcall()` that bypassed many optimization.
|
|
Inconsistent when hash has duplicate key.
### Example
```ruby
# example.rb
keys = (1..3).map{[_1]}
h = keys.to_h{[_1, _1[0]]}
keys[0][0] = 2
p h.values
p h.each_value.to_a
p h
```
#### Before this patch:
```console
$ bin/mruby example.rb
[1, 2, 3]
[1, 1, 3]
{[2]=>1, [2]=>1, [3]=>3}
```
#### After this patch (same as Ruby)
```console
$ bin/mruby example.rb
[1, 2, 3]
[1, 2, 3]
{[2]=>1, [2]=>2, [3]=>3}
```
|
|
- Respect `--verbose(-v)` and `--dry-run(-n)` options.
- Silence warnings to keyword arguments on Ruby 2.7.
|
|
Add paragraph mode to String#each_line in mrblib
|
|
|
|
|
|
Avoid calling `initialize` via `mrb_funcall`, which cause `cross C
boundary` error from Fibers started in the method.
|
|
|
|
|
|
|
|
It's an error in ISO specification; 15.3.2.2.4 and 15.3.2.2.7
|
|
|
|
The purpose is to eliminate string objects that are temporarily created during processing.
|
|
|
|
|
|
|
|
Make non-paragraph mode twice as fast. Performance is within a factor of 2
of the original implementation.
|
|
mruby/mruby#4511 demonstrated an infinite loop in `String#each_line` when
given an empty string separator. In MRI, an empty separator places
String#each_line in paragraph mode, where the String is separated on
successive runs of newlines. In paragraph mode, the String
`"abc\n\n\ndef\nxyz"` is split into `["abc\n\n\n", "def\nxyz"]`.
This commit makes the String#each_line implementation as close to
ruby/spec compliant as possible given the limitations of mruby core.
With this patch, the following specs fail for `String#each_line`:
- uses `$/` as the separator when none is given (can be fixed by
aliasing and redefining the method to use $/ as the default value
of separator in mruby-io)
- when no block is given returned Enumerator size should return nil
(`Enumerator#size` is not supported on mruby)
- tries to convert the separator to a string using to_str (`String#to_str`
is not implemented on mruby)
This patch has similar memory consumption compared to the prior
implementation and is takes 4x the time the prior implementation takes to
execute:
```console
/usr/bin/time -l ./bin/mruby -e '("aaa\n\nbbbbb\n\n\n\n\ncccc" * 100000).each_line("\n") { }';
```
|
|
|
|
`String#each_byte` is not defined in ISO Ruby but it is implemented in
the core mruby because it's useful.
|
|
|
|
|
|
|
|
Before this patch:
'a'[0] = 1 #=> 1
'a'[:a] = '1' #=> ArgumentError
'a'[:a, 0] = '1' #=> ArgumentError
'a'[0, :a] = '1' #=> ArgumentError
'a'[0, 1] = 1 #=> 1
After this patch / Ruby:
'a'[0] = 1 #=> TypeError
'a'[:a] = '1' #=> TypeError
'a'[:a, 0] = '1' #=> TypeError
'a'[0, :a] = '1' #=> TypeError
'a'[0, 1] = 1 #=> TypeError
|
|
|
|
|
|
|
|
|
|
|
|
Before:
a=[]; 7.step(4, -3.0) { |c| a << c }; p a #=> [7, 4.0]
After / Ruby:
a=[]; 7.step(4, -3.0) { |c| a << c }; p a #=> [7.0, 4.0]
|
|
- Avoid hack for `MRB_WITHOUT_FLOAT` in build scripts
- Avoid runtime dispatch for `MRB_WITHOUT_FLOAT`
|
|
|
|
|
|
|
|
We have added internal convenience method `__to_str` which
does string type check.
The issue #3854 was fixed but fundamental flaw of lack of stack
depth check along with fibers still remains. Use `MRB_GC_FIXED_ARENA`
for workaround.
|
|
The ISO standard does not include implicit type conversion using
`to_int`. This implicit conversion often causes vulnerability.
There will be no more attacks like #4120.
In addition, we have added internal convenience method `__to_int` which
does type check and conversion (from floats).
|
|
|
|
To reduce the env object allocation; ref #4143
|
|
|
|
|
|
|
|
That means entry table should be compacted periodically by `sg_compact()`.
|