diff options
-rw-r--r-- | gv.c | 17 | ||||
-rw-r--r-- | gv.h | 15 | ||||
-rw-r--r-- | op.c | 12 | ||||
-rw-r--r-- | pp.c | 2 | ||||
-rw-r--r-- | scope.c | 4 | ||||
-rw-r--r-- | sv.c | 14 |
6 files changed, 36 insertions, 28 deletions
@@ -298,7 +298,7 @@ Perl_gv_init(pTHX_ GV *gv, HV *stash, const char *name, STRLEN len, int multi) SvIOK_off(gv); isGV_with_GP_on(gv); - GvGP(gv) = Perl_newGP(aTHX_ gv); + GvGP_set(gv, Perl_newGP(aTHX_ gv)); GvSTASH(gv) = stash; if (stash) Perl_sv_add_backref(aTHX_ MUTABLE_SV(stash), MUTABLE_SV(gv)); @@ -319,7 +319,7 @@ Perl_gv_init(pTHX_ GV *gv, HV *stash, const char *name, STRLEN len, int multi) cv = newCONSTSUB(stash, (name0 ? name0 : name), has_constant); /* In case op.c:S_process_special_blocks stole it: */ if (!GvCV(gv)) - GvCV(gv) = (CV *)SvREFCNT_inc_simple_NN(cv); + GvCV_set(gv, (CV *)SvREFCNT_inc_simple_NN(cv)); assert(GvCV(gv) == cv); /* newCONSTSUB should have set this */ if (name0) Safefree(name0); @@ -331,7 +331,7 @@ Perl_gv_init(pTHX_ GV *gv, HV *stash, const char *name, STRLEN len, int multi) } else { (void) start_subparse(0,0); /* Create empty CV in compcv. */ cv = PL_compcv; - GvCV(gv) = cv; + GvCV_set(gv,cv); } LEAVE; @@ -456,7 +456,8 @@ Perl_gv_fetchmeth(pTHX_ HV *stash, const char *name, STRLEN len, I32 level) else { /* stale cache entry, junk it and move on */ SvREFCNT_dec(cand_cv); - GvCV(topgv) = cand_cv = NULL; + GvCV_set(topgv, NULL); + cand_cv = NULL; GvCVGEN(topgv) = 0; } } @@ -506,7 +507,7 @@ Perl_gv_fetchmeth(pTHX_ HV *stash, const char *name, STRLEN len, I32 level) if (topgv && (GvREFCNT(topgv) == 1) && (CvROOT(cand_cv) || CvXSUB(cand_cv))) { if ((old_cv = GvCV(topgv))) SvREFCNT_dec(old_cv); SvREFCNT_inc_simple_void_NN(cand_cv); - GvCV(topgv) = cand_cv; + GvCV_set(topgv, cand_cv); GvCVGEN(topgv) = topgen_cmp; } return candidate; @@ -521,7 +522,7 @@ Perl_gv_fetchmeth(pTHX_ HV *stash, const char *name, STRLEN len, I32 level) if (topgv && (GvREFCNT(topgv) == 1) && (CvROOT(cand_cv) || CvXSUB(cand_cv))) { if ((old_cv = GvCV(topgv))) SvREFCNT_dec(old_cv); SvREFCNT_inc_simple_void_NN(cand_cv); - GvCV(topgv) = cand_cv; + GvCV_set(topgv, cand_cv); GvCVGEN(topgv) = topgen_cmp; } return candidate; @@ -1705,7 +1706,7 @@ Perl_gp_free(pTHX_ GV *gv) if (--gp->gp_refcnt > 0) { if (gp->gp_egv == gv) gp->gp_egv = 0; - GvGP(gv) = 0; + GvGP_set(gv, NULL); return; } @@ -1727,7 +1728,7 @@ Perl_gp_free(pTHX_ GV *gv) SvREFCNT_dec(gp->gp_form); Safefree(gp); - GvGP(gv) = 0; + GvGP_set(gv, NULL); } int @@ -27,10 +27,15 @@ struct gp { #if defined (DEBUGGING) && defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN) && !defined(__INTEL_COMPILER) # define GvGP(gv) \ - (*({GV *const _gvgp = (GV *) (gv); \ + (0+(*({GV *const _gvgp = (GV *) (gv); \ assert(SvTYPE(_gvgp) == SVt_PVGV || SvTYPE(_gvgp) == SVt_PVLV); \ assert(isGV_with_GP(_gvgp)); \ - &((_gvgp)->sv_u.svu_gp);})) + &((_gvgp)->sv_u.svu_gp);}))) +# define GvGP_set(gv,gp) \ + {GV *const _gvgp = (GV *) (gv); \ + assert(SvTYPE(_gvgp) == SVt_PVGV || SvTYPE(_gvgp) == SVt_PVLV); \ + assert(isGV_with_GP(_gvgp)); \ + (_gvgp)->sv_u.svu_gp = (gp); } # define GvFLAGS(gv) \ (*({GV *const _gvflags = (GV *) (gv); \ assert(SvTYPE(_gvflags) == SVt_PVGV || SvTYPE(_gvflags) == SVt_PVLV); \ @@ -52,7 +57,8 @@ struct gp { # define GvNAME_get(gv) ({ assert(GvNAME_HEK(gv)); (char *)HEK_KEY(GvNAME_HEK(gv)); }) # define GvNAMELEN_get(gv) ({ assert(GvNAME_HEK(gv)); HEK_LEN(GvNAME_HEK(gv)); }) #else -# define GvGP(gv) ((gv)->sv_u.svu_gp) +# define GvGP(gv) (0+(gv)->sv_u.svu_gp) +# define GvGP_set(gv,gp) ((gv)->sv_u.svu_gp = (gp)) # define GvFLAGS(gv) (GvXPVGV(gv)->xpv_cur) # define GvSTASH(gv) (GvXPVGV(gv)->xnv_u.xgv_stash) # define GvNAME_HEK(gv) (GvXPVGV(gv)->xiv_u.xivu_namehek) @@ -114,7 +120,8 @@ Return the SV from the GV. GvGP(gv)->gp_hv : \ GvGP(gv_HVadd(gv))->gp_hv) -#define GvCV(gv) (GvGP(gv)->gp_cv) +#define GvCV(gv) (0+GvGP(gv)->gp_cv) +#define GvCV_set(gv,cv) (GvGP(gv)->gp_cv = (cv)) #define GvCVGEN(gv) (GvGP(gv)->gp_cvgen) #define GvCVu(gv) (GvGP(gv)->gp_cvgen ? NULL : GvGP(gv)->gp_cv) @@ -6244,7 +6244,7 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block) CvISXSUB_on(cv); } else { - GvCV(gv) = NULL; + GvCV_set(gv, NULL); cv = newCONSTSUB(NULL, name, const_sv); } mro_method_changed_in( /* sub Foo::Bar () { 123 } */ @@ -6309,7 +6309,7 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block) else { cv = PL_compcv; if (name) { - GvCV(gv) = cv; + GvCV_set(gv, cv); if (PL_madskills) { if (strEQ(name, "import")) { PL_formfeed = MUTABLE_SV(cv); @@ -6455,7 +6455,7 @@ S_process_special_blocks(pTHX_ const char *const fullname, GV *const gv, DEBUG_x( dump_sub(gv) ); Perl_av_create_and_push(aTHX_ &PL_beginav, MUTABLE_SV(cv)); - GvCV(gv) = 0; /* cv has been hijacked */ + GvCV_set(gv,0); /* cv has been hijacked */ call_list(oldscope, PL_beginav); PL_curcop = &PL_compiling; @@ -6499,7 +6499,7 @@ S_process_special_blocks(pTHX_ const char *const fullname, GV *const gv, } else return; DEBUG_x( dump_sub(gv) ); - GvCV(gv) = 0; /* cv has been hijacked */ + GvCV_set(gv,0); /* cv has been hijacked */ } } @@ -6677,7 +6677,7 @@ Perl_newXS(pTHX_ const char *name, XSUBADDR_t subaddr, const char *filename) else { cv = MUTABLE_CV(newSV_type(SVt_PVCV)); if (name) { - GvCV(gv) = cv; + GvCV_set(gv,cv); GvCVGEN(gv) = 0; mro_method_changed_in(GvSTASH(gv)); /* newXS */ } @@ -7653,7 +7653,7 @@ Perl_ck_glob(pTHX_ OP *o) newSVpvs("File::Glob"), NULL, NULL, NULL); if((glob_gv = gv_fetchpvs("File::Glob::csh_glob", 0, SVt_PVCV))) { gv = gv_fetchpvs("CORE::GLOBAL::glob", 0, SVt_PVCV); - GvCV(gv) = GvCV(glob_gv); + GvCV_set(gv, GvCV(glob_gv)); SvREFCNT_inc_void(MUTABLE_SV(GvCV(gv))); GvIMPORTED_CV_on(gv); } @@ -1045,7 +1045,7 @@ PP(pp_undef) gp_free(MUTABLE_GV(sv)); Newxz(gp, 1, GP); - GvGP(sv) = gp_ref(gp); + GvGP_set(sv, gp_ref(gp)); GvSV(sv) = newSV(0); GvLINE(sv) = CopLINE(PL_curcop); GvEGV(sv) = MUTABLE_GV(sv); @@ -298,7 +298,7 @@ Perl_save_gp(pTHX_ GV *gv, I32 empty) gp->gp_sv = newSV(0); } #endif - GvGP(gv) = gp; + GvGP_set(gv,gp); } else { gp_ref(GvGP(gv)); @@ -848,7 +848,7 @@ Perl_leave_scope(pTHX_ I32 base) ptr = SSPOPPTR; gv = MUTABLE_GV(SSPOPPTR); gp_free(gv); - GvGP(gv) = (GP*)ptr; + GvGP_set(gv, (GP*)ptr); /* putting a method back into circulation ("local")*/ if (GvCVu(gv) && (hv=GvSTASH(gv)) && HvENAME_get(hv)) mro_method_changed_in(hv); @@ -522,7 +522,7 @@ do_clean_named_objs(pTHX_ SV *const sv) if ( ((obj = MUTABLE_SV(GvCV(sv)) )) && SvOBJECT(obj)) { DEBUG_D((PerlIO_printf(Perl_debug_log, "Cleaning named glob CV object:\n "), sv_dump(obj))); - GvCV(sv) = NULL; + GvCV_set(sv, NULL); SvREFCNT_dec(obj); } SvREFCNT_dec(sv); /* undo the inc above */ @@ -3623,7 +3623,7 @@ S_glob_assign_glob(pTHX_ SV *const dstr, SV *const sstr, const int dtype) /* If source has method cache entry, clear it */ if(GvCVGEN(sstr)) { SvREFCNT_dec(GvCV(sstr)); - GvCV(sstr) = NULL; + GvCV_set(sstr, NULL); GvCVGEN(sstr) = 0; } /* If source has a real method, then a method is @@ -3676,7 +3676,7 @@ S_glob_assign_glob(pTHX_ SV *const dstr, SV *const sstr, const int dtype) (void)SvOK_off(dstr); isGV_with_GP_on(dstr); GvINTRO_off(dstr); /* one-shot flag */ - GvGP(dstr) = gp_ref(GvGP(sstr)); + GvGP_set(dstr, gp_ref(GvGP(sstr))); if (SvTAINTED(sstr)) SvTAINT(dstr); if (GvIMPORTED(dstr) != GVf_IMPORTED @@ -3731,7 +3731,7 @@ S_glob_assign_ref(pTHX_ SV *const dstr, SV *const sstr) GvMULTI_on(dstr); switch (stype) { case SVt_PVCV: - location = (SV **) &GvCV(dstr); + location = (SV **) &(GvGP(dstr)->gp_cv); /* XXX bypassing GvCV_set */ import_flag = GVf_IMPORTED_CV; goto common; case SVt_PVHV: @@ -3757,7 +3757,7 @@ S_glob_assign_ref(pTHX_ SV *const dstr, SV *const sstr) /*if (GvCVGEN(dstr) && (GvCV(dstr) != (const CV *)sref || GvCVGEN(dstr))) {*/ if (GvCVGEN(dstr)) { SvREFCNT_dec(GvCV(dstr)); - GvCV(dstr) = NULL; + GvCV_set(dstr, NULL); GvCVGEN(dstr) = 0; /* Switch off cacheness. */ } } @@ -4129,7 +4129,7 @@ Perl_sv_setsv_flags(pTHX_ SV *dstr, register SV* sstr, const I32 flags) if (GvGP(dstr)) gp_free(MUTABLE_GV(dstr)); - GvGP(dstr) = gp_ref(GvGP(gv)); + GvGP_set(dstr, gp_ref(GvGP(gv))); if (reset_isa) { HV * const stash = GvHV(dstr); @@ -11847,7 +11847,7 @@ S_sv_dup_common(pTHX_ const SV *const sstr, CLONE_PARAMS *const param) GvSTASH(dstr) = hv_dup(GvSTASH(dstr), param); if (param->flags & CLONEf_JOIN_IN) Perl_sv_add_backref(aTHX_ MUTABLE_SV(GvSTASH(dstr)), dstr); - GvGP(dstr) = gp_dup(GvGP(sstr), param); + GvGP_set(dstr, gp_dup(GvGP(sstr), param)); (void)GpREFCNT_inc(GvGP(dstr)); } break; |