Change 34493 by [EMAIL PROTECTED] on 2008/10/16 18:44:37
Integrate:
[ 33076]
As itersave points to the initial CxITERVAR(), and the state of
SvPADMY() does not change over the duration of the scope, we can
perform conditional actions at loop push time. For the non-pad case,
a reference to the initial CxITERVAR() is already held on the scope
stack thanks to SAVEGENERICSV(*svp); in pp_enteriter. So there is no
need to save another reference to it in itersave - it's not going away.
Affected files ...
... //depot/maint-5.10/perl/cop.h#8 integrate
Differences ...
==== //depot/maint-5.10/perl/cop.h#8 (text) ====
Index: perl/cop.h
--- perl/cop.h#7~34492~ 2008-10-16 11:08:52.000000000 -0700
+++ perl/cop.h 2008-10-16 11:44:37.000000000 -0700
@@ -465,14 +465,15 @@
: (SV**)NULL)
# define CX_ITERDATA_SET(cx,idata) \
CX_CURPAD_SAVE(cx->blk_loop); \
- if ((cx->blk_loop.iterdata = (idata))) \
+ if ((cx->blk_loop.iterdata = (idata)) && SvPADMY(*CxITERVAR(cx))) \
cx->blk_loop.itersave = SvREFCNT_inc(*CxITERVAR(cx)); \
else \
cx->blk_loop.itersave = NULL;
#else
# define CxITERVAR(c) ((c)->blk_loop.itervar)
# define CX_ITERDATA_SET(cx,ivar) \
- if ((cx->blk_loop.itervar = (SV**)(ivar))) \
+ if ((cx->blk_loop.itervar = (SV**)(ivar)) \
+ && SvPADMY(*CxITERVAR(cx))) \
cx->blk_loop.itersave = SvREFCNT_inc(*CxITERVAR(cx)); \
else \
cx->blk_loop.itersave = NULL;
@@ -502,14 +503,10 @@
#define POPLOOP(cx) \
SvREFCNT_dec(cx->blk_loop.iterlval); \
if (cx->blk_loop.itersave) { \
- if (SvPADMY(cx->blk_loop.itersave)) { \
- SV ** const s_v_p = CxITERVAR(cx); \
- sv_2mortal(*s_v_p); \
- *s_v_p = cx->blk_loop.itersave; \
- } \
- else { \
- SvREFCNT_dec(cx->blk_loop.itersave); \
- } \
+ SV ** const s_v_p = CxITERVAR(cx); \
+ assert(SvPADMY(cx->blk_loop.itersave)); \
+ sv_2mortal(*s_v_p); \
+ *s_v_p = cx->blk_loop.itersave; \
} \
if (cx->blk_loop.iterary && cx->blk_loop.iterary != PL_curstack)\
SvREFCNT_dec(cx->blk_loop.iterary);
End of Patch.