diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-07-21 12:54:18 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-07-21 13:15:27 +0900 |
| commit | 2ef6e944896072687bdd28c846a62e5be37eec48 (patch) | |
| tree | f6720c4a6b4f48759c0761926a06f4d7d44d579c /mrbgems/mruby-compiler/core/codegen.c | |
| parent | 81b384e3fb34f8f61de53e5bd53fcacbccbf9b7c (diff) | |
| download | mruby-2ef6e944896072687bdd28c846a62e5be37eec48.tar.gz mruby-2ef6e944896072687bdd28c846a62e5be37eec48.zip | |
codegen.c: move `gen_setxv()` after `new_sym()`.
Diffstat (limited to 'mrbgems/mruby-compiler/core/codegen.c')
| -rw-r--r-- | mrbgems/mruby-compiler/core/codegen.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/mrbgems/mruby-compiler/core/codegen.c b/mrbgems/mruby-compiler/core/codegen.c index 8af386b60..b173a83c5 100644 --- a/mrbgems/mruby-compiler/core/codegen.c +++ b/mrbgems/mruby-compiler/core/codegen.c @@ -529,20 +529,6 @@ gen_setupvar(codegen_scope *s, uint16_t dst, mrb_sym id) genop_3(s, OP_SETUPVAR, dst, idx, lv); } -static int new_sym(codegen_scope *s, mrb_sym sym); - -static void -gen_setxv(codegen_scope *s, uint8_t op, uint16_t dst, mrb_sym sym) -{ - int idx = new_sym(s, sym); - struct mrb_insn_data data = mrb_last_insn(s); - if (!no_peephole(s) && data.insn == OP_MOVE && data.a == dst) { - dst = data.b; - s->pc = s->lastpc; - } - genop_2(s, op, dst, idx); -} - static void gen_return(codegen_scope *s, uint8_t op, uint16_t src) { @@ -841,6 +827,18 @@ new_sym(codegen_scope *s, mrb_sym sym) } static void +gen_setxv(codegen_scope *s, uint8_t op, uint16_t dst, mrb_sym sym) +{ + int idx = new_sym(s, sym); + struct mrb_insn_data data = mrb_last_insn(s); + if (!no_peephole(s) && data.insn == OP_MOVE && data.a == dst) { + dst = data.b; + s->pc = s->lastpc; + } + genop_2(s, op, dst, idx); +} + +static void gen_int(codegen_scope *s, uint16_t dst, mrb_int i) { if (i < 0) { |
