diff options
author | Nicholas Clark <nick@ccl4.org> | 2008-01-24 10:44:25 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2008-01-24 10:44:25 +0000 |
commit | a28356daf92caa7f638e39190a3f2c5a3cd8acfe (patch) | |
tree | 5083feb034f3d90f3b53f7d28d883bbe0296a06e /pp_ctl.c | |
parent | 4b70616db4b88e90e04bbf6a612b803f6a4d8dc1 (diff) | |
download | perl-a28356daf92caa7f638e39190a3f2c5a3cd8acfe.tar.gz |
Split out foreach iterations of temporary lists on the stack to
CXt_LOOP_STACK. Don't use cx->blk_loop.iterary to store PL_curstack.
p4raw-id: //depot/perl@33059
Diffstat (limited to 'pp_ctl.c')
-rw-r--r-- | pp_ctl.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -1256,6 +1256,7 @@ S_dopoptolabel(pTHX_ const char *label) if (CxTYPE(cx) == CXt_NULL) return -1; break; + case CXt_LOOP_STACK: case CXt_LOOP_FOR: case CXt_LOOP_PLAIN: if ( !CxLABEL(cx) || strNE(label, CxLABEL(cx)) ) { @@ -1372,6 +1373,7 @@ S_dopoptoloop(pTHX_ I32 startingblock) if ((CxTYPE(cx)) == CXt_NULL) return -1; break; + case CXt_LOOP_STACK: case CXt_LOOP_FOR: case CXt_LOOP_PLAIN: DEBUG_l( Perl_deb(aTHX_ "(Found loop #%ld)\n", (long)i)); @@ -1397,6 +1399,7 @@ S_dopoptogiven(pTHX_ I32 startingblock) case CXt_LOOP_PLAIN: assert(!CxFOREACHDEF(cx)); break; + case CXt_LOOP_STACK: case CXt_LOOP_FOR: if (CxFOREACHDEF(cx)) { DEBUG_l( Perl_deb(aTHX_ "(Found foreach #%ld)\n", (long)i)); @@ -1448,6 +1451,7 @@ Perl_dounwind(pTHX_ I32 cxix) case CXt_EVAL: POPEVAL(cx); break; + case CXt_LOOP_STACK: case CXt_LOOP_FOR: case CXt_LOOP_PLAIN: POPLOOP(cx); @@ -1827,7 +1831,7 @@ PP(pp_enteriter) register PERL_CONTEXT *cx; const I32 gimme = GIMME_V; SV **svp; - U16 cxtype = CXt_LOOP_FOR; + U16 cxtype = 0; #ifdef USE_ITHREADS void *iterdata; #endif @@ -1865,6 +1869,7 @@ PP(pp_enteriter) ENTER; + cxtype |= (PL_op->op_flags & OPf_STACKED) ? CXt_LOOP_FOR : CXt_LOOP_STACK; PUSHBLOCK(cx, cxtype, SP); #ifdef USE_ITHREADS PUSHLOOP_FOR(cx, iterdata, MARK); @@ -1919,7 +1924,7 @@ PP(pp_enteriter) } } else { - cx->blk_loop.iterary = PL_curstack; + cx->blk_loop.iterary = (SV*)0xDEADBEEF; if (PL_op->op_private & OPpITER_REVERSED) { cx->blk_loop.itermax = MARK - PL_stack_base + 1; cx->blk_loop.iterix = cx->blk_oldsp + 1; @@ -2145,6 +2150,7 @@ PP(pp_last) cxstack_ix++; /* temporarily protect top context */ mark = newsp; switch (CxTYPE(cx)) { + case CXt_LOOP_STACK: case CXt_LOOP_FOR: case CXt_LOOP_PLAIN: pop2 = CxTYPE(cx); @@ -2190,6 +2196,7 @@ PP(pp_last) /* Stack values are safe: */ switch (pop2) { case CXt_LOOP_PLAIN: + case CXt_LOOP_STACK: case CXt_LOOP_FOR: POPLOOP(cx); /* release loop vars ... */ LEAVE; @@ -2548,6 +2555,7 @@ PP(pp_goto) break; } /* else fall through */ + case CXt_LOOP_STACK: case CXt_LOOP_FOR: case CXt_LOOP_PLAIN: gotoprobe = cx->blk_oldcop->op_sibling; |