From 74804ad189340f2812955e3c4308a6a82c0cc0eb Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Wed, 11 Sep 2019 17:24:38 -0600 Subject: [PATCH] Add embed.fnc entries for Cv inline fcns and change the name of one. CvDEPTH shouldn't have a trailing 'p' to indicate private memeber access. It may do so internally, but the name shouldn't indicate that. --- cv.h | 4 ++-- embed.fnc | 2 ++ inline.h | 6 +++++- proto.h | 10 ++++++++++ 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/cv.h b/cv.h index df42432..9a169e8 100644 --- a/cv.h +++ b/cv.h @@ -61,9 +61,9 @@ See L. (CvFILE(sv) = CopFILE(cop), CvDYNFILE_off(sv)) #endif #define CvFILEGV(sv) (gv_fetchfile(CvFILE(sv))) -#define CvDEPTH(sv) (*Perl_CvDEPTHp((const CV *)sv)) +#define CvDEPTH(sv) (*Perl_CvDEPTH((const CV *)sv)) /* For use when you only have a XPVCV*, not a real CV*. - Must be assert protected as in S_CvDEPTHp before use. */ + Must be assert protected as in Perl_CvDEPTH before use. */ #define CvDEPTHunsafe(sv) ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_depth /* these CvPADLIST/CvRESERVED asserts can be reverted one day, once stabilized */ diff --git a/embed.fnc b/embed.fnc index 70e3411..19e79f5 100644 --- a/embed.fnc +++ b/embed.fnc @@ -572,6 +572,8 @@ Apd |void |cv_undef |NN CV* cv p |void |cv_undef_flags |NN CV* cv|U32 flags pd |void |cv_forget_slab |NULLOK CV *cv Ap |void |cx_dump |NN PERL_CONTEXT* cx +AiMp |GV * |CvGV |NN CV *sv +AiMTp |I32 * |CvDEPTH |NN const CV * const sv Aphd |SV* |filter_add |NULLOK filter_t funcp|NULLOK SV* datasv Ap |void |filter_del |NN filter_t funcp ApRhd |I32 |filter_read |int idx|NN SV *buf_sv|int maxlen diff --git a/inline.h b/inline.h index f31ce6a..5bae44e 100644 --- a/inline.h +++ b/inline.h @@ -53,15 +53,19 @@ Perl_av_top_index(pTHX_ AV *av) PERL_STATIC_INLINE GV * Perl_CvGV(pTHX_ CV *sv) { + PERL_ARGS_ASSERT_CVGV; + return CvNAMED(sv) ? Perl_cvgv_from_hek(aTHX_ sv) : ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_gv_u.xcv_gv; } PERL_STATIC_INLINE I32 * -Perl_CvDEPTHp(const CV * const sv) +Perl_CvDEPTH(const CV * const sv) { + PERL_ARGS_ASSERT_CVDEPTH; assert(SvTYPE(sv) == SVt_PVCV || SvTYPE(sv) == SVt_PVFM); + return &((XPVCV*)SvANY(sv))->xcv_depth; } diff --git a/proto.h b/proto.h index ee3a528..8d74d66 100644 --- a/proto.h +++ b/proto.h @@ -25,6 +25,16 @@ PERL_CALLCONV UV ASCII_TO_NEED(const UV enc, const UV ch) #define PERL_ARGS_ASSERT_ASCII_TO_NEED #endif +#ifndef PERL_NO_INLINE_FUNCTIONS +PERL_STATIC_INLINE I32 * Perl_CvDEPTH(const CV * const sv); +#define PERL_ARGS_ASSERT_CVDEPTH \ + assert(sv) +#endif +#ifndef PERL_NO_INLINE_FUNCTIONS +PERL_STATIC_INLINE GV * Perl_CvGV(pTHX_ CV *sv); +#define PERL_ARGS_ASSERT_CVGV \ + assert(sv) +#endif PERL_CALLCONV int Perl_Gv_AMupdate(pTHX_ HV* stash, bool destructing); #define PERL_ARGS_ASSERT_GV_AMUPDATE \ assert(stash) -- 1.8.3.1