Commit Graph

13512 Commits

Author SHA1 Message Date
mimaki 7d3bc5c3d7 Update version to 3.1.0RC2. 3.1.0-rc2 2022-03-31 15:17:17 +09:00
Yukihiro "Matz" Matsumoto f71d389649 codegen.c: fix the negative division regression; fix #5678 2022-03-31 13:05:06 +09:00
Yukihiro "Matz" Matsumoto eaadc5e79f parse.y: empty here-doc delimiter caused infinite loop; fix #5676 2022-03-31 13:01:27 +09:00
Yukihiro "Matz" Matsumoto c627e3b2ab codegen.c: fix a bug in super with keyword arguments; fix #5660 2022-03-31 13:00:34 +09:00
Yukihiro "Matz" Matsumoto 9424e4d4cf parse.y: revert 9e064f2; fix #5647
Need to declare unnamed parameter when argument decomposition used.
2022-03-31 12:59:44 +09:00
Yukihiro "Matz" Matsumoto 64d3f4c730 vm.c: need to adjust argument after packing keyword args; fix #5632
It was caused by #5628.
2022-03-31 12:58:48 +09:00
mimaki 6f2efebbb9 Merge commit '7e7f1b2' into stable 3.1.0-rc 2022-01-17 21:36:52 +09:00
Yukihiro "Matz" Matsumoto 7e7f1b2f1d parse.y: numbered parameters should not appear on toplevel.
Toplevel includes the top of the method/class/module definitions.
2022-01-11 14:52:05 +09:00
Yukihiro "Matz" Matsumoto 3a30cc27da parse.y: move numbered parameter indexing to lexer. 2022-01-11 14:49:41 +09:00
Yukihiro "Matz" Matsumoto 5dfbfb3ecd parse.y: p->nvar (numbered argument index list) may be NULL. 2022-01-10 15:44:15 +09:00
Yukihiro "Matz" Matsumoto 8c7b995962 AUTHORS: update entries [ci skip] 2022-01-10 12:33:01 +09:00
Yukihiro "Matz" Matsumoto 69b1667b5b Merge pull request #5630 from dearblue/dumps
Fixes file header in src/{cdump,dump}.c [ci skip]
2022-01-09 21:46:40 +09:00
dearblue 178daf1a75 Fixes file header in src/{cdump,dump}.c [ci skip]
The file headers were pointing to each other's files.
2022-01-09 16:30:06 +09:00
mimaki f29924c838 Update version to 3.1.0RC. 2022-01-07 14:15:50 +09:00
Yukihiro "Matz" Matsumoto 696589cf27 Merge pull request #5628 from dearblue/super-kwargs
Fixing keyword arguments with `super`
2022-01-06 10:05:05 +09:00
Yukihiro "Matz" Matsumoto b1fc0dd5a4 Merge pull request #5629 from dearblue/nanbox
Allows handling of unaligned cptrs for `MRB_NAN_BOXING`
2022-01-06 10:02:49 +09:00
Yukihiro "Matz" Matsumoto dfa21f2e58 class.c: cancel #5620 which is no longer needed since #5622
This reverts commit d3b7601af9.
2022-01-05 19:40:55 +09:00
Yukihiro "Matz" Matsumoto aaa3bd0e80 mrbc.c: simplify place holder functions; #5622 2022-01-05 19:39:39 +09:00
Yukihiro "Matz" Matsumoto c088af87b8 object.c: Call functions directly from mrb_ensure_int_type(); #5622 2022-01-05 19:00:14 +09:00
dearblue 88b1654725 Allows handling of unaligned cptrs for MRB_NAN_BOXING
It seems to be preferable to be able to handle pointers of type `char` as well.
For this purpose, `mrb_nanbox_tt_inline` has been reorganized.

- `MRB_NANBOX_TT_POINTER` has been split into `MRB_NANBOX_TT_OBJECT` and `MRB_NANBOX_TT_CPTR`
- `MRB_NANBOX_TT_SYMBOL` has been merged into `MRB_NANBOX_TT_MISC`
2022-01-05 17:23:35 +09:00
dearblue 55b2e45a26 Fixing keyword arguments with super
fix #5627
2022-01-05 16:40:13 +09:00
Yukihiro "Matz" Matsumoto d34e1cb84c Merge pull request #5623 from dearblue/more-presym
Improves presym scanning
2022-01-04 11:54:09 +09:00
Yukihiro "Matz" Matsumoto 6c68b516ff Merge pull request #5624 from dearblue/powerof2
Assert that `MRB_METHOD_CACHE_SIZE` is a power of 2
2022-01-04 11:51:00 +09:00
Yukihiro "Matz" Matsumoto 5c75dc9edc Merge pull request #5625 from dearblue/proc_new
Assign after `mrb_irep_incref()` in `mrb_proc_new()`
2022-01-03 08:54:01 +09:00
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
dearblue bee9665400 Assign after mrb_irep_incref() in mrb_proc_new()
ref. 28ccc664e5
2022-01-02 16:43:43 +09:00
dearblue 82a1b00eb6 Assert that MRB_METHOD_CACHE_SIZE is a power of 2
The `mrb_static_assert_powerof2()` macro has been introduced for this purpose.
2022-01-02 14:59:55 +09:00
dearblue f2d19aaaac Improves presym scanning
The main purpose is to increase the chances of finding presym and to prevent errors due to C++11 lambda expressions.

- The argument to receive the class may be written, for example, `mrb_class_get()`.
- The argument that receives the implementation function of the method may be a C++ lambda expression.
  In this case, if multiple variable declarations are separated by colons, the preprocessor will recognize them as argument delimiters and report an error.
  This patch prevents it from happening.

  ```c++
  // When preprocessing...
  func([] { int x, y, z; })
    // ^^^^^^^^^^          1st argument?
    //             ^       2nd argument?
    //                ^^^^ 3rd argument?
  ```
2022-01-02 11:52:19 +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