| Age | Commit message (Collapse) | Author | |
|---|---|---|---|
| 2021-08-11 | codegen.c: avoid signedness warning of int comparison. | Yukihiro "Matz" Matsumoto | |
| 2021-08-11 | codegen.c: avoid cross initialization of `mrb_insn_data`. | Yukihiro "Matz" Matsumoto | |
| 2021-08-11 | codegen.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-07 | codegen.c: need to push the value when the loop was eliminated. | Yukihiro "Matz" Matsumoto | |
| 2021-08-06 | codegen.c: `-9223372036854775808 % -1` overflows 64 bit integer. | Yukihiro "Matz" Matsumoto | |
| 2021-08-05 | codegen.c: remove code duplication from `NODE_ARRAY`. | Yukihiro "Matz" Matsumoto | |
| 2021-08-04 | codegen.c: detect integer overflow in division. | Yukihiro "Matz" Matsumoto | |
| `MRB_INT_MIN / -1` overflows. | |||
| 2021-08-03 | codegen.c: check zero division before constant folding. | Yukihiro "Matz" Matsumoto | |
| 2021-08-03 | codegen.c: avoid division by zero in constant folding. | Yukihiro "Matz" Matsumoto | |
| 2021-08-02 | codegen.c: allow constant folding for negative integer modulo. | Yukihiro "Matz" Matsumoto | |
| 2021-08-02 | codegen.c: refactor `readint()` to read `MRB_INT_MIN`. | Yukihiro "Matz" Matsumoto | |
| 2021-08-02 | codegen.c: fix a bug in bit shift constant folding. | Yukihiro "Matz" Matsumoto | |
| 2021-08-02 | codegen.c: refactor unary operator optimization. | Yukihiro "Matz" Matsumoto | |
| 2021-08-02 | codegen.c: constant folding binary operators, <<, >>, %, &, |, ^. | Yukihiro "Matz" Matsumoto | |
| 2021-08-01 | codegen.c: eliminate loop if condition is constant. | Yukihiro "Matz" Matsumoto | |
| For example, `while false; ...; end` should be removed. | |||
| 2021-08-01 | codegen.c: peephole optimize OP_JMPxxx. | Yukihiro "Matz" Matsumoto | |
| 2021-07-31 | codegen.c: allow constant folding for mul / div. | Yukihiro "Matz" Matsumoto | |
| 2021-07-31 | codegen.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-29 | codegen.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-28 | codegen.c: labels should be `uint32_t`. | Yukihiro "Matz" Matsumoto | |
| 2021-07-28 | codegen.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-28 | codegen.c: removed bytecode when the value of `while` is not used. | Yukihiro "Matz" Matsumoto | |
| 2021-07-28 | codegen.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-25 | Remove redundant include headers. | Yukihiro "Matz" Matsumoto | |
| - stdlib.h - stddef.h - stdint.h - stdarg.h - limits.h - float.h | |||
| 2021-07-23 | codegen.c: fixed a bug in `OP_LOADI32` peephole optimization. | Yukihiro "Matz" Matsumoto | |
| 2021-07-22 | codegen.c: `get_int_operand()` to support `OP_LOADL` (int in pool). | Yukihiro "Matz" Matsumoto | |
| 2021-07-22 | codegen.c: add constant folding for unary numeric operators (+, -, ~). | Yukihiro "Matz" Matsumoto | |
| 2021-07-22 | codegen.c: compare symbol names directly avoiding string conversion. | Yukihiro "Matz" Matsumoto | |
| 2021-07-21 | codegen.c: skip `-@` call if the argument is a literal integer. | Yukihiro "Matz" Matsumoto | |
| 2021-07-21 | codegen.c: move `gen_setxv()` after `new_sym()`. | Yukihiro "Matz" Matsumoto | |
| 2021-07-21 | codegen.c: introduce `gen_int()` to generate integer instructions. | Yukihiro "Matz" Matsumoto | |
| 2021-07-21 | codegen.c: add peephole optimization for `OP_LOADI32` before `OP_MOVE`. | Yukihiro "Matz" Matsumoto | |
| 2021-07-21 | codegen.c: add peephole optimization for `OP_LOADI16` before `OP_MOVE`. | Yukihiro "Matz" Matsumoto | |
| 2021-07-21 | codegen.c: a new function `get_int_operand`. | Yukihiro "Matz" Matsumoto | |
| 2021-07-20 | codegen.c: negative zero equals to positive zero. | Yukihiro "Matz" Matsumoto | |
| `OP_LOADI Rn -0` should be `OP_LOADI_0`. | |||
| 2021-07-20 | codegen.c: allow `OP_EXT` before `OP_ADDI` and `OP_SUBI`. | Yukihiro "Matz" Matsumoto | |
| This is preparation for integer constant folding. | |||
| 2021-07-17 | codegen.c: optimize variable assignments after `OP_MOVE`. | Yukihiro "Matz" Matsumoto | |
| - `OP_SETGV` - `OP_SETIV` - `OP_SETCV` - `OP_SETCONST` | |||
| 2021-07-17 | codegen.c: optimize `OP_SETUPVAR` after `OP_MOVE`. | Yukihiro "Matz" Matsumoto | |
| 2021-07-16 | codegen.c: add new peephole optimization for `OP_MOVE`. | Yukihiro "Matz" Matsumoto | |
| If `OP_MOVE` comes after `OP_GETUPVAR`, you can skip move and redirect the destination register of `OP_GETUPVAR`. | |||
| 2021-07-16 | codegen.c: add new peephole optimization for `OP_GETUPVAR`. | Yukihiro "Matz" Matsumoto | |
| 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-15 | codegen.c: `gen_jmpdst` always needs to generate relative address. | Yukihiro "Matz" Matsumoto | |
| 2021-07-09 | codegen.c: avoid uninitialized local variable. | Yukihiro "Matz" Matsumoto | |
| 2021-07-04 | codegen.c: jump address should be generated by `gen_jmpdst()`. | Yukihiro "Matz" Matsumoto | |
| 2021-07-03 | vm.c: `OP_DEF` to push a symbol to `a` register. | Yukihiro "Matz" Matsumoto | |
| The code generator no longer need to emit `OP_LOADSYM` after `OP_DEF`. `doc/opcode.md` is also updated. | |||
| 2021-06-30 | Revert "Remove `OP_EXT[123]` from operands." | Yukihiro "Matz" Matsumoto | |
| This reverts commit fd10c7231906ca48cb35892d2a86460004b62249. I thought it was OK to restrict index value within 1 byte, but in some cases index value could be 16 bits (2 bytes). I had several ideas to address the issue, but reverting `fd10c72` is the easiest way. The biggest reason is `mruby/c` still supports `OP_EXT[123]`, so that they don't need any additional work. | |||
| 2021-06-26 | Fixed finding variables defined in the upper proc failed | dearblue | |
| If no new variable was defined in the `eval` method, the variable was hidden from the nested `eval` method. ```ruby a = 1 p eval %(b = 2; eval %(a)) # => 1 (good) p eval %(eval %(a)) # => undefined method 'a' (NoMethodError) ``` This issue has occurred since mruby 3.0.0. | |||
| 2021-06-19 | codegen.c: stop `uninitialized` warning. | Yukihiro "Matz" Matsumoto | |
| 2021-06-11 | codegen.c: refactor `readint()` | Yukihiro "Matz" Matsumoto | |
| * renamed from redundant `readint_mrb_int()` * supports only base upto 16 * no base validation (already done in parser) * no negative read (negate after read) * overflow detection using `mrb_int_{mul,add}_overflow()` | |||
| 2021-05-29 | codegen.c: just raise the exception on broken node for assignments. | Yukihiro "Matz" Matsumoto | |
| 2021-03-31 | codegen.c: `s->ainfo` should be zero along with `OP_ENTER(0)`. | Yukihiro "Matz" Matsumoto | |
