Commit Graph

13374 Commits

Author SHA1 Message Date
Yukihiro "Matz" Matsumoto a0b58eed46 doc/internal/boxing.md: describe how mrb_value represents values. 2021-11-14 17:45:21 +09:00
Yukihiro "Matz" Matsumoto 1fe722cd78 boxing_word.h: fix the error in the comment [ci skip] 2021-11-13 20:59:54 +09:00
Yukihiro "Matz" Matsumoto 4e3df65d6f test/syntax.rb: test argument forwarding without parentheses. 2021-11-12 15:02:49 +09:00
Yukihiro "Matz" Matsumoto 7c1878669a parse.y: should allow newline after .... 2021-11-12 15:02:04 +09:00
Yukihiro "Matz" Matsumoto 885a87e408 parse.y: allow ... in formal arguments without parentheses. 2021-11-10 22:25:02 +09:00
Yukihiro "Matz" Matsumoto 2e0c1b4361 etc.c: improve mrb_obj_id with NaN boxing and Word boxing. 2021-11-09 17:24:53 +09:00
Yukihiro "Matz" Matsumoto a5567fbad4 boxing_nan.h: update mrb_immediate_p and related macros. 2021-11-08 14:33:50 +09:00
Yukihiro "Matz" Matsumoto 5dc91029d1 TODO.md: update. 2021-11-08 14:33:50 +09:00
Yukihiro "Matz" Matsumoto 5c8e184fcf Merge pull request #5437 from dearblue/parse.y
Run the task only once when `parse.y` is updated
2021-11-06 19:58:28 +09:00
Yukihiro "Matz" Matsumoto c3a1456cc8 mruby3.1.md: update. 2021-11-06 18:18:38 +09:00
Yukihiro "Matz" Matsumoto 879f074cd0 mruby3.1.md: update new methods description. 2021-11-05 15:08:44 +09:00
Yukihiro "Matz" Matsumoto d6f6467ad7 boxing_nan.h (mrb_float_p): wrap macro argument by parenthesis. 2021-11-04 20:49:19 +09:00
Yukihiro "Matz" Matsumoto c21a094a7f hash.c: avoid mrb_obj_id to get the hash value if possible. 2021-11-04 15:54:31 +09:00
Yukihiro "Matz" Matsumoto 877e82eb92 Merge pull request #5570 from dearblue/random-bytes
Added `Random.#bytes` method
2021-11-04 15:54:22 +09:00
Yukihiro "Matz" Matsumoto 8f67a0d0e1 Merge pull request #5569 from dearblue/array-product
Added `Array#product` method
2021-11-04 15:54:09 +09:00
Yukihiro "Matz" Matsumoto b940ed69d9 Merge pull request #5571 from mruby/dependabot/github_actions/actions/checkout-2.4.0
build(deps): bump actions/checkout from 2.3.5 to 2.4.0
2021-11-04 07:48:14 +09:00
dependabot[bot] b8b5d4094f build(deps): bump actions/checkout from 2.3.5 to 2.4.0
Bumps [actions/checkout](https://github.com/actions/checkout) from 2.3.5 to 2.4.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2.3.5...v2.4.0)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-03 14:06:38 +00:00
Yukihiro "Matz" Matsumoto 36efd018e2 Merge pull request #5565 from dearblue/class.new
Improved `Class#new` method
2021-11-03 19:38:11 +09:00
Yukihiro "Matz" Matsumoto 59b7846ab0 Merge pull request #5568 from dearblue/nan+cxx_abi
Fix failed build with `MRB_NAN_BOXING` and `enable_cxx_abi`
2021-11-01 13:54:15 +09:00
Yukihiro "Matz" Matsumoto a0dd466840 object.c: fast implementation of mrb_obj_eq.
For `MRB_NAN_BOXING` and `MRB_WORD_BOXING`.
2021-11-01 13:35:10 +09:00
dearblue 7bb4a57e56 Added Random.#bytes method
ref: https://docs.ruby-lang.org/ja/3.0.0/method/Random/i/bytes.html
2021-10-31 23:36:10 +09:00
dearblue 5ea26260fa Added Array#product method
Ruby-1.9.0 feature.

ref: https://docs.ruby-lang.org/ja/3.0.0/method/Array/i/product.html
2021-10-31 23:02:37 +09:00
dearblue 1de662cb8b Fix failed build with MRB_NAN_BOXING and enable_cxx_abi
```console
% c++ -xc++ -std=c++03 -S -Iinclude -DMRB_NAN_BOXING -DMRB_NO_PRESYM -o- src/array.c > /dev/null
In file included from src/array.c:7:
In file included from include/mruby.h:115:
In file included from include/mruby/value.h:201:
include/mruby/boxing_nan.h:95:12: error: cannot initialize return object of type 'enum mrb_vtype' with an rvalue of type 'int'
    return (enum mrb_vtype)(o.u >> 8) & 0x1f;
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
```
2021-10-31 22:17:15 +09:00
Yukihiro "Matz" Matsumoto d8204d51af Merge pull request #5566 from dearblue/no_float_truncate
Avoid redefining `MRB_WORDBOX_NO_FLOAT_TRUNCATE`
2021-10-31 17:29:20 +09:00
Yukihiro "Matz" Matsumoto f0b0f9d69d Merge pull request #5567 from dearblue/mrb_static_assert.1
Avoid violations of the `mrb_static_assert()` standard
2021-10-30 17:46:40 +09:00
Yukihiro "Matz" Matsumoto 9f0410789d boxing_nan.h: allow MRB_INT64 with MRB_NAN_BOXING.
Integers out of 32 bit range will be allocated in the heap.
2021-10-30 17:44:46 +09:00
Yukihiro "Matz" Matsumoto 85fcd2dc6f boxing_nan.h: implement Favor pointer NaN Boxing.
Favor pointer means encode NaN boxed values to keep pointer values
unmodified, to reduce the cost of far frequent pointer value retrievals.
2021-10-30 17:43:35 +09:00
dearblue 61ee857178 Avoid violations of the mrb_static_assert() standard
ref: #5564

```console
% cc -pedantic -S -Iinclude -DMRB_NO_PRESYM -o- src/array.c > /dev/null
In file included from src/array.c:7:
In file included from include/mruby.h:115:
In file included from include/mruby/value.h:204:
include/mruby/boxing_word.h:133:1: warning: must specify at least one argument for '...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]
mrb_static_assert(sizeof(mrb_value) == sizeof(union mrb_value_));
^
include/mruby.h:109:108: note: expanded from macro 'mrb_static_assert'
    mrb_static_assert_expand(mrb_static_assert_selector(__VA_ARGS__, mrb_static_assert2, mrb_static_assert1)(__VA_ARGS__))
                                                                                                           ^
include/mruby.h:100:10: note: macro 'mrb_static_assert_selector' defined here
# define mrb_static_assert_selector(a, b, name, ...) name
         ^
1 warning generated.
```
2021-10-30 13:22:35 +09:00
dearblue fa8bd00b57 Avoid redefining MRB_WORDBOX_NO_FLOAT_TRUNCATE
Adding `MRB_WORDBOX_NO_FLOAT_TRUNCATE` to the build configuration in 32-bit CPU mode had a double definition.

```console
% cat myconf.rb
MRuby::Build.new do
  toolchain "clang"
  defines << "MRB_WORDBOX_NO_FLOAT_TRUNCATE"
  cc.flags << "-m32"
  linker.flags << "-m32"
  enable_debug
end

% rake CONFIG=myconf.rb
CPP   src/array.c -> build/host/src/array.pi
In file included from /var/tmp/mruby/src/array.c:7:
In file included from /var/tmp/mruby/include/mruby.h:115:
In file included from /var/tmp/mruby/include/mruby/value.h:203:
/var/tmp/mruby/include/mruby/boxing_word.h:11:10: warning:
      'MRB_WORDBOX_NO_FLOAT_TRUNCATE' macro redefined [-Wmacro-redefined]
# define MRB_WORDBOX_NO_FLOAT_TRUNCATE
         ^
<command line>:3:9: note: previous definition is here
#define MRB_WORDBOX_NO_FLOAT_TRUNCATE 1
        ^
1 warning generated.
...SNIP...
```
2021-10-30 09:55:35 +09:00
dearblue 33792c2a02 Improved Class#new method
The number of registers used is reduced.

Also, previously `R6` and` R7` were used, which exceeded the limit of `new_irep.nregs = 6`.
This could cause the VM stack to overrun.
2021-10-29 22:20:20 +09:00
Yukihiro "Matz" Matsumoto 0069e6738a boxing_nan.h: refactor NaN Boxing.
Preparation for:

* 64 bit integer with NaN Boxing
* Favor pointer NaN Boxing
2021-10-28 12:22:21 +09:00
Yukihiro "Matz" Matsumoto fca63c6060 boxing_nan.h: revert part of dccd66f
WIP code was mistakenly committed.
2021-10-26 17:33:49 +09:00
Yukihiro "Matz" Matsumoto abf2d653d7 Merge pull request #5564 from dearblue/static_assert
Make `mrb_static_assert()` a variable argument
2021-10-25 07:59:01 +09:00
dearblue b774832ee1 Make mrb_static_assert() a variable argument
`mrb_static_assert()` extends the macro function to take one or two arguments.
If the argument is other than that, an error will occur.

References:
- static_assert のメッセージ省略を許可 - cpprefjp C++日本語リファレンス
  https://cpprefjp.github.io/lang/cpp17/extending_static_assert.html
- c - Overloading Macro on Number of Arguments - Stack Overflow
  https://stackoverflow.com/a/11763277
2021-10-24 23:11:52 +09:00
Yukihiro "Matz" Matsumoto 5c6e8b32a3 doc/mruby3.1.h: separate mruby3.0 changes and mruby3.1 changes. 2021-10-24 13:21:54 +09:00
Yukihiro "Matz" Matsumoto 7850549a5e string.c: use FNV1a algorithm for the string hash function. 2021-10-23 09:31:01 +09:00
Yukihiro "Matz" Matsumoto 74b02fba81 Merge pull request #5563 from suetanvil-misc/project-bintest-emulator-4-flat
Added testing support for cross-MinGW builds.
2021-10-22 13:41:50 +09:00
Chris Reuter 5c4273f944 Added testing support for cross-MinGW builds.
This adds a build_config that will cross-build a Windows executable
using the MinGW cross-compiler and will also run the unit (i.e.
'rake test') using Wine.

For this to work, I made some modifications to the underlying test
scripts as well as some minor changes to a couple of the tests
themselves.
2021-10-21 21:58:45 -04:00
Yukihiro "Matz" Matsumoto fabe8212fe codedump.c: add indentation for OP_MOVE. 2021-10-21 15:35:25 +09:00
Yukihiro "Matz" Matsumoto dc0d5db699 doc/mruby3.md: updated to the most recent mruby3.1 (to be). 2021-10-20 09:40:17 +09:00
Yukihiro "Matz" Matsumoto f653556731 dump.h: bump RITE_BINARY_MAJOR_VER to 03.
Since we have added several new instructions.
2021-10-19 15:27:29 +09:00
Yukihiro "Matz" Matsumoto d965d90edf codedump.c: remove OP_ prefix from disasm output. 2021-10-19 12:29:06 +09:00
Yukihiro "Matz" Matsumoto 90484cac63 codegen.c: skip OP_LOADSELF using OP_SSEND. 2021-10-19 12:13:05 +09:00
Yukihiro "Matz" Matsumoto 5d5e4f5214 ops.h: add new instructions OP_SSEND and OP_SSENDB.
These instructions call methods of the receiver.
2021-10-19 12:03:12 +09:00
Yukihiro "Matz" Matsumoto 45491cdd8c ops.h: update descriptions for array-like accesses.
* `R(a)` -> `R[a]`
* `Pool(a)` -> `Pool[a]`
* `Syms(a)` -> `Syms[a]`
* `Irep(a)` -> `Irep[a]`
2021-10-19 11:49:02 +09:00
Yukihiro "Matz" Matsumoto ab986ff108 ops.h: update OP_SEND description. 2021-10-19 11:37:59 +09:00
Yukihiro "Matz" Matsumoto b6b4ac8270 Merge pull request #5560 from mruby/dependabot/github_actions/actions/checkout-2.3.5
build(deps): bump actions/checkout from 2.3.4 to 2.3.5
2021-10-19 08:06:28 +09:00
dependabot[bot] cdccb5ea13 build(deps): bump actions/checkout from 2.3.4 to 2.3.5
Bumps [actions/checkout](https://github.com/actions/checkout) from 2.3.4 to 2.3.5.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2.3.4...v2.3.5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-18 14:05:53 +00:00
Yukihiro "Matz" Matsumoto 10edda9698 Merge pull request #5559 from igrep/fix-commented-out-example
Fix a syntax error in commented-out code
2021-10-18 13:07:32 +09:00
YAMAMOTO Yuji 66e61c5ab8 Fix a syntax error in commented-out code
By uncommenting the line changed by this commit, `ruby -c build_config/default.rb` complains of a syntax error due to the illegally nested double quotes
2021-10-18 12:45:55 +09:00