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
Yukihiro "Matz" Matsumoto
86f8edca64
Merge pull request #5509 from dearblue/cast-c++
...
Avoid implicit casting from void pointers for C++
2021-07-17 20:55:18 +09:00
dearblue
de4523f793
Explicit write barrier for binding
2021-07-17 20:43:19 +09:00
dearblue
dbd249cace
Output an error if the INTPTR_MAX macro is undefined in C++
...
When doing `conf.enable_cxx_abi` and compiling with FreeBSD + clang or MinGW, such as `INTPTR_MAX` constant macro is not defined if `#include <stdint.h>` precedes `#include <mruby.h>`.
Currently I get a warning when I use an undefined macro, but if I don't notice it I get confused in a link error.
It can be expected that the problem will be easier to understand by making a clear error.
Adding `-Werror=undef` as a compiler flag can also result in an error, but this can be a problem if the system header file itself uses undefined macros, for example.
This patch does minimal confirmation only, but has no side effects.
2021-07-17 20:32:38 +09:00
dearblue
c8750048be
Avoid implicit casting from void pointers for C++
2021-07-17 20:21:30 +09:00
Yukihiro "Matz" Matsumoto
d4e22c2cec
codedump.c: update some instructions.
...
- OP_GETGV
- OP_SETGV
- OP_GETSV
- OP_SETSV
- OP_GETIV
- OP_SETIV
- OP_GETCV
- OP_SETCV
- OP_GETCONST
- OP_SETCONST
- OP_GETMCNST
- OP_SETMCNST
- OP_GETUPVAR
- OP_SETUPVAR
2021-07-17 19:51:25 +09:00
Yukihiro "Matz" Matsumoto
887df090cb
codegen.c: optimize variable assignments after OP_MOVE.
...
- `OP_SETGV`
- `OP_SETIV`
- `OP_SETCV`
- `OP_SETCONST`
2021-07-17 19:51:25 +09:00
Yukihiro "Matz" Matsumoto
4dda97502b
codegen.c: optimize OP_SETUPVAR after OP_MOVE.
2021-07-17 19:51:24 +09:00
Yukihiro "Matz" Matsumoto
3401396a16
Merge pull request #5508 from mruby/dependabot/github_actions/github/super-linter-4.5.0
...
build(deps): bump github/super-linter from 4.4.1 to 4.5.0
2021-07-16 07:57:58 +09:00
Yukihiro "Matz" Matsumoto
70f31d4bb4
codegen.c: add new peephole optimization for OP_MOVE.
...
If `OP_MOVE` comes after `OP_GETUPVAR`, you can skip move and redirect
the destination register of `OP_GETUPVAR`.
2021-07-16 07:55:25 +09:00
Yukihiro "Matz" Matsumoto
1a3564f2f1
codegen.c: add new peephole optimization for OP_GETUPVAR.
...
When `OP_GETUPVAR` is generated right after `OP_SETUPVAR`, there is no
need to read the upvar back to the register, e.g.
3 008 OP_ADDI R2 1
3 011 OP_SETUPVAR R2 1 0
4 015 OP_GETUPVAR R2 1 0
4 019 OP_LOADI_2 R3
`OP_GETUPVAR` at the address `015` is useless. We can skip it like:
3 008 OP_ADDI R2 1
3 011 OP_SETUPVAR R2 1 0
4 015 OP_LOADI_2 R3
2021-07-16 07:52:21 +09:00
dependabot[bot]
1284c0615e
build(deps): bump github/super-linter from 4.4.1 to 4.5.0
...
Bumps [github/super-linter](https://github.com/github/super-linter ) from 4.4.1 to 4.5.0.
- [Release notes](https://github.com/github/super-linter/releases )
- [Commits](https://github.com/github/super-linter/compare/v4.4.1...v4.5.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-07-15 14:06:05 +00:00
Yukihiro "Matz" Matsumoto
d4abbf1b77
test/syntax.rb: add tests for break and redo.
2021-07-15 15:22:23 +09:00
Yukihiro "Matz" Matsumoto
b7d75591f3
codegen.c: gen_jmpdst always needs to generate relative address.
2021-07-15 14:08:17 +09:00