assert that it isn't using cx->blk_loop.iterlval.
Fix a casting bug when assigning a sentinal to cx->blk_loop.iterary.
p4raw-id: //depot/perl@33061
CX_ITERDATA_SET(cx,dat);
#define POPLOOP(cx) \
+ if (CxTYPE(cx) == CXt_LOOP_LAZYIV) \
+ assert(!cx->blk_loop.iterlval); \
SvREFCNT_dec(cx->blk_loop.iterlval); \
if (CxITERVAR(cx)) { \
if (SvPADMY(cx->blk_loop.itersave)) { \
#define CXt_BLOCK 5
#define CXt_FORMAT 6
#define CXt_GIVEN 7
-#define CXt_LOOP_PLAIN 8
-#define CXt_LOOP_FOR 9
+/* This is first so that CXt_LOOP_FOR|CXt_LOOP_LAZYIV is CXt_LOOP_LAZYIV */
+#define CXt_LOOP_FOR 8
+#define CXt_LOOP_PLAIN 9
/* Foreach on a temporary list on the stack */
#define CXt_LOOP_STACK 10
-#define CXt_LOOP_RES2 11
+#define CXt_LOOP_LAZYIV 11
/* private flags for CXt_SUB and CXt_NULL
However, this is checked in many places which do not check the type, so
if (CxTYPE(cx) == CXt_NULL)
return -1;
break;
+ case CXt_LOOP_LAZYIV:
case CXt_LOOP_STACK:
case CXt_LOOP_FOR:
case CXt_LOOP_PLAIN:
if ((CxTYPE(cx)) == CXt_NULL)
return -1;
break;
+ case CXt_LOOP_LAZYIV:
case CXt_LOOP_STACK:
case CXt_LOOP_FOR:
case CXt_LOOP_PLAIN:
case CXt_LOOP_PLAIN:
assert(!CxFOREACHDEF(cx));
break;
+ case CXt_LOOP_LAZYIV:
case CXt_LOOP_STACK:
case CXt_LOOP_FOR:
if (CxFOREACHDEF(cx)) {
case CXt_EVAL:
POPEVAL(cx);
break;
+ case CXt_LOOP_LAZYIV:
case CXt_LOOP_STACK:
case CXt_LOOP_FOR:
case CXt_LOOP_PLAIN:
SvGETMAGIC(sv);
SvGETMAGIC(right);
if (RANGE_IS_NUMERIC(sv,right)) {
+ cx->cx_type |= CXt_LOOP_LAZYIV;
+ /* Make sure that no-one re-orders cop.h and breaks our
+ assumptions */
+ assert(CxTYPE(cx) == CXt_LOOP_LAZYIV);
#ifdef NV_PRESERVES_UV
if ((SvOK(sv) && ((SvNV(sv) < (NV)IV_MIN) ||
(SvNV(sv) > (NV)IV_MAX)))
}
}
else {
- cx->blk_loop.iterary = (SV*)0xDEADBEEF;
+ cx->blk_loop.iterary = (AV*)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;
cxstack_ix++; /* temporarily protect top context */
mark = newsp;
switch (CxTYPE(cx)) {
+ case CXt_LOOP_LAZYIV:
case CXt_LOOP_STACK:
case CXt_LOOP_FOR:
case CXt_LOOP_PLAIN:
cxstack_ix--;
/* Stack values are safe: */
switch (pop2) {
+ case CXt_LOOP_LAZYIV:
case CXt_LOOP_PLAIN:
case CXt_LOOP_STACK:
case CXt_LOOP_FOR:
break;
}
/* else fall through */
+ case CXt_LOOP_LAZYIV:
case CXt_LOOP_STACK:
case CXt_LOOP_FOR:
case CXt_LOOP_PLAIN:
av = CxTYPE(cx) == CXt_LOOP_STACK ? PL_curstack : cx->blk_loop.iterary;
if (SvTYPE(av) != SVt_PVAV) {
/* iterate ($min .. $max) */
- if (cx->blk_loop.iterlval) {
+ if (CxTYPE(cx) != CXt_LOOP_LAZYIV) {
/* string increment */
register SV* cur = cx->blk_loop.iterlval;
STRLEN maxlen = 0;
RETPUSHNO;
}
/* integer increment */
+ assert(!cx->blk_loop.iterlval);
if (cx->blk_loop.iterix > cx->blk_loop.itermax)
RETPUSHNO;
PTR2UV(cx->blk_eval.retop));
break;
+ case CXt_LOOP_LAZYIV:
+ case CXt_LOOP_STACK:
case CXt_LOOP_FOR:
case CXt_LOOP_PLAIN:
PerlIO_printf(Perl_debug_log, "BLK_LOOP.LABEL = %s\n", CxLABEL(cx));
param);
ncx->blk_eval.cur_text = sv_dup(ncx->blk_eval.cur_text, param);
break;
+ case CXt_LOOP_LAZYIV:
case CXt_LOOP_FOR:
ncx->blk_loop.iterary = av_dup_inc(ncx->blk_loop.iterary,
param);