Change 18410 by [EMAIL PROTECTED] on 2003/01/03 11:06:40
Subject: new flag SvPADSTALE
From: Dave Mitchell <[EMAIL PROTECTED]>
Date: Thu, 19 Dec 2002 19:00:21 +0000
Message-ID: <[EMAIL PROTECTED]>
Affected files ...
... //depot/perl/dump.c#130 edit
... //depot/perl/scope.c#106 edit
... //depot/perl/sv.h#129 edit
Differences ...
==== //depot/perl/dump.c#130 (text) ====
Index: perl/dump.c
--- perl/dump.c#129~18409~ Fri Jan 3 03:05:09 2003
+++ perl/dump.c Fri Jan 3 03:06:40 2003
@@ -942,6 +942,7 @@
(int)(PL_dumpindent*level), "", (IV)SvREFCNT(sv),
(int)(PL_dumpindent*level), "");
+ if (flags & SVs_PADSTALE) sv_catpv(d, "PADSTALE,");
if (flags & SVs_PADTMP) sv_catpv(d, "PADTMP,");
if (flags & SVs_PADMY) sv_catpv(d, "PADMY,");
if (flags & SVs_TEMP) sv_catpv(d, "TEMP,");
==== //depot/perl/scope.c#106 (text) ====
Index: perl/scope.c
--- perl/scope.c#105~18409~ Fri Jan 3 03:05:09 2003
+++ perl/scope.c Fri Jan 3 03:06:40 2003
@@ -548,6 +548,7 @@
SSCHECK(2);
SSPUSHLONG((long)(svp-PL_curpad));
SSPUSHINT(SAVEt_CLEARSV);
+ SvPADSTALE_off(*svp); /* mark lexical as active */
}
void
@@ -918,6 +919,7 @@
(void)SvOOK_off(sv);
break;
}
+ SvPADSTALE_on(sv); /* mark as no longer live */
}
else { /* Someone has a claim on this, so abandon it. */
U32 padflags = SvFLAGS(sv) & (SVs_PADMY|SVs_PADTMP);
@@ -927,7 +929,9 @@
default: *(SV**)ptr = NEWSV(0,0); break;
}
SvREFCNT_dec(sv); /* Cast current value to the winds. */
- SvFLAGS(*(SV**)ptr) |= padflags; /* preserve pad nature */
+ /* preserve pad nature, but also mark as not live
+ * for any closure capturing */
+ SvFLAGS(*(SV**)ptr) |= padflags & SVs_PADSTALE;
}
break;
case SAVEt_DELETE:
==== //depot/perl/sv.h#129 (text) ====
Index: perl/sv.h
--- perl/sv.h#128~18409~ Fri Jan 3 03:05:09 2003
+++ perl/sv.h Fri Jan 3 03:06:40 2003
@@ -148,7 +148,7 @@
#define SvUPGRADE(sv, mt) (SvTYPE(sv) >= mt || sv_upgrade(sv, mt))
-/* XXX spare */
+#define SVs_PADSTALE 0x00000100 /* lexical has gone out of scope */
#define SVs_PADTMP 0x00000200 /* in use as tmp */
#define SVs_PADMY 0x00000400 /* in use a "my" variable */
#define SVs_TEMP 0x00000800 /* string is stealable? */
@@ -636,6 +636,10 @@
#define SvWEAKREF_off(sv) (SvFLAGS(sv) &= ~(SVf_ROK|SVprv_WEAKREF))
#define SvTHINKFIRST(sv) (SvFLAGS(sv) & SVf_THINKFIRST)
+
+#define SvPADSTALE(sv) (SvFLAGS(sv) & SVs_PADSTALE)
+#define SvPADSTALE_on(sv) (SvFLAGS(sv) |= SVs_PADSTALE)
+#define SvPADSTALE_off(sv) (SvFLAGS(sv) &= ~SVs_PADSTALE)
#define SvPADTMP(sv) (SvFLAGS(sv) & SVs_PADTMP)
#define SvPADTMP_on(sv) (SvFLAGS(sv) |= SVs_PADTMP)
End of Patch.