diff options
| author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-10-31 13:04:32 +0000 |
|---|---|---|
| committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-10-31 13:04:32 +0000 |
| commit | c3701f1fc4dfca522a6b6db2e7892c061e8811c3 (patch) | |
| tree | 345626c7cb060dcd898f32f8f12ccdd3c5e644fa /compile.c | |
| parent | adaca8a60bd63672752b281df65ec7cd8f007ff6 (diff) | |
merges r24757 and r24758 from trunk into ruby_1_9_1.
--
* compile.c (iseq_compile_each): &&= and ||= should return rhs.
[ruby-dev:39163] (#1996), [ruby-core:25143]
--
* compile.c (iseq_compile_each): &&= and ||= should return rhs.
[ruby-dev:39163] (#1996), [ruby-core:25143]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@25589 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
| -rw-r--r-- | compile.c | 32 |
1 files changed, 21 insertions, 11 deletions
@@ -3847,22 +3847,26 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) if lcfin # r o pop # r eval v # r v - send a= # v - jump lfin # v + swap # v r + topn 1 # v r v + send a= # v ? + jump lfin # v ? lcfin: # r o swap # o r - pop # o - lfin: # v + lfin: # o ? + pop # o # and dup # r o o unless lcfin pop # r eval v # r v - send a= # v - jump lfin # v + swap # v r + topn 1 # v r v + send a= # v ? + jump lfin # v ? # others eval v # r o v @@ -3886,26 +3890,32 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) } ADD_INSN(ret, nd_line(node), pop); COMPILE(ret, "NODE_OP_ASGN2 val", node->nd_value); + ADD_INSN(ret, nd_line(node), swap); + ADD_INSN1(ret, nd_line(node), topn, INT2FIX(1)); ADD_SEND(ret, nd_line(node), ID2SYM(node->nd_next->nd_aid), INT2FIX(1)); ADD_INSNL(ret, nd_line(node), jump, lfin); ADD_LABEL(ret, lcfin); ADD_INSN(ret, nd_line(node), swap); - ADD_INSN(ret, nd_line(node), pop); ADD_LABEL(ret, lfin); + ADD_INSN(ret, nd_line(node), pop); + if (poped) { + /* we can apply more optimize */ + ADD_INSN(ret, nd_line(node), pop); + } } else { COMPILE(ret, "NODE_OP_ASGN2 val", node->nd_value); ADD_SEND(ret, nd_line(node), ID2SYM(node->nd_next->nd_mid), INT2FIX(1)); + if (!poped) { + ADD_INSN(ret, nd_line(node), swap); + ADD_INSN1(ret, nd_line(node), topn, INT2FIX(1)); + } ADD_SEND(ret, nd_line(node), ID2SYM(node->nd_next->nd_aid), INT2FIX(1)); - } - - if (poped) { - /* we can apply more optimize */ ADD_INSN(ret, nd_line(node), pop); } break; |
