X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/5e8814954c268f117d70c5156096c5bf7bb1cff7..3848e5b79a3e7e73f1c511dbc5723c0d552e8d50:/cv.h?ds=inline diff --git a/cv.h b/cv.h index 7f6dea2..d4dfd2d 100644 --- a/cv.h +++ b/cv.h @@ -62,10 +62,38 @@ See L. #endif #define CvFILEGV(sv) (gv_fetchfile(CvFILE(sv))) #define CvDEPTH(sv) (*S_CvDEPTHp((const CV *)sv)) -#define CvPADLIST(sv) ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_padlist -#define CvOUTSIDE(sv) ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_outside -#define CvFLAGS(sv) ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_flags +/* For use when you only have a XPVCV*, not a real CV*. + Must be assert protected as in S_CvDEPTHp before use. */ +#define CvDEPTHunsafe(sv) ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_depth + +/* these CvPADLIST/CvRESERVED asserts can be reverted one day, once stabilized */ +#define CvPADLIST(sv) (*(assert_(!CvISXSUB((CV*)(sv))) \ + &(((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_padlist_u.xcv_padlist))) +/* CvPADLIST_set is not public API, it can be removed one day, once stabilized */ +#ifdef DEBUGGING +# define CvPADLIST_set(sv, padlist) Perl_set_padlist((CV*)sv, padlist) +#else +# define CvPADLIST_set(sv, padlist) (CvPADLIST(sv) = (padlist)) +#endif +#define CvHSCXT(sv) *(assert_(CvISXSUB((CV*)(sv))) \ + &(((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_padlist_u.xcv_hscxt)) +#ifdef DEBUGGING +# if PTRSIZE == 8 +# define PoisonPADLIST(sv) \ + (((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_padlist_u.xcv_padlist = (PADLIST *)UINT64_C(0xEFEFEFEFEFEFEFEF)) +# elif PTRSIZE == 4 +# define PoisonPADLIST(sv) \ + (((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_padlist_u.xcv_padlist = (PADLIST *)0xEFEFEFEF) +# else +# error unknown pointer size +# endif +#else +# define PoisonPADLIST(sv) NOOP +#endif + +#define CvOUTSIDE(sv) ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_outside #define CvOUTSIDE_SEQ(sv) ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_outside_seq +#define CvFLAGS(sv) ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_flags /* These two are sometimes called on non-CVs */ #define CvPROTO(sv) \ @@ -106,9 +134,10 @@ See L. #define CVf_HASEVAL 0x4000 /* contains string eval */ #define CVf_NAMED 0x8000 /* Has a name HEK */ #define CVf_LEXICAL 0x10000 /* Omit package from name */ +#define CVf_ANONCONST 0x20000 /* :const - create anonconst op */ /* This symbol for optimised communication between toke.c and op.c: */ -#define CVf_BUILTIN_ATTRS (CVf_METHOD|CVf_LVALUE) +#define CVf_BUILTIN_ATTRS (CVf_METHOD|CVf_LVALUE|CVf_ANONCONST) #define CvCLONE(cv) (CvFLAGS(cv) & CVf_CLONE) #define CvCLONE_on(cv) (CvFLAGS(cv) |= CVf_CLONE) @@ -191,6 +220,10 @@ See L. #define CvLEXICAL_on(cv) (CvFLAGS(cv) |= CVf_LEXICAL) #define CvLEXICAL_off(cv) (CvFLAGS(cv) &= ~CVf_LEXICAL) +#define CvANONCONST(cv) (CvFLAGS(cv) & CVf_ANONCONST) +#define CvANONCONST_on(cv) (CvFLAGS(cv) |= CVf_ANONCONST) +#define CvANONCONST_off(cv) (CvFLAGS(cv) &= ~CVf_ANONCONST) + /* Flags for newXS_flags */ #define XS_DYNAMIC_FILENAME 0x01 /* The filename isn't static */ @@ -277,11 +310,5 @@ typedef OP *(*Perl_call_checker)(pTHX_ OP *, GV *, SV *); #endif /* - * Local variables: - * c-indentation-style: bsd - * c-basic-offset: 4 - * indent-tabs-mode: nil - * End: - * * ex: set ts=8 sts=4 sw=4 et: */