Yukihiro "Matz" Matsumoto
bec074e6a3
vm.c: check call stack depth before pushing the frame.
...
Existing call stack depth checks are unified into this check in
`cipush()`. The maximum depth is now specified by `MRB_CALL_LEVEL_MAX`
(the default is 512). The older `MRB_FUNCALL_DEPTH_MAX` is no longer
used.
2021-10-08 15:35:33 +09:00
Yukihiro "Matz" Matsumoto
fd6d911b53
codegen.c: peephole optimize OP_MOVE after OP_ARRAY or OP_HASH.
...
When the length operand is zero, we don't need `OP_MOVE` but adjust the
destination operand instead.
2021-10-08 12:09:05 +09:00
Yukihiro "Matz" Matsumoto
7018286453
Merge pull request #5554 from mruby/dependabot/github_actions/github/super-linter-4.8.1
...
build(deps): bump github/super-linter from 4.8.0 to 4.8.1
2021-10-07 10:30:12 +09:00
Yukihiro "Matz" Matsumoto
376e84c9d7
codedump.c: remove trailing extra newline.
...
The bug was introduced in 8be78bd.
2021-10-06 07:36:44 +09:00
Yukihiro "Matz" Matsumoto
9aa3c26221
io.c: hide internal method names in backtrace.
2021-10-05 07:11:59 +09:00
dependabot[bot]
4ef612a586
build(deps): bump github/super-linter from 4.8.0 to 4.8.1
...
Bumps [github/super-linter](https://github.com/github/super-linter ) from 4.8.0 to 4.8.1.
- [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.0...v4.8.1 )
---
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-10-04 14:08:09 +00:00
Yukihiro "Matz" Matsumoto
ab1047b445
codegen.c: no OP_ARGARY is needed here.
2021-10-04 07:45:46 +09:00
Yukihiro "Matz" Matsumoto
09336c5d49
mruby/ops.h: add new instructions OP_GETIDX and OP_SETIDX.
...
Which represent `obj[int]` and `obj[int]=val` respectively where `obj`
is either `string`, `array` or `hash`, so that index access could be
faster. When `obj` is not assumed type or `R(a+1)` is not integer, the
instructions fallback to method calls.
2021-10-03 17:14:00 +09:00
Yukihiro "Matz" Matsumoto
d64d8ca8e4
Merge branch 'dearblue-inline-struct-gem'
2021-10-02 20:11:32 +09:00
Yukihiro "Matz" Matsumoto
31e3dbc5a8
Merge branch 'inline-struct-gem' of https://github.com/dearblue/mruby into dearblue-inline-struct-gem
2021-10-02 20:09:20 +09:00
Yukihiro "Matz" Matsumoto
4e504eaca1
SECURITY.md: add scope description.
2021-10-01 19:13:07 +09:00
Yukihiro "Matz" Matsumoto
d96f53f8f8
TODO.md: update.
2021-09-30 17:15:29 +09:00
Yukihiro "Matz" Matsumoto
eea605bfc5
dreamcast_shelf.rb: remove unnecessary gem lines.
...
- `mruby-binding-core` should be handle through dependency
- `mruby-inline-struct` is only for tests
2021-09-30 12:46:45 +09:00
Yukihiro "Matz" Matsumoto
bb3cd69aff
value.h: introduce MRB_TT_STRUCT for mruby-struct.
2021-09-30 12:46:45 +09:00
Yukihiro "Matz" Matsumoto
f1a5c050f4
Merge pull request #5553 from mruby/dependabot/github_actions/github/super-linter-4.8.0
...
build(deps): bump github/super-linter from 4.7.3 to 4.8.0
2021-09-28 23:14:39 +09:00
dependabot[bot]
1b53b973e5
build(deps): bump github/super-linter from 4.7.3 to 4.8.0
...
Bumps [github/super-linter](https://github.com/github/super-linter ) from 4.7.3 to 4.8.0.
- [Release notes](https://github.com/github/super-linter/releases )
- [Changelog](https://github.com/github/super-linter/blob/master/docs/release-process.md )
- [Commits](https://github.com/github/super-linter/compare/v4.7.3...v4.8.0 )
---
updated-dependencies:
- dependency-name: github/super-linter
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com >
2021-09-28 14:07:15 +00:00
Yukihiro "Matz" Matsumoto
906f9f2ba7
parse.y: __ENCODING__ should be determined in run-time; fix #5552
...
It used to be compiled to the static string in the compiler. But the
encoding status actually depends on the runtime configuration. A new
method `Kernel#__ENCODING__` is introduced to implement the feature.
2021-09-27 10:10:35 +09:00
Yukihiro "Matz" Matsumoto
368e8ce3d5
codegen.c: should not loop_push() before constant folding.
...
Otherwise, the following code will crash:
```ruby
1.times{{}until 1; break}
```
2021-09-26 16:58:40 +09:00
Yukihiro "Matz" Matsumoto
89ea41f15e
mrbconf.h: rename a configuration macro for no truncate floats.
...
Rename `MRB_WORDBOX_USE_HEAP_FLOAT` to `MRB_WORDBOX_NO_FLOAT_TRUNCATE'.
2021-09-25 14:44:43 +09:00
Yukihiro "Matz" Matsumoto
c70159b356
Revert "vm.c: add assertions instead of mrb_ensure_hash_type()."
...
This reverts commit 913a0a5a03 .
In some cases, `OP_HASHADD` operand may not be `Hash`. We should check
explicitly in those cases.
2021-09-24 17:10:11 +09:00
Yukihiro "Matz" Matsumoto
ab54ca272a
codegen.c: refactor NODE_WHILE and NODE_UNTIL.
2021-09-24 11:39:00 +09:00
Yukihiro "Matz" Matsumoto
7c6c4ebb56
codegen.c: add short circuit constant folding for NODE_AND, NODE_OR.
2021-09-24 11:38:02 +09:00
Yukihiro "Matz" Matsumoto
863671c89f
codegen.c: refactor NODE_IF generation for boolean constants.
...
In addition, add `NODE_SYM` for always true expression.
2021-09-24 11:36:27 +09:00
Yukihiro "Matz" Matsumoto
a844f89655
codegen.c: need to check no_peephole() before constant folding.
2021-09-23 21:19:36 +09:00
Yukihiro "Matz" Matsumoto
4c196dbba5
codegen.c: separate maximum stack size from GEN_LIT_ARY_MAX.
2021-09-23 20:11:30 +09:00
Yukihiro "Matz" Matsumoto
fd7896e579
error.c: stop calling initialize from VM exceptions.
...
The invocation of `initialize` hook can cause infinite recursion too
easily. We stop invoking the method for safety, at the cost of less
flexibility.
The `initialize` methods (e.g. ones defined in `mrblib/10error.rb`) are
called only from `NoMethodError.new(args..)` forms.
2021-09-22 11:41:38 +09:00
Yukihiro "Matz" Matsumoto
913a0a5a03
vm.c: add assertions instead of mrb_ensure_hash_type().
2021-09-21 16:47:55 +09:00
Yukihiro "Matz" Matsumoto
dd0caf8728
Create SECURITY.md
2021-09-20 19:44:41 +09:00
Yukihiro "Matz" Matsumoto
d6dd6f0e7b
Update struct initializer to work with relatively older C++.
2021-09-20 19:13:17 +09:00
Yukihiro "Matz" Matsumoto
8be78dbf9d
codedump.c: add cosmetic tabs before variable labels.
2021-09-20 17:33:07 +09:00
Yukihiro "Matz" Matsumoto
c29822f80c
codegen.c (gen_addsub): use mrb_int_sub_overflow().
2021-09-20 17:32:38 +09:00
Yukihiro "Matz" Matsumoto
0455313a9b
codegen.c: avoid constant folding OP_LOADI16 across branch target.
2021-09-20 17:30:14 +09:00
Yukihiro "Matz" Matsumoto
ca7228ad42
codegen.c: gen_move should generate proper OP_LOADI16.
2021-09-20 16:58:27 +09:00
Yukihiro "Matz" Matsumoto
1baf08f174
codegen.c: rename loopinfo->acc to reg.
...
`acc` meant `accumulator` but it is not an accumulator but just a
register position.
2021-09-20 10:40:30 +09:00
Yukihiro "Matz" Matsumoto
2083d99392
codegen.c: check no_peephole(s) before mrb_last_insn(s).
2021-09-20 10:37:11 +09:00
Yukihiro "Matz" Matsumoto
f85c50543b
codegen.c (mrb_last_insn): no previous instruction on top.
2021-09-20 10:35:01 +09:00
Yukihiro "Matz" Matsumoto
938af8a8ff
vm.c: add array assertions.
2021-09-19 23:17:19 +09:00
Yukihiro "Matz" Matsumoto
8bfa99975c
codegen.c: unify OP_ARYPUSH and OP_ARYPUSH_N.
...
- `OP_ARYPUSH` now takes operand for the number of pushing elements
- the code generator consume the stack no more than `64` for `mruby/c`
2021-09-19 09:07:20 +09:00
Yukihiro "Matz" Matsumoto
7c99df8416
ops.h: add OP_ARYPUSH_N instruction.
...
Add n elements at once. Reduces instructions for huge array
initialization. In addition, `gen_value` function in `codegen.c` was
refactored and clarified.
2021-09-17 07:49:47 +09:00
Yukihiro "Matz" Matsumoto
6f044de578
AUTHORS: update. [ci skip]
2021-09-17 07:47:45 +09:00
Yukihiro "Matz" Matsumoto
f7063ccd1b
AUTHORS: update. [ci skip]
2021-09-16 20:24:29 +09:00
Yukihiro "Matz" Matsumoto
8619ba6a38
Use struct initializer instead of memset.
2021-09-15 13:02:15 +09:00
Yukihiro "Matz" Matsumoto
e5e7bd29ef
sprintf.c: width may have been INT_MAX.
...
Now `width` is limited to `INT16_MIN..INT16_MAX`.
2021-09-14 14:12:56 +09:00
Yukihiro "Matz" Matsumoto
6dbf49fdb4
parse.y: cons_free unused node (empty string node).
2021-09-13 12:20:11 +09:00
Yukihiro "Matz" Matsumoto
100eac3fec
parse.y: allow non-local variable access from hash value omission.
...
For example, `{p:}` (means `{p:p}`) and `{String:}` (`{String:String}`)
should be allowed like CRuby.
2021-09-13 12:15:10 +09:00
Yukihiro "Matz" Matsumoto
6c76926d05
parse.y: allow value omission in Hash literals introduced in Ruby3.1.
...
`{x:, y:}` now is a syntax sugar of `{x: x, y: y}`.
This fix also includes the update of #4815 fix.
2021-09-13 11:04:27 +09:00
Yukihiro "Matz" Matsumoto
31fc74f5a8
parse.y: fix nint (int to node) and intn (node to int).
2021-09-12 23:14:43 +09:00
Yukihiro "Matz" Matsumoto
9e86d204e5
parse.y: avoid adding zero length strings.
2021-09-12 07:58:57 +09:00
Yukihiro "Matz" Matsumoto
e1a865f272
codedump.c: avoid printing OP_EXT? prefix.
2021-09-11 11:00:11 +09:00
Yukihiro "Matz" Matsumoto
648a774ef6
ops.h: update OP_HASHADD description.
2021-09-10 19:11:56 +09:00