diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-09-20 16:58:27 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-09-20 16:58:27 +0900 |
| commit | ca7228ad425706b81311e51eb7718f12bf7f4885 (patch) | |
| tree | ad379938b06413ef3204e79ca1fd00ed3e8758cb /mrbgems/mruby-compiler/core/codegen.c | |
| parent | 1baf08f174b109038df93b4731b0200b039aa4ab (diff) | |
| download | mruby-ca7228ad425706b81311e51eb7718f12bf7f4885.tar.gz mruby-ca7228ad425706b81311e51eb7718f12bf7f4885.zip | |
codegen.c: `gen_move` should generate proper `OP_LOADI16`.
Diffstat (limited to 'mrbgems/mruby-compiler/core/codegen.c')
| -rw-r--r-- | mrbgems/mruby-compiler/core/codegen.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/mrbgems/mruby-compiler/core/codegen.c b/mrbgems/mruby-compiler/core/codegen.c index ad2e8e5c0..aba7f66d0 100644 --- a/mrbgems/mruby-compiler/core/codegen.c +++ b/mrbgems/mruby-compiler/core/codegen.c @@ -594,7 +594,7 @@ gen_move(codegen_scope *s, uint16_t dst, uint16_t src, int nopeep) rewind_pc(s); genop_1(s, data.insn, dst); return; - case OP_LOADI: case OP_LOADINEG: case OP_LOADI16: + case OP_LOADI: case OP_LOADINEG: case OP_LOADL: case OP_LOADSYM: case OP_GETGV: case OP_GETSV: case OP_GETIV: case OP_GETCV: case OP_GETCONST: case OP_STRING: @@ -603,10 +603,10 @@ gen_move(codegen_scope *s, uint16_t dst, uint16_t src, int nopeep) rewind_pc(s); genop_2(s, data.insn, dst, data.b); return; - case OP_GETUPVAR: + case OP_LOADI16: if (data.a != src || data.a < s->nlocals) goto normal; rewind_pc(s); - genop_3(s, data.insn, dst, data.b, data.c); + genop_2S(s, data.insn, dst, data.b); return; case OP_LOADI32: if (data.a != src || data.a < s->nlocals) goto normal; @@ -616,6 +616,11 @@ gen_move(codegen_scope *s, uint16_t dst, uint16_t src, int nopeep) genop_2SS(s, data.insn, dst, i); } return; + case OP_GETUPVAR: + if (data.a != src || data.a < s->nlocals) goto normal; + rewind_pc(s); + genop_3(s, data.insn, dst, data.b, data.c); + return; case OP_ADDI: case OP_SUBI: if (addr_pc(s, data.addr) == s->lastlabel || data.a != src || data.a < s->nlocals) goto normal; else { |
