Yukihiro "Matz" Matsumoto
cd02cef465
array.h: avoid duplicated defined of MRB_ARY_NO_EMBED; fix #5520
2021-08-07 06:48:03 +09:00
Yukihiro "Matz" Matsumoto
ce0b38fb72
Merge pull request #5521 from mruby/dependabot/github_actions/github/super-linter-4.6.0
...
build(deps): bump github/super-linter from 4.5.1 to 4.6.0
2021-08-07 06:46:35 +09:00
dependabot[bot]
d0b214c269
build(deps): bump github/super-linter from 4.5.1 to 4.6.0
...
Bumps [github/super-linter](https://github.com/github/super-linter ) from 4.5.1 to 4.6.0.
- [Release notes](https://github.com/github/super-linter/releases )
- [Commits](https://github.com/github/super-linter/compare/v4.5.1...v4.6.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-08-06 14:05:46 +00:00
Yukihiro "Matz" Matsumoto
46a1c40fe3
numeric_ext.c: fix a bug regarding MRB_INT_MIN.
2021-08-06 11:16:12 +09:00
Yukihiro "Matz" Matsumoto
ff2da0b66e
numeric.c: fix a bug regarding MRB_INT_MIN.
2021-08-06 11:15:46 +09:00
Yukihiro "Matz" Matsumoto
37dbb91b96
codegen.c: -9223372036854775808 % -1 overflows 64 bit integer.
2021-08-06 10:35:06 +09:00
Yukihiro "Matz" Matsumoto
7ecc16f97a
codegen.c: remove code duplication from NODE_ARRAY.
2021-08-05 16:59:32 +09:00
Yukihiro "Matz" Matsumoto
9cb44f5ae3
codegen.c: detect integer overflow in division.
...
`MRB_INT_MIN / -1` overflows.
2021-08-04 12:25:14 +09:00
Yukihiro "Matz" Matsumoto
9f37733382
numeric.c: fix a bug in left shift of negative integer.
...
`-1 * (1<<63)` causes overflow, but `-1<<63` is a valid value.
2021-08-04 12:05:09 +09:00
Yukihiro "Matz" Matsumoto
9b3b2a4c95
numeric.c: check zero division before modulo.
2021-08-03 16:45:08 +09:00
Yukihiro "Matz" Matsumoto
caaa07f2da
codegen.c: check zero division before constant folding.
2021-08-03 16:43:50 +09:00
Yukihiro "Matz" Matsumoto
c480ac4457
numeric_ext.c: modulo and remainder should handle infinite argument.
2021-08-03 16:35:31 +09:00
Yukihiro "Matz" Matsumoto
e75572af6a
numeric_ext.c: add Float#modulo and #remainder methods.
2021-08-03 16:30:47 +09:00
Yukihiro "Matz" Matsumoto
f4afcbef67
numeric_ext.c: update Integer#remainder method.
...
- need to detect zero division error
- support floating point number argument (as `%`)
2021-08-03 16:28:11 +09:00
Yukihiro "Matz" Matsumoto
b70fd09f47
Revert "numeric.c: simplifies int_mod definition."
...
This reverts commit 3738d62a86 .
The change changed the behavior with floating point numbers.
2021-08-03 16:11:02 +09:00
Yukihiro "Matz" Matsumoto
2092bc7fe8
codegen.c: avoid division by zero in constant folding.
2021-08-03 15:57:01 +09:00
Yukihiro "Matz" Matsumoto
fad47a98a7
numeric_ext.c: use mrb_integer instead of mrb_as_int.
...
`mrb_as_int` implicitly converts the value into the integer, but those
methods are defined for Integer class so that the value should always be
integers.
2021-08-03 13:15:34 +09:00
Yukihiro "Matz" Matsumoto
3738d62a86
numeric.c: simplifies int_mod definition.
2021-08-03 13:14:23 +09:00
Yukihiro "Matz" Matsumoto
df6ef39d1c
numeric_ext.c: define modulo and remainder methods for Integer.
2021-08-03 13:13:42 +09:00
Yukihiro "Matz" Matsumoto
b9d2b47f16
Replace mrb_fixnum_value() with mrb_int_value().
...
Use `mrb_fixnum_value()` only when you are absolutely sure that the
value is within `Fixnum` range, i.e. 31 bits signed integer at least.
2021-08-03 13:00:11 +09:00
Yukihiro "Matz" Matsumoto
23e7cb41e5
Replace fixnum references with int.
...
The `Fixnum` class is no longer provided by `mruby`.
2021-08-03 13:00:10 +09:00
Yukihiro "Matz" Matsumoto
019b006ee5
numeric_ext.c: remove unnecessary prefix mrb_ from static functions.
2021-08-03 10:33:04 +09:00
Yukihiro "Matz" Matsumoto
1f0238a928
numeric.c: rename fixdivmod to intdivmod.
2021-08-03 07:30:59 +09:00
Yukihiro "Matz" Matsumoto
4fa24e4ff9
codegen.c: allow constant folding for negative integer modulo.
2021-08-02 16:48:16 +09:00
Yukihiro "Matz" Matsumoto
81d56477f2
numeric.c: simpler integer modulo calculation.
2021-08-02 16:47:50 +09:00
Yukihiro "Matz" Matsumoto
504d05232d
mrdb.c: do not skip OP_JMP on step execution.
2021-08-02 16:19:08 +09:00
Yukihiro "Matz" Matsumoto
e93642d53f
codegen.c: refactor readint() to read MRB_INT_MIN.
2021-08-02 14:10:38 +09:00
Yukihiro "Matz" Matsumoto
6ea0c04c06
numeric.c: use C's modulo operator if both operands are positive.
2021-08-02 14:09:38 +09:00
Yukihiro "Matz" Matsumoto
a5ac9c8790
test/driver.c: remove unused constants related to FIXNUM.
2021-08-02 08:56:38 +09:00
Yukihiro "Matz" Matsumoto
9902ab50fc
codegen.c: fix a bug in bit shift constant folding.
2021-08-02 08:53:50 +09:00
Yukihiro "Matz" Matsumoto
a9d721ea8f
numeric.c: refactor integer bit shift operations.
2021-08-02 08:53:14 +09:00
Yukihiro "Matz" Matsumoto
907df715ef
codegen.c: refactor unary operator optimization.
2021-08-02 08:51:39 +09:00
Yukihiro "Matz" Matsumoto
188c150f44
codegen.c: constant folding binary operators, <<, >>, %, &, |, ^.
2021-08-02 07:34:54 +09:00
Yukihiro "Matz" Matsumoto
1315e8751e
codegen.c: eliminate loop if condition is constant.
...
For example, `while false; ...; end` should be removed.
2021-08-01 20:33:41 +09:00
Yukihiro "Matz" Matsumoto
9dc801a798
codegen.c: peephole optimize OP_JMPxxx.
2021-08-01 20:31:19 +09:00
Yukihiro "Matz" Matsumoto
b1cb6c3c69
codegen.c: allow constant folding for mul / div.
2021-07-31 21:14:54 +09:00
Yukihiro "Matz" Matsumoto
43999492a7
codegen.c: mrb_prev_pc() to take previous instruction position.
...
It rescans `s->iseq` so that peephole optimizer can take multiple
previous instructions for constant folding, etc.
2021-07-31 21:11:36 +09:00
Yukihiro "Matz" Matsumoto
4306893971
codedump.c: instruction length should be ilen, not iseq.
2021-07-30 17:50:24 +09:00
Yukihiro "Matz" Matsumoto
517071e3fa
codegen.c: order instructions in natural order for loops.
...
`while` and `until` generates in `cond` `jmpif` `body` `jmp` order.
It used to be in `jmp` `body` `cond` `jmpif` order.
2021-07-29 17:38:18 +09:00
Yukihiro "Matz" Matsumoto
5cde5983d9
debug.c: uses most space efficient packed map for line information.
2021-07-28 23:08:58 +09:00
Yukihiro "Matz" Matsumoto
64358c09d9
codegen.c: labels should be uint32_t.
2021-07-28 23:08:58 +09:00
Yukihiro "Matz" Matsumoto
adfd29c1b0
codegen.c: fix loopinfo structure members.
...
- `pc0`: `next` destination
- `pc1`: `redo` destination (renamed from `pc2`)
- `pc3`: `break` destination (renamed from `pc3`)
old `pc1` was unused so removed.
2021-07-28 23:08:58 +09:00
Yukihiro "Matz" Matsumoto
e81d497155
codegen.c: removed bytecode when the value of while is not used.
2021-07-28 23:08:58 +09:00
Yukihiro "Matz" Matsumoto
2910af0010
codegen.c: fixed a bug when value is taken from while and until.
...
```ruby
p ((while true; p 1; break; end))
```
should print `1 nil` but was `1`.
2021-07-28 23:08:57 +09:00
Yukihiro "Matz" Matsumoto
9dd3e23fc9
Merge pull request #5518 from jbampton/pre-commit-autoupdate
...
pre-commit autoupdate
2021-07-28 23:08:10 +09:00
John Bampton
cbd54782c6
pre-commit autoupdate
...
https://pre-commit.com/#pre-commit-autoupdate
2021-07-28 21:21:57 +10:00
Yukihiro "Matz" Matsumoto
1f1dca1746
parse.y: fix an integer cast warning.
2021-07-26 11:46:22 +09:00
Yukihiro "Matz" Matsumoto
984161e6bb
parse.y: mrb_int_read() returns mrb_int not unsigned long.
...
Also, now too big capture group index just gives `nil`, not error.
2021-07-26 11:20:59 +09:00
Yukihiro "Matz" Matsumoto
4803718b14
parse.y: unify redundant functions yywarn() and yywarning().
2021-07-26 11:12:10 +09:00
Yukihiro "Matz" Matsumoto
f6b37ff44d
debug.c: small refactoring.
2021-07-26 11:10:20 +09:00