summaryrefslogtreecommitdiff
path: root/cop.h
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2008-01-26 17:54:29 +0000
committerNicholas Clark <nick@ccl4.org>2008-01-26 17:54:29 +0000
commit09edbca0f5c7caf9dd4acef80d8e6275e5a95ea1 (patch)
treee0dc9093a93c63c250e26059deebe7f51400a7ca /cop.h
parentdceb5f6256f15f796b36d673cf34f57b7feb1127 (diff)
downloadperl-09edbca0f5c7caf9dd4acef80d8e6275e5a95ea1.tar.gz
Investigation reveals that the work of restoring the iterator to the
pad is shared between POPLOOP, using itersave, and the end of scope restore action requested by Perl_save_padsv(). In fact, the only user of SAVEt_PADSV is pp_enteriter, and it already provides enough information to allow it to perform the sv_2mortal() in POPLOOP. So make it do so. Rather than creating a new routine, use the existing routine because nothing else (at least nothing else known to Google's codesearch) uses it. But rename it just in case something we can't see is being naughty and using our private functions - they will get link errors against 5.12. All this means that itersave is now redundant. So remove it. This makes struct context 48 bytes on ILP32 platforms with 32bit IVs, down from 64 bytes in 5.10. 33% more context stack in the same memory. p4raw-id: //depot/perl@33080
Diffstat (limited to 'cop.h')
-rw-r--r--cop.h18
1 files changed, 2 insertions, 16 deletions
diff --git a/cop.h b/cop.h
index ca9dae286e..4af6b8f74c 100644
--- a/cop.h
+++ b/cop.h
@@ -442,7 +442,6 @@ struct block_loop {
OP * next_op;
SV ** itervar;
#endif
- SV * itersave;
union {
struct { /* valid if type is LOOP_FOR or LOOP_PLAIN (but {NULL,0})*/
AV * ary; /* use the stack if this is NULL */
@@ -469,18 +468,11 @@ struct block_loop {
: (SV**)NULL)
# define CX_ITERDATA_SET(cx,idata) \
CX_CURPAD_SAVE(cx->blk_loop); \
- if ((cx->blk_loop.iterdata = (idata)) && SvPADMY(*CxITERVAR(cx))) \
- cx->blk_loop.itersave = SvREFCNT_inc(*CxITERVAR(cx)); \
- else \
- cx->blk_loop.itersave = NULL;
+ cx->blk_loop.iterdata = (idata);
#else
# define CxITERVAR(c) ((c)->blk_loop.itervar)
# define CX_ITERDATA_SET(cx,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;
+ cx->blk_loop.itervar = (SV**)(ivar);
#endif
#define CxLABEL(c) (0 + (c)->blk_oldcop->cop_label)
#define CxHASARGS(c) (((c)->cx_type & CXp_HASARGS) == CXp_HASARGS)
@@ -515,12 +507,6 @@ struct block_loop {
SvREFCNT_dec(cx->blk_loop.state_u.lazysv.cur); \
SvREFCNT_dec(cx->blk_loop.state_u.lazysv.end); \
} \
- if (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 (CxTYPE(cx) == CXt_LOOP_FOR) \
SvREFCNT_dec(cx->blk_loop.state_u.ary.ary);