Change 29906 by [EMAIL PROTECTED] on 2007/01/21 12:16:40
Integrate:
[ 27306]
Replace usage of GvSTASH for storing the stash of C<our> with
OURSTASH. Set the stash with OURSTASH_SET.
[ 29633]
With PAD_COMPNAME_GEN in SvUVX, SvCUR is trustworthy once more.
[just the pad.h changes]
[ 29679]
Rename OURSTASH to SvOURSTASH and OURSTASH_set to SvOURSTASH_set.
Affected files ...
... //depot/maint-5.8/perl/dump.c#62 integrate
... //depot/maint-5.8/perl/pad.c#60 edit
... //depot/maint-5.8/perl/pad.h#15 integrate
... //depot/maint-5.8/perl/sv.c#297 integrate
... //depot/maint-5.8/perl/sv.h#69 integrate
Differences ...
==== //depot/maint-5.8/perl/pad.c#60 (text) ====
Index: perl/pad.c
--- perl/pad.c#59~29903~ 2007-01-20 16:16:12.000000000 -0800
+++ perl/pad.c 2007-01-21 04:16:40.000000000 -0800
@@ -71,12 +71,13 @@
in PL_op->op_targ), wasting a name SV for them doesn't make sense.
The SVs in the names AV have their PV being the name of the variable.
-NV+1..IV inclusive is a range of cop_seq numbers for which the name is
-valid. For typed lexicals name SV is SVt_PVMG and SvSTASH points at the
-type. For C<our> lexicals, the type is SVt_PVGV, and GvSTASH points at the
-stash of the associated global (so that duplicate C<our> declarations in the
-same package can be detected). SvCUR is sometimes hijacked to
-store the generation number during compilation.
+NV+1..IV inclusive is a range of cop_seq numbers for which the name is valid.
+For typed lexicals name SV is SVt_PVMG and SvSTASH points at the type. For
+C<our> lexicals, the type is SVt_PVGV, and SvOURSTASH points at the stash of
+the associated global (so that duplicate C<our> declarations in the same
+package can be detected)(In 5.8.x and earlier SvOURSTASH is an alias for
+GvSTASH). SvCUR is sometimes hijacked to store the generation number during
+compilation.
If SvFAKE is set on the name SV then slot in the frame AVs are
a REFCNT'ed references to a lexical from "outside". In this case,
@@ -312,7 +313,7 @@
If C<typestash> is valid, the name is for a typed lexical; set the
name's stash to that value.
If C<ourstash> is valid, it's an our lexical, set the name's
-GvSTASH to that value
+SvOURSTASH to that value
Also, if the name is @.. or %.., create a new array or hash for that slot
@@ -352,7 +353,8 @@
}
if (ourstash) {
SvPAD_OUR_on(namesv);
- GvSTASH(namesv) = (HV*)SvREFCNT_inc_simple_NN((SV*) ourstash);
+ (HV*)SvREFCNT_inc_simple_NN((SV*) ourstash);
+ SvOURSTASH_set(namesv, ourstash);
}
av_store(PL_comppad_name, offset, namesv);
@@ -541,7 +543,7 @@
&& sv != &PL_sv_undef
&& !SvFAKE(sv)
&& (SvIVX(sv) == PAD_MAX || SvIVX(sv) == 0)
- && ((SvPAD_OUR(sv)) && GvSTASH(sv) == ourstash)
+ && SvOURSTASH(sv) == ourstash
&& strEQ(name, SvPVX_const(sv)))
{
Perl_warner(aTHX_ packWARN(WARN_MISC),
==== //depot/maint-5.8/perl/pad.h#15 (text) ====
Index: perl/pad.h
--- perl/pad.h#14~29903~ 2007-01-20 16:16:12.000000000 -0800
+++ perl/pad.h 2007-01-21 04:16:40.000000000 -0800
@@ -218,14 +218,15 @@
*/
-#define PAD_COMPNAME_FLAGS(po) SvFLAGS(*av_fetch(PL_comppad_name, (po), FALSE))
+#define PAD_COMPNAME_SV(po) (*av_fetch(PL_comppad_name, (po), FALSE))
+#define PAD_COMPNAME_FLAGS(po) SvFLAGS(PAD_COMPNAME_SV(po))
#define PAD_COMPNAME_FLAGS_isOUR(po) (PAD_COMPNAME_FLAGS(po) & SVpad_OUR)
-#define PAD_COMPNAME_PV(po) SvPV_nolen(*av_fetch(PL_comppad_name, (po), FALSE))
+#define PAD_COMPNAME_PV(po) SvPV_nolen(PAD_COMPNAME_SV(po))
#define PAD_COMPNAME_TYPE(po) pad_compname_type(po)
#define PAD_COMPNAME_OURSTASH(po) \
- (GvSTASH(*av_fetch(PL_comppad_name, (po), FALSE)))
+ (SvOURSTASH(PAD_COMPNAME_SV(po)))
#define PAD_COMPNAME_GEN(po) SvCUR(AvARRAY(PL_comppad_name)[po])
==== //depot/maint-5.8/perl/sv.h#69 (text) ====
Index: perl/sv.h
--- perl/sv.h#68~29903~ 2007-01-20 16:16:12.000000000 -0800
+++ perl/sv.h 2007-01-21 04:16:40.000000000 -0800
@@ -900,6 +900,13 @@
#define SvPAD_OUR_on(sv) (SvFLAGS(sv) |= SVpad_OUR)
#define SvPAD_OUR_off(sv) (SvFLAGS(sv) &= ~SVpad_OUR)
+#define SvOURSTASH(sv) (SvPAD_OUR(sv) ? GvSTASH(sv) : NULL)
+#define SvOURSTASH_set(sv, st) \
+ STMT_START { \
+ assert(SvTYPE(sv) == SVt_PVGV); \
+ GvSTASH(sv) = st; \
+ } STMT_END
+
#define SvRV(sv) ((XRV*) SvANY(sv))->xrv_rv
#define SvRVx(sv) SvRV(sv)
End of Patch.