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.
+type. For C<our> lexicals, the type is also SVt_PVGV, with the MAGIC slot
+pointing 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.
If SvFAKE is set on the name SV, then that slot in the frame AV is
a REFCNT'ed reference to a lexical from "outside". In this case,
ASSERT_CURPAD_ACTIVE("pad_add_name");
- sv_upgrade(namesv, ourstash ? SVt_PVGV : typestash ? SVt_PVMG : SVt_PVNV);
+ sv_upgrade(namesv, (ourstash || typestash) ? SVt_PVMG : SVt_PVNV);
sv_setpv(namesv, name);
if (typestash) {
FIXME - instrument and check that assumption */
if (sv_type >= SVt_PVMG) {
HV *ourstash;
- if ((sv_type == SVt_PVMG || sv_type == SVt_PVGV) &&
- (ourstash = OURSTASH(dstr))) {
+ if ((sv_type == SVt_PVMG) && (ourstash = OURSTASH(dstr))) {
OURSTASH_set(dstr, hv_dup_inc(ourstash, param));
} else if (SvMAGIC(dstr))
SvMAGIC_set(dstr, mg_dup(SvMAGIC(dstr), param));
(SvPAD_OUR(sv) ? ((XPVMG*) SvANY(sv))->xmg_u.xmg_ourstash : NULL)
#define OURSTASH_set(sv, st) \
STMT_START { \
- assert(SvTYPE(sv) == SVt_PVGV); \
+ assert(SvTYPE(sv) == SVt_PVMG); \
((XPVMG*) SvANY(sv))->xmg_u.xmg_ourstash = st; \
} STMT_END