diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-04-03 10:14:38 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-04-03 10:14:38 +0900 |
| commit | 5be2bfb52369db2178ecb9dcdd31c19893e799ce (patch) | |
| tree | a4272cb713df3733cb1e1836e6e82efb507e7d50 /src | |
| parent | 8eaee918922e3542aec3ffa01321e019aab842ab (diff) | |
| download | mruby-5be2bfb52369db2178ecb9dcdd31c19893e799ce.tar.gz mruby-5be2bfb52369db2178ecb9dcdd31c19893e799ce.zip | |
too much peephole optimization; close #1992
Diffstat (limited to 'src')
| -rw-r--r-- | src/codegen.c | 7 |
1 files changed, 5 insertions, 2 deletions
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: |
