summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-compiler
AgeCommit message (Collapse)Author
2021-09-20codegen.c: check `no_peephole(s)` before `mrb_last_insn(s)`.Yukihiro "Matz" Matsumoto
2021-09-20codegen.c (mrb_last_insn): no previous instruction on top.Yukihiro "Matz" Matsumoto
2021-09-19codegen.c: unify `OP_ARYPUSH` and `OP_ARYPUSH_N`.Yukihiro "Matz" Matsumoto
- `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-17ops.h: add `OP_ARYPUSH_N` instruction.Yukihiro "Matz" Matsumoto
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-13parse.y: `cons_free` unused node (empty string node).Yukihiro "Matz" Matsumoto
2021-09-13parse.y: allow non-local variable access from hash value omission.Yukihiro "Matz" Matsumoto
For example, `{p:}` (means `{p:p}`) and `{String:}` (`{String:String}`) should be allowed like CRuby.
2021-09-13parse.y: allow value omission in Hash literals introduced in Ruby3.1.Yukihiro "Matz" Matsumoto
`{x:, y:}` now is a syntax sugar of `{x: x, y: y}`. This fix also includes the update of #4815 fix.
2021-09-12parse.y: fix `nint` (int to node) and `intn` (node to int).Yukihiro "Matz" Matsumoto
2021-09-12parse.y: avoid adding zero length strings.Yukihiro "Matz" Matsumoto
2021-09-10codegen.c: fixed `gen_setxv` bug with taking assignment value; fix #5550Yukihiro "Matz" Matsumoto
2021-09-10codegen.c: `gen_move` refactoring.Yukihiro "Matz" Matsumoto
2021-09-10ops.h: add `OP_SYMBOL` instruction.Yukihiro "Matz" Matsumoto
It generates a symbol by interning from the pool string.
2021-09-10fixup! codegen.c: resurrect `s->lastpc` to reduce `iseq` scans.Yukihiro "Matz" Matsumoto
2021-09-10codegen.c: resurrect `s->lastpc` to reduce `iseq` scans.Yukihiro "Matz" Matsumoto
When parsing scripts frequent scans could cost too much.
2021-09-07codegen.c: improve exception handling in `generate_code`.Yukihiro "Matz" Matsumoto
- remove `mrb_jmpbuf` from `codegen_scope` - unify exception handling of `mrb_state` and `codegen_scope`
2021-09-07parse.y: refactor `mrb_parser_parse()`.Yukihiro "Matz" Matsumoto
- remove `mrb_jmpbuf` from `truct mrb_parser_state` - unify exception handling of `mrb_state` and `mrb_parser_state`.
2021-09-06parse.y: refactoring `mrb_parser_parser()`.Yukihiro "Matz" Matsumoto
2021-09-05codegen.c: avoid integer overflow.Yukihiro "Matz" Matsumoto
2021-08-21Organize the include of header filesdearblue
- `#include <math.h>` is done in `mruby.h`. Eliminate the need to worry about the `MRB_NO_FLOAT` macro. - Include mruby header files before standard header files. If the standard header file is already placed before `mruby.h`, the standard header file added in the future tends to be placed before `mruby.h`. This change should some reduce the chances of macros that must be defined becoming undefined in C++ or including problematic header files in a particular mruby build configuration.
2021-08-13codegen.c: fixed a bug in `mrb_decode_insn()`.Yukihiro "Matz" Matsumoto
2021-08-13codegen.c: add a comment that notice `rewind_pc` calling convention.Yukihiro "Matz" Matsumoto
`rewind_pc` should not be called when `s->pc` is `0` (top).
2021-08-13codegen.c: refactor `mrb_last_insn()`.Yukihiro "Matz" Matsumoto
Last commit made `mrb_decode_insn()` to take `NULL` as `pc`.
2021-08-13codegen.c: `mrb_prev_pc` can return `NULL` at the top of `iseq`.Yukihiro "Matz" Matsumoto
2021-08-11codegen.c: avoid signedness warning of int comparison.Yukihiro "Matz" Matsumoto
2021-08-11codegen.c: avoid cross initialization of `mrb_insn_data`.Yukihiro "Matz" Matsumoto
2021-08-11codegen.c: more peephole optimization.Yukihiro "Matz" Matsumoto
`a=10; a+=1` to generate: ``` 1 000 OP_LOADI R1 11 ; R1:a ``` instead of: ``` 1 000 OP_LOADI R1 10 ; R1:a 1 003 OP_MOVE R2 R1 ; R1:a 1 006 OP_ADDI R2 1 1 009 OP_MOVE R1 R2 ; R1:a ```
2021-08-07codegen.c: need to push the value when the loop was eliminated.Yukihiro "Matz" Matsumoto
2021-08-06codegen.c: `-9223372036854775808 % -1` overflows 64 bit integer.Yukihiro "Matz" Matsumoto
2021-08-05codegen.c: remove code duplication from `NODE_ARRAY`.Yukihiro "Matz" Matsumoto
2021-08-04codegen.c: detect integer overflow in division.Yukihiro "Matz" Matsumoto
`MRB_INT_MIN / -1` overflows.
2021-08-03codegen.c: check zero division before constant folding.Yukihiro "Matz" Matsumoto
2021-08-03codegen.c: avoid division by zero in constant folding.Yukihiro "Matz" Matsumoto
2021-08-02codegen.c: allow constant folding for negative integer modulo.Yukihiro "Matz" Matsumoto
2021-08-02codegen.c: refactor `readint()` to read `MRB_INT_MIN`.Yukihiro "Matz" Matsumoto
2021-08-02codegen.c: fix a bug in bit shift constant folding.Yukihiro "Matz" Matsumoto
2021-08-02codegen.c: refactor unary operator optimization.Yukihiro "Matz" Matsumoto
2021-08-02codegen.c: constant folding binary operators, <<, >>, %, &, |, ^.Yukihiro "Matz" Matsumoto
2021-08-01codegen.c: eliminate loop if condition is constant.Yukihiro "Matz" Matsumoto
For example, `while false; ...; end` should be removed.
2021-08-01codegen.c: peephole optimize OP_JMPxxx.Yukihiro "Matz" Matsumoto
2021-07-31codegen.c: allow constant folding for mul / div.Yukihiro "Matz" Matsumoto
2021-07-31codegen.c: `mrb_prev_pc()` to take previous instruction position.Yukihiro "Matz" Matsumoto
It rescans `s->iseq` so that peephole optimizer can take multiple previous instructions for constant folding, etc.
2021-07-29codegen.c: order instructions in natural order for loops.Yukihiro "Matz" Matsumoto
`while` and `until` generates in `cond` `jmpif` `body` `jmp` order. It used to be in `jmp` `body` `cond` `jmpif` order.
2021-07-28codegen.c: labels should be `uint32_t`.Yukihiro "Matz" Matsumoto
2021-07-28codegen.c: fix `loopinfo` structure members.Yukihiro "Matz" Matsumoto
- `pc0`: `next` destination - `pc1`: `redo` destination (renamed from `pc2`) - `pc3`: `break` destination (renamed from `pc3`) old `pc1` was unused so removed.
2021-07-28codegen.c: removed bytecode when the value of `while` is not used.Yukihiro "Matz" Matsumoto
2021-07-28codegen.c: fixed a bug when value is taken from `while` and `until`.Yukihiro "Matz" Matsumoto
```ruby p ((while true; p 1; break; end)) ``` should print `1 nil` but was `1`.
2021-07-26parse.y: fix an integer cast warning.Yukihiro "Matz" Matsumoto
2021-07-26parse.y: `mrb_int_read()` returns `mrb_int` not `unsigned long`.Yukihiro "Matz" Matsumoto
Also, now too big capture group index just gives `nil`, not error.
2021-07-26parse.y: unify redundant functions `yywarn()` and `yywarning()`.Yukihiro "Matz" Matsumoto
2021-07-25parse.y: replace `strtoul()` by `mrb_int_read()`.Yukihiro "Matz" Matsumoto