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
Showing
Please register or sign in to comment