#define CvROOT(sv) ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_root_u.xcv_root
#define CvXSUB(sv) ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_root_u.xcv_xsub
#define CvXSUBANY(sv) ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_start_u.xcv_xsubany
-#define CvGV(sv) ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_gv
+#define CvGV(sv) (0+((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_gv)
+#define CvGV_set(cv,gv) Perl_cvgv_set(aTHX_ cv, gv)
#define CvFILE(sv) ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_file
#ifdef USE_ITHREADS
# define CvFILE_set_from_cop(sv, cop) (CvFILE(sv) = savepv(CopFILE(cop)))
}
}
- CvGV(cv) = gv;
+ SvANY(cv)->xcv_gv = gv;
assert(!CvCVGV_RC(cv));
if (!gv)
LEAVE;
mro_method_changed_in(GvSTASH(gv)); /* sub Foo::bar($) { (shift) } sub ASDF::baz($); *ASDF::baz = \&Foo::bar */
- cvgv_set(cv, gv);
+ CvGV_set(cv, gv);
CvFILE_set_from_cop(cv, PL_curcop);
CvSTASH(cv) = PL_curstash;
if (PL_curstash)
LEAVE;
}
SvPOK_off(MUTABLE_SV(cv)); /* forget prototype */
- cvgv_set(cv, NULL);
+ CvGV_set(cv, NULL);
pad_undef(cv);
}
}
if (!CvGV(cv)) {
- cvgv_set(cv, gv);
+ CvGV_set(cv, gv);
CvFILE_set_from_cop(cv, PL_curcop);
CvSTASH(cv) = PL_curstash;
if (PL_curstash)
}
if (!name)
CvANON_on(cv);
- cvgv_set(cv, gv);
+ CvGV_set(cv, gv);
(void)gv_fetchfile(filename);
CvFILE(cv) = (char *)filename; /* NOTE: not copied, as it is expected to be
an external constant string */
}
cv = PL_compcv;
GvFORM(gv) = cv;
- cvgv_set(cv, gv);
+ CvGV_set(cv, gv);
CvFILE_set_from_cop(cv, PL_curcop);
#else
CvFILE(cv) = CvFILE(proto);
#endif
- cvgv_set(cv,CvGV(proto));
+ CvGV_set(cv,CvGV(proto));
CvSTASH(cv) = CvSTASH(proto);
if (CvSTASH(cv))
Perl_sv_add_backref(aTHX_ MUTABLE_SV(CvSTASH(cv)), MUTABLE_SV(cv));
/* let user-undef'd sub keep its identity */
GV* const gv = CvGV((const CV *)sv);
cv_undef(MUTABLE_CV(sv));
- cvgv_set(MUTABLE_CV(sv), gv);
+ CvGV_set(MUTABLE_CV(sv), gv);
}
break;
case SVt_PVGV:
/* will the CV shortly be freed by gp_free() ? */
if (GvCV(gv) == cv && GvGP(gv)->gp_refcnt < 2 && SvREFCNT(cv) < 2) {
- CvGV(cv) = NULL;
+ SvANY(cv)->xcv_gv = NULL;
return;
}
CvANON_on(cv);
CvCVGV_RC_on(cv);
- CvGV(cv) = MUTABLE_GV(SvREFCNT_inc(anongv));
+ SvANY(cv)->xcv_gv = MUTABLE_GV(SvREFCNT_inc(anongv));
}
}
/* don't dup if copying back - CvGV isn't refcounted, so the
* duped GV may never be freed. A bit of a hack! DAPM */
- CvGV(dstr) =
+ SvANY(MUTABLE_CV(dstr))->xcv_gv =
CvCVGV_RC(dstr)
? gv_dup_inc(CvGV(sstr), param)
: (param->flags & CLONEf_JOIN_IN)