Change 29565 by [EMAIL PROTECTED] on 2006/12/16 16:54:06
Split out the use of SVp_SCREAM for GVs with GPs into a new symbolic
flag SVpgv_GP, and use this in isGV_with_GP_on/off.
Affected files ...
... //depot/perl/dump.c#242 edit
... //depot/perl/ext/Devel/Peek/t/Peek.t#25 edit
... //depot/perl/gv.c#336 edit
... //depot/perl/mg.c#466 edit
... //depot/perl/sv.c#1336 edit
... //depot/perl/sv.h#305 edit
Differences ...
==== //depot/perl/dump.c#242 (text) ====
Index: perl/dump.c
--- perl/dump.c#241~29548~ 2006-12-13 09:16:22.000000000 -0800
+++ perl/dump.c 2006-12-16 08:54:06.000000000 -0800
@@ -1385,7 +1385,7 @@
if (flags & SVp_IOK) sv_catpv(d, "pIOK,");
if (flags & SVp_NOK) sv_catpv(d, "pNOK,");
if (flags & SVp_POK) sv_catpv(d, "pPOK,");
- if (flags & SVp_SCREAM && type != SVt_PVHV)
+ if (flags & SVp_SCREAM && type != SVt_PVHV && !isGV_with_GP(sv))
sv_catpv(d, "SCREAM,");
switch (type) {
==== //depot/perl/ext/Devel/Peek/t/Peek.t#25 (text) ====
Index: perl/ext/Devel/Peek/t/Peek.t
--- perl/ext/Devel/Peek/t/Peek.t#24~29056~ 2006-10-19 13:47:53.000000000
-0700
+++ perl/ext/Devel/Peek/t/Peek.t 2006-12-16 08:54:06.000000000 -0800
@@ -305,7 +305,7 @@
*a,
'SV = PVGV\\($ADDR\\) at $ADDR
REFCNT = 5
- FLAGS = \\(SCREAM,MULTI(?:,IN_PAD)?\\)
+ FLAGS = \\(MULTI(?:,IN_PAD)?\\)
NAME = "a"
NAMELEN = 1
GvSTASH = $ADDR\\t"main"
==== //depot/perl/gv.c#336 (text) ====
Index: perl/gv.c
--- perl/gv.c#335~29203~ 2006-11-04 10:56:33.000000000 -0800
+++ perl/gv.c 2006-12-16 08:54:06.000000000 -0800
@@ -224,7 +224,8 @@
} else
Safefree(SvPVX_mutable(gv));
}
- SvSCREAM_on(gv);
+ SvIOK_off(gv);
+ isGV_with_GP_on(gv);
GvGP(gv) = Perl_newGP(aTHX_ gv);
GvSTASH(gv) = stash;
@@ -234,7 +235,6 @@
if (multi || doproto) /* doproto means it _was_ mentioned */
GvMULTI_on(gv);
if (doproto) { /* Replicate part of newSUB here. */
- SvIOK_off(gv);
ENTER;
if (has_constant) {
/* newCONSTSUB takes ownership of the reference from us. */
==== //depot/perl/mg.c#466 (text) ====
Index: perl/mg.c
--- perl/mg.c#465~29541~ 2006-12-12 15:02:56.000000000 -0800
+++ perl/mg.c 2006-12-16 08:54:06.000000000 -0800
@@ -1897,8 +1897,7 @@
if (!SvOK(sv))
return 0;
- if (SvFLAGS(sv) & SVp_SCREAM
- && (SvTYPE(sv) == SVt_PVGV || SvTYPE(sv) == SVt_PVGV)) {
+ if (isGV_with_GP(sv)) {
/* We're actually already a typeglob, so don't need the stuff below.
*/
return 0;
==== //depot/perl/sv.c#1336 (text) ====
Index: perl/sv.c
--- perl/sv.c#1335~29544~ 2006-12-13 00:35:43.000000000 -0800
+++ perl/sv.c 2006-12-16 08:54:06.000000000 -0800
@@ -3177,7 +3177,9 @@
}
sv_upgrade(dstr, SVt_PVGV);
(void)SvOK_off(dstr);
- SvSCREAM_on(dstr);
+ /* FIXME - why are we doing this, then turning it off and on again
+ below? */
+ isGV_with_GP_on(dstr);
}
GvSTASH(dstr) = GvSTASH(sstr);
if (GvSTASH(dstr))
@@ -3193,9 +3195,9 @@
#endif
gp_free((GV*)dstr);
- SvSCREAM_off(dstr);
+ isGV_with_GP_off(dstr);
(void)SvOK_off(dstr);
- SvSCREAM_on(dstr);
+ isGV_with_GP_on(dstr);
GvINTRO_off(dstr); /* one-shot flag */
GvGP(dstr) = gp_ref(GvGP(sstr));
if (SvTAINTED(sstr))
@@ -7946,7 +7948,7 @@
if (GvNAME_HEK(sv)) {
unshare_hek(GvNAME_HEK(sv));
}
- SvSCREAM_off(sv);
+ isGV_with_GP_off(sv);
/* need to keep SvANY(sv) in the right arena */
xpvmg = new_XPVMG();
==== //depot/perl/sv.h#305 (text) ====
Index: perl/sv.h
--- perl/sv.h#304~29559~ 2006-12-15 12:14:07.000000000 -0800
+++ perl/sv.h 2006-12-16 08:54:06.000000000 -0800
@@ -292,7 +292,8 @@
#define SVp_NOK 0x00002000 /* has valid non-public numeric
value */
#define SVp_POK 0x00004000 /* has valid non-public pointer
value */
#define SVp_SCREAM 0x00008000 /* has been studied? */
-#define SVphv_CLONEABLE 0x00008000 /* PVHV (stashes) clone its objects
*/
+#define SVphv_CLONEABLE SVp_SCREAM /* PVHV (stashes) clone its objects
*/
+#define SVpgv_GP SVp_SCREAM /* GV has a valid GP */
#define SVs_PADSTALE 0x00010000 /* lexical has gone out of scope */
#define SVpad_STATE 0x00010000 /* pad name is a "state" var */
@@ -335,7 +336,7 @@
#define SVf_THINKFIRST (SVf_READONLY|SVf_ROK|SVf_FAKE)
#define SVf_OK (SVf_IOK|SVf_NOK|SVf_POK|SVf_ROK| \
- SVp_IOK|SVp_NOK|SVp_POK|SVp_SCREAM)
+ SVp_IOK|SVp_NOK|SVp_POK|SVpgv_GP)
#define PRIVSHIFT 4 /* (SVp_?OK >> PRIVSHIFT) == SVf_?OK */
@@ -1974,8 +1975,23 @@
/* If I give every macro argument a different name, then there won't be bugs
where nested macros get confused. Been there, done that. */
#define isGV_with_GP(pwadak) \
- (((SvFLAGS(pwadak) & (SVp_POK|SVp_SCREAM)) == SVp_SCREAM) \
+ (((SvFLAGS(pwadak) & (SVp_POK|SVpgv_GP)) == SVpgv_GP) \
&& (SvTYPE(pwadak) == SVt_PVGV || SvTYPE(pwadak) == SVt_PVLV))
+#define isGV_with_GP_on(sv) STMT_START { \
+ GV *const uggh = (GV*) sv; \
+ assert (SvTYPE(uggh) == SVt_PVGV || SvTYPE(uggh) == SVt_PVLV); \
+ assert (!SvPOKp(uggh)); \
+ assert (!SvIOKp(uggh)); \
+ (SvFLAGS(uggh) |= SVpgv_GP); \
+ } STMT_END
+#define isGV_with_GP_off(sv) STMT_START { \
+ GV *const uggh = (GV *) sv; \
+ assert (SvTYPE(uggh) == SVt_PVGV || SvTYPE(uggh) == SVt_PVLV); \
+ assert (!SvPOKp(uggh)); \
+ assert (!SvIOKp(uggh)); \
+ (SvFLAGS(sv) &= ~SVpgv_GP); \
+ } STMT_END
+
#define SvGROW(sv,len) (SvLEN(sv) < (len) ? sv_grow(sv,len) : SvPVX(sv))
#define SvGROW_mutable(sv,len) \
End of Patch.