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
Yukihiro "Matz" Matsumoto
b4696c3935
debug.c: remove type cast warnings.
2021-07-26 11:09:42 +09:00
Yukihiro "Matz" Matsumoto
642497fe19
fmt_fp.c: add implicit cast from mrb_float to int8_t.
2021-07-26 10:57:42 +09:00
Yukihiro "Matz" Matsumoto
966aa476d1
vm.c: fix integer type error in mrb_protect_error.
2021-07-26 10:49:12 +09:00
Yukihiro "Matz" Matsumoto
6175db2746
irep.h: operand c should be fit in uint8_t.
2021-07-26 10:47:40 +09:00
Yukihiro "Matz" Matsumoto
22b24d5d76
test/binding.rb: remove a duplicated test.
2021-07-26 10:46:36 +09:00
Yukihiro "Matz" Matsumoto
26340a8818
time.c: fixed a potential buffer overflow in time_zonename.
2021-07-25 16:43:00 +09:00
Yukihiro "Matz" Matsumoto
c2c0250063
time.c: fixed time_zonename buffer size bug.
2021-07-25 16:38:37 +09:00
Yukihiro "Matz" Matsumoto
368b75d81b
time.c: stop returning LOCAL for the zone name from Time.zone.
2021-07-25 13:07:11 +09:00
Yukihiro "Matz" Matsumoto
2bed2fabae
time.c: update the document for Time#usec; close #5515
2021-07-25 13:07:11 +09:00
Yukihiro "Matz" Matsumoto
47eca476e8
pack.c: fixed sign comparison warning.
2021-07-25 13:07:11 +09:00
Yukihiro "Matz" Matsumoto
8de8521cb6
parse.y: replace strtoul() by mrb_int_read().
2021-07-25 13:07:10 +09:00
Yukihiro "Matz" Matsumoto
5c804cf68f
Remove redundant include headers.
...
- stdlib.h
- stddef.h
- stdint.h
- stdarg.h
- limits.h
- float.h
2021-07-25 13:07:10 +09:00
Yukihiro "Matz" Matsumoto
1f90a39799
Merge pull request #5514 from mruby/dependabot/github_actions/github/super-linter-4.5.1
...
build(deps): bump github/super-linter from 4.5.0 to 4.5.1
2021-07-24 13:21:08 +09:00
dependabot[bot]
5b3a4b36c7
build(deps): bump github/super-linter from 4.5.0 to 4.5.1
...
Bumps [github/super-linter](https://github.com/github/super-linter ) from 4.5.0 to 4.5.1.
- [Release notes](https://github.com/github/super-linter/releases )
- [Commits](https://github.com/github/super-linter/compare/v4.5.0...v4.5.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-07-23 14:06:33 +00:00
Yukihiro "Matz" Matsumoto
9c43276eb5
codegen.c: fixed a bug in OP_LOADI32 peephole optimization.
2021-07-23 11:20:18 +09:00
Yukihiro "Matz" Matsumoto
598c97ef76
codegen.c: get_int_operand() to support OP_LOADL (int in pool).
2021-07-22 11:49:47 +09:00
Yukihiro "Matz" Matsumoto
d0fed63414
codegen.c: add constant folding for unary numeric operators (+, -, ~).
2021-07-22 11:39:52 +09:00
Yukihiro "Matz" Matsumoto
3e9ed1cca2
codegen.c: compare symbol names directly avoiding string conversion.
2021-07-22 11:21:00 +09:00
Yukihiro "Matz" Matsumoto
e42f192827
codegen.c: skip -@ call if the argument is a literal integer.
2021-07-21 13:20:34 +09:00
Yukihiro "Matz" Matsumoto
2ef6e94489
codegen.c: move gen_setxv() after new_sym().
2021-07-21 13:15:27 +09:00
Yukihiro "Matz" Matsumoto
81b384e3fb
codegen.c: introduce gen_int() to generate integer instructions.
2021-07-21 13:15:27 +09:00
Yukihiro "Matz" Matsumoto
47fca90069
codegen.c: add peephole optimization for OP_LOADI32 before OP_MOVE.
2021-07-21 08:00:02 +09:00
Yukihiro "Matz" Matsumoto
28bf950e01
codegen.c: add peephole optimization for OP_LOADI16 before OP_MOVE.
2021-07-21 07:54:08 +09:00
Yukihiro "Matz" Matsumoto
275fe8c94b
codegen.c: a new function get_int_operand.
2021-07-21 07:52:39 +09:00
Yukihiro "Matz" Matsumoto
5066e2370d
codegen.c: negative zero equals to positive zero.
...
`OP_LOADI Rn -0` should be `OP_LOADI_0`.
2021-07-20 18:24:33 +09:00
Yukihiro "Matz" Matsumoto
cdf54f3159
codegen.c: allow OP_EXT before OP_ADDI and OP_SUBI.
...
This is preparation for integer constant folding.
2021-07-20 11:07:37 +09:00
Yukihiro "Matz" Matsumoto
43f6f765b0
Remove unused prototypes for mrb_proc_merge_lvar(); ref #5511
2021-07-19 07:42:49 +09:00
Yukihiro "Matz" Matsumoto
ed2a6a160e
Merge pull request #5511 from dearblue/binding.3
...
Explicit write barrier for binding
2021-07-19 07:40:22 +09:00
Yukihiro "Matz" Matsumoto
71c778dbfc
Merge pull request #5510 from dearblue/check-stdint
...
Output an error if the `INTPTR_MAX` macro is undefined in C++
2021-07-18 14:34:48 +09:00