diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-07-16 07:52:21 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-07-16 07:52:21 +0900 |
| commit | 1a3564f2f1fce239d7982cd5b3850bfff32222c0 (patch) | |
| tree | 24819d54f6edf26c88e6b84a322736befe3de6f3 /src/array.c | |
| parent | d4abbf1b77b225448a8914bbe48b400008bb40cb (diff) | |
| download | mruby-1a3564f2f1fce239d7982cd5b3850bfff32222c0.tar.gz mruby-1a3564f2f1fce239d7982cd5b3850bfff32222c0.zip | |
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
Diffstat (limited to 'src/array.c')
0 files changed, 0 insertions, 0 deletions
