Yukihiro "Matz" Matsumoto
4e0b162253
Merge pull request #5622 from dearblue/to_f
...
Call functions directly from `mrb_ensure_float_type()`
2022-01-02 18:04:18 +09:00
Yukihiro "Matz" Matsumoto
ab4baba283
Merge pull request #5620 from dearblue/adjust-stacks
...
Adjusting the stack for after it enters the virtual machine
2022-01-02 18:01:53 +09:00
Yukihiro "Matz" Matsumoto
28ccc664e5
proc.c: should not reference irep when copying failed.
...
It may cause broken reference count numbers.
2022-01-01 21:02:58 +09:00
dearblue
ac22a63ae3
Call functions directly from mrb_ensure_float_type()
...
ref. commit 7f40b645d2
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.
2021-12-31 19:12:11 +09:00
Yukihiro "Matz" Matsumoto
3de9ddfb39
vm.c: use prepare_missing in mrb_funcall_with_block
...
Remove code duplication.
2021-12-31 18:15:41 +09:00
Yukihiro "Matz" Matsumoto
5ca17c2dce
Merge pull request #5621 from dearblue/ci-cygwin
...
Extend the Cygwin CI time limit to 15 minutes.
2021-12-31 16:32:33 +09:00
Yukihiro "Matz" Matsumoto
9fc26eacd1
Merge pull request #5619 from dearblue/properties
...
Get object properties after `mrb_get_args()`
2021-12-31 15:28:11 +09:00
Yukihiro "Matz" Matsumoto
b9e1b9b328
numeric.c: merge mrb_as_float implementation to mrb_ensure_float_type.
...
Since they are basically duplicated functionality. `mrb_as_float` is now
a macro defined using `mrb_ensure_float_type`; #5620
2021-12-31 15:14:37 +09:00
Yukihiro "Matz" Matsumoto
566a8d3fcb
object.c: add conversion to Float from Rational, Complex; #5620
2021-12-31 15:13:04 +09:00
Yukihiro "Matz" Matsumoto
7f40b645d2
numeric.c: mrb_as_float should not call to_f for generic objects.
...
It should only call `to_f` for Rational and Complex numbers.
Ref #5540 #5613 #5620
2021-12-31 10:54:28 +09:00
Yukihiro "Matz" Matsumoto
eea418bcce
class.c, variable,c: replace size_t by int.
...
That reduce memory consumption by iv/mt tables.
2021-12-31 10:54:28 +09:00
dearblue
4c8a8818ec
Extend the Cygwin CI time limit to 15 minutes.
...
The main reason for failure is to exceed the time limit, and even when it succeeds, there is less than a minute left.
The 10-minute time limit seems to be too short.
2021-12-30 22:58:41 +09:00
dearblue
d3b7601af9
Adjusting the stack for after it enters the virtual machine
...
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.
2021-12-30 22:45:19 +09:00
dearblue
a137ef12f9
Get object properties after mrb_get_args()
...
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.
2021-12-30 22:34:22 +09:00
Yukihiro "Matz" Matsumoto
77f4a8b669
object.c: move string to float conversion to mrb_f_float.
2021-12-29 16:58:05 +09:00
Yukihiro "Matz" Matsumoto
66a099b1b3
string.c: reorganize str_convert_range using mrb_ensure_int_type
2021-12-29 16:44:35 +09:00
Yukihiro "Matz" Matsumoto
b6d31810fe
string.c: use mrb_as_int macro.
2021-12-29 16:39:56 +09:00
Yukihiro "Matz" Matsumoto
4f297ac29c
object.c: introduce mrb_ensure_{int,float}_type.
...
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.
2021-12-29 16:39:29 +09:00
Yukihiro "Matz" Matsumoto
b6283978c5
object.c: avoid implicit to_i and to_f calls.
...
mruby have removed `to_int` implicit conversion, so `mrb_to_integer`
should not call `to_i` for conversion.
2021-12-29 16:21:29 +09:00
Yukihiro "Matz" Matsumoto
41e8b210b8
common.h: include <sys/types.h> for ssize_t; #5617
2021-12-29 15:57:45 +09:00
Yukihiro "Matz" Matsumoto
27d1e0132a
array.c: fix mrb_ary_shift_m initialization bug.
...
The `ARY_PTR` and `ARY_LEN` may be modified in `mrb_get_args`.
2021-12-29 15:50:28 +09:00
Yukihiro "Matz" Matsumoto
83f2e75d17
Merge pull request #5616 from mimaki/refine-ssize_t-on-msvc
...
Fix build error and refine definition of `ssize_t` on MSVC.
2021-12-29 12:58:43 +09:00
mimaki
1f3a385ec5
Fix build error and refine definition of ssize_t on MSVC.
2021-12-28 17:18:59 +09:00
Yukihiro "Matz" Matsumoto
6f5c211c78
Merge pull request #5614 from jbampton/patch-1
...
Fix word casing in the README
2021-12-28 16:19:52 +09:00
Yukihiro "Matz" Matsumoto
8933a6fcbf
Merge pull request #5615 from jbampton/pre-commit-autoupdate
...
pre-commit autoupdate
2021-12-28 16:19:14 +09:00
John Bampton
69affd6983
pre-commit autoupdate
...
https://pre-commit.com/#pre-commit-autoupdate
2021-12-28 10:28:14 +10:00
John Bampton
c997229ecf
Fix word casing in the README
...
Changed `Actual` to `actual` mid sentence
2021-12-28 10:22:20 +10:00
Yukihiro "Matz" Matsumoto
6de0fcbda2
class.c: remove mt_elem structure to avoid alignment gaps.
2021-12-27 11:15:34 +09:00
Yukihiro "Matz" Matsumoto
a388d609ae
variable.c: need to initialize size of iv table.
2021-12-27 10:55:17 +09:00
Yukihiro "Matz" Matsumoto
27e57aad0b
parse.y: prohibit numbered parameters as arguments; fix #5605
2021-12-27 10:55:17 +09:00
Yukihiro "Matz" Matsumoto
e6b6413932
Merge pull request #5612 from dearblue/compar-ext
...
Fix summary typo for `mrbgems/mruby-compar-ext`
2021-12-26 08:13:23 +09:00
dearblue
65195cd784
Fix summary typo for mrbgems/mruby-compar-ext
2021-12-25 20:46:25 +09:00
Yukihiro "Matz" Matsumoto
39191cd9fa
parse.y: allow arguments start with _ to appear multiple times; fix #5604
2021-12-24 07:41:37 +09:00
Yukihiro "Matz" Matsumoto
3b59c95ead
pack.c: check integer overflow in unpacking BER; fix #5611
2021-12-23 07:57:58 +09:00
Yukihiro "Matz" Matsumoto
42a6872c2b
parse.y: adjust void_expr_error(); fix #5606
...
Allow void expression on some places e.g. right hand of `rescue`
modifier. In addition, checks added on some places, e.g. left hand of
logical operators.
2021-12-22 14:08:04 +09:00
Yukihiro "Matz" Matsumoto
4e8d376417
Merge pull request #5610 from mruby/dependabot/github_actions/github/super-linter-4.8.5
...
build(deps): bump github/super-linter from 4.8.4 to 4.8.5
2021-12-21 23:13:43 +09:00
dependabot[bot]
916fbcce2c
build(deps): bump github/super-linter from 4.8.4 to 4.8.5
...
Bumps [github/super-linter](https://github.com/github/super-linter ) from 4.8.4 to 4.8.5.
- [Release notes](https://github.com/github/super-linter/releases )
- [Changelog](https://github.com/github/super-linter/blob/main/docs/release-process.md )
- [Commits](https://github.com/github/super-linter/compare/v4.8.4...v4.8.5 )
---
updated-dependencies:
- dependency-name: github/super-linter
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com >
2021-12-21 14:11:38 +00:00
Yukihiro "Matz" Matsumoto
8a5f18a1d8
codegen.c: generate OP_SETIDX; close #5608
...
Note that the current implantation only calls `[]=` method. No
performance improvement. Just 2 bytes less byte code per assignment.
2021-12-20 17:46:57 +09:00
Yukihiro "Matz" Matsumoto
a42b676ae9
vm.c: fix a half-baked implementation of OP_SETIDX; ref #5608
2021-12-20 17:45:10 +09:00
Yukihiro "Matz" Matsumoto
5774a7a38b
codedump.c: adjust the position of local variable labels.
2021-12-20 17:44:31 +09:00
Yukihiro "Matz" Matsumoto
a17955259e
Merge pull request #5602 from dearblue/no-ext-ops
...
Add `bin/mrbc --no-ext-ops` switch
2021-12-19 19:11:51 +09:00
Yukihiro "Matz" Matsumoto
d7812bd3d6
Merge pull request #5603 from dearblue/codegen_error
...
Print error before cleanup in `codegen_error()`
2021-12-18 19:42:31 +09:00
dearblue
26338fe640
Print error before cleanup in codegen_error()
...
Previously, it always pointed to the highest scope as the location of the error.
- example code `code.rb`
```ruby
huge_num = "1" + "0" * 300; eval <<CODE, nil, "test.rb", 1
class Object
module A
#{huge_num}
end
end
CODE
```
- Before this patch
```console
% bin/mruby code.rb
test.rb:1: integer too big
trace (most recent call last):
[1] code.rb:1
code.rb:1:in eval: codegen error (ScriptError)
```
- After this patch
```console
% bin/mruby code.rb
test.rb:3: integer too big
trace (most recent call last):
[1] code.rb:1
code.rb:1:in eval: codegen error (ScriptError)
```
2021-12-17 23:03:27 +09:00
dearblue
6b8582c95d
Add bin/mrbc --no-ext-ops switch
...
Print an error if `OP_EXT[123]` is needed when generating mruby binary.
This may be useful for mruby/c.
Inspired by #5590 .
2021-12-17 23:02:04 +09:00
Yukihiro "Matz" Matsumoto
9b65d0dc86
Merge pull request #5601 from mruby/dependabot/github_actions/actions/upload-artifact-2.3.1
...
build(deps): bump actions/upload-artifact from 2.2.4 to 2.3.1
2021-12-17 07:49:53 +09:00
dependabot[bot]
a7aa0b1da2
build(deps): bump actions/upload-artifact from 2.2.4 to 2.3.1
...
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact ) from 2.2.4 to 2.3.1.
- [Release notes](https://github.com/actions/upload-artifact/releases )
- [Commits](https://github.com/actions/upload-artifact/compare/v2.2.4...v2.3.1 )
---
updated-dependencies:
- dependency-name: actions/upload-artifact
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com >
2021-12-16 14:08:05 +00:00
Yukihiro "Matz" Matsumoto
57d93c4d76
string-ext.c: fix memory leak in tr_parse_pattern.
2021-12-16 11:39:35 +09:00
Yukihiro "Matz" Matsumoto
0fbdd71dcf
boxing_nan.h: remove false description in the comment [ci skip]
...
Ref #5597
2021-12-15 23:07:34 +09:00
Yukihiro "Matz" Matsumoto
a3d240c2ed
Merge pull request #5599 from dearblue/loss-digits
...
Avoid losing the upper digits for mruby binary
2021-12-15 23:07:13 +09:00
Yukihiro "Matz" Matsumoto
f5e10c5a79
proc.c: add mrb_state argument to mrb_proc_copy().
...
The function may invoke the garbage collection and it requires
`mrb_state` to run.
2021-12-14 13:35:18 +09:00