From 5be2bfb52369db2178ecb9dcdd31c19893e799ce Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Thu, 3 Apr 2014 10:14:38 +0900 Subject: too much peephole optimization; close #1992 --- src/codegen.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/codegen.c') diff --git a/src/codegen.c b/src/codegen.c index 708c207dc..418e1f371 100644 --- a/src/codegen.c +++ b/src/codegen.c @@ -276,8 +276,11 @@ genop_peep(codegen_scope *s, mrb_code i, int val) case OP_RETURN: return 0; case OP_MOVE: - s->iseq[s->pc-1] = MKOP_AB(OP_RETURN, GETARG_B(i0), OP_R_NORMAL); - return 0; + if (GETARG_A(i0) >= s->nlocals) { + s->iseq[s->pc-1] = MKOP_AB(OP_RETURN, GETARG_B(i0), OP_R_NORMAL); + return 0; + } + break; case OP_SETIV: case OP_SETCV: case OP_SETCONST: -- cgit v1.2.3