summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-compiler/core/codegen.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2016-12-03 14:50:36 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2016-12-03 14:50:36 +0900
commitc029c6c4440c730c1ed5b0d6a10e81cebe23ac9c (patch)
tree931cfb51305480113bfcbedb4d4b058d71eb761c /mrbgems/mruby-compiler/core/codegen.c
parent23c4ad08654c7a277edd1b56716012f361f044fa (diff)
downloadmruby-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.c4
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 {