diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2016-12-03 14:50:36 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2016-12-03 14:50:36 +0900 |
| commit | c029c6c4440c730c1ed5b0d6a10e81cebe23ac9c (patch) | |
| tree | 931cfb51305480113bfcbedb4d4b058d71eb761c /mrbgems/mruby-compiler/core/codegen.c | |
| parent | 23c4ad08654c7a277edd1b56716012f361f044fa (diff) | |
| download | mruby-c029c6c4440c730c1ed5b0d6a10e81cebe23ac9c.tar.gz mruby-c029c6c4440c730c1ed5b0d6a10e81cebe23ac9c.zip | |
codegen: avoid unnecessary OP_MOVE after CASE
Diffstat (limited to 'mrbgems/mruby-compiler/core/codegen.c')
| -rw-r--r-- | mrbgems/mruby-compiler/core/codegen.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/mrbgems/mruby-compiler/core/codegen.c b/mrbgems/mruby-compiler/core/codegen.c index 2c75c8aed..414ca2627 100644 --- a/mrbgems/mruby-compiler/core/codegen.c +++ b/mrbgems/mruby-compiler/core/codegen.c @@ -1520,7 +1520,9 @@ codegen(codegen_scope *s, node *tree, int val) genop(s, MKOP_A(OP_LOADNIL, cursp())); if (pos3) dispatch_linked(s, pos3); if (head) pop(); - genop(s, MKOP_AB(OP_MOVE, cursp(), pos)); + if (cursp() != pos) { + genop(s, MKOP_AB(OP_MOVE, cursp(), pos)); + } push(); } else { |
