This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Use PADLIST in more places
authorFather Chrysostomos <sprout@cpan.org>
Thu, 16 Aug 2012 05:27:54 +0000 (22:27 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Tue, 21 Aug 2012 23:51:14 +0000 (16:51 -0700)
Much code relies on the fact that PADLIST is typedeffed as AV.
PADLIST should be treated as a distinct type.

cop.h
dump.c
embed.fnc
op.c
pad.c
pp_ctl.c
pp_hot.c
pp_sort.c
proto.h
sv.h

diff --git a/cop.h b/cop.h
index 8a0ea80..7f0dbbd 100644 (file)
--- a/cop.h
+++ b/cop.h
@@ -1189,7 +1189,7 @@ See L<perlcall/LIGHTWEIGHT CALLBACKS>.
     STMT_START {                                                       \
        CV * const _nOnclAshIngNamE_ = the_cv;                          \
        CV * const cv = _nOnclAshIngNamE_;                              \
-       AV * const padlist = CvPADLIST(cv);                             \
+       PADLIST * const padlist = CvPADLIST(cv);                        \
        ENTER;                                                          \
        multicall_oldcatch = CATCH_GET;                                 \
        SAVETMPS; SAVEVPTR(PL_op);                                      \
@@ -1233,7 +1233,7 @@ See L<perlcall/LIGHTWEIGHT CALLBACKS>.
     STMT_START {                                                       \
        CV * const _nOnclAshIngNamE_ = the_cv;                          \
        CV * const cv = _nOnclAshIngNamE_;                              \
-       AV * const padlist = CvPADLIST(cv);                             \
+       PADLIST * const padlist = CvPADLIST(cv);                        \
        cx = &cxstack[cxstack_ix];                                      \
        assert(cx->cx_type & CXp_MULTICALL);                            \
        if (! ((CvDEPTH(multicall_cv) = cx->blk_sub.olddepth)) ) {      \
diff --git a/dump.c b/dump.c
index 0c5cc75..bad42b5 100644 (file)
--- a/dump.c
+++ b/dump.c
@@ -2177,7 +2177,7 @@ Perl_debop(pTHX_ const OP *o)
        CV * const cv = deb_curcv(cxstack_ix);
        SV *sv;
         if (cv) {
-           AV * const padlist = CvPADLIST(cv);
+           PADLIST * const padlist = CvPADLIST(cv);
             AV * const comppad = MUTABLE_AV(*av_fetch(padlist, 0, FALSE));
             sv = *av_fetch(comppad, o->op_targ, FALSE);
         } else
index 64bc381..95a4719 100644 (file)
--- a/embed.fnc
+++ b/embed.fnc
@@ -2337,7 +2337,8 @@ pd        |void   |pad_fixup_inner_anons|NN PADLIST *padlist|NN CV *old_cv|NN CV *new_cv
 pdX    |void   |pad_push       |NN PADLIST *padlist|int depth
 ApdR   |HV*    |pad_compname_type|const PADOFFSET po
 #if defined(USE_ITHREADS)
-pdR    |AV*    |padlist_dup    |NULLOK AV *srcpad|NN CLONE_PARAMS *param
+pdR    |PADLIST *|padlist_dup  |NULLOK PADLIST *srcpad \
+                               |NN CLONE_PARAMS *param
 #endif
 
 ApdR   |CV*    |find_runcv     |NULLOK U32 *db_seqp
diff --git a/op.c b/op.c
index 9c87201..1a0e5ab 100644 (file)
--- a/op.c
+++ b/op.c
@@ -7066,7 +7066,7 @@ Perl_newATTRSUB_flags(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs,
 #endif
        ) {
            cv_flags_t existing_builtin_attrs = CvFLAGS(cv) & CVf_BUILTIN_ATTRS;
-           AV *const temp_av = CvPADLIST(cv);
+           PADLIST *const temp_av = CvPADLIST(cv);
            CV *const temp_cv = CvOUTSIDE(cv);
            const cv_flags_t other_flags =
                CvFLAGS(cv) & (CVf_SLABBED|CVf_WEAKOUTSIDE);
diff --git a/pad.c b/pad.c
index 0f2cf7c..e18560b 100644 (file)
--- a/pad.c
+++ b/pad.c
@@ -1124,7 +1124,7 @@ S_pad_findlex(pTHX_ const char *namepv, STRLEN namelen, U32 flags, const CV* cv,
     I32 offset, new_offset;
     SV *new_capture;
     SV **new_capturep;
-    const AV * const padlist = CvPADLIST(cv);
+    const PADLIST * const padlist = CvPADLIST(cv);
     const bool staleok = !!(flags & padadd_STALEOK);
 
     PERL_ARGS_ASSERT_PAD_FINDLEX;
@@ -1896,7 +1896,7 @@ S_cv_dump(pTHX_ const CV *cv, const char *title)
 {
     dVAR;
     const CV * const outside = CvOUTSIDE(cv);
-    AV* const padlist = CvPADLIST(cv);
+    PADLIST* const padlist = CvPADLIST(cv);
 
     PERL_ARGS_ASSERT_CV_DUMP;
 
@@ -1940,9 +1940,11 @@ Perl_cv_clone(pTHX_ CV *proto)
 {
     dVAR;
     I32 ix;
-    AV* const protopadlist = CvPADLIST(proto);
-    const AV *const protopad_name = (const AV *)*av_fetch(protopadlist, 0, FALSE);
-    const AV *const protopad = (const AV *)*av_fetch(protopadlist, 1, FALSE);
+    PADLIST* const protopadlist = CvPADLIST(proto);
+    const AV *const protopad_name =
+       (const AV *)*av_fetch(protopadlist, 0, FALSE);
+    const AV *const protopad =
+       (const AV *)*av_fetch(protopadlist, 1, FALSE);
     SV** const pname = AvARRAY(protopad_name);
     SV** const ppad = AvARRAY(protopad);
     const I32 fname = AvFILLp(protopad_name);
@@ -2236,15 +2238,15 @@ Perl_pad_compname_type(pTHX_ const PADOFFSET po)
 #  define av_dup_inc(s,t)      MUTABLE_AV(sv_dup_inc((const SV *)s,t))
 
 /*
-=for apidoc m|AV *|padlist_dup|AV *srcpad|CLONE_PARAMS *param
+=for apidoc padlist_dup
 
 Duplicates a pad.
 
 =cut
 */
 
-AV *
-Perl_padlist_dup(pTHX_ AV *srcpad, CLONE_PARAMS *param)
+PADLIST *
+Perl_padlist_dup(pTHX_ PADLIST *srcpad, CLONE_PARAMS *param)
 {
     AV *dstpad;
     PERL_ARGS_ASSERT_PADLIST_DUP;
index 6990d32..496f753 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -2871,7 +2871,7 @@ PP(pp_goto)
                return retop;
            }
            else {
-               AV* const padlist = CvPADLIST(cv);
+               PADLIST * const padlist = CvPADLIST(cv);
                if (CxTYPE(cx) == CXt_EVAL) {
                    PL_in_eval = CxOLD_IN_EVAL(cx);
                    PL_eval_root = cx->blk_eval.old_eval_root;
index 11b7b59..2493ae5 100644 (file)
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -2683,7 +2683,7 @@ try_autoload:
        /* This path taken at least 75% of the time   */
        dMARK;
        I32 items = SP - MARK;
-       AV* const padlist = CvPADLIST(cv);
+       PADLIST * const padlist = CvPADLIST(cv);
        PUSHBLOCK(cx, CXt_SUB, MARK);
        PUSHSUB(cx);
        cx->blk_sub.retop = PL_op->op_next;
index e97e0a1..30595f0 100644 (file)
--- a/pp_sort.c
+++ b/pp_sort.c
@@ -1667,7 +1667,7 @@ PP(pp_sort)
                if (CvDEPTH(cv)) SvREFCNT_inc_simple_void_NN(cv);
                PUSHSUB(cx);
                if (!is_xsub) {
-                   AV* const padlist = CvPADLIST(cv);
+                   PADLIST * const padlist = CvPADLIST(cv);
 
                    if (++CvDEPTH(cv) >= 2) {
                        PERL_STACK_OVERFLOW_CHECK();
diff --git a/proto.h b/proto.h
index 78fd691..71de1d3 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -7619,7 +7619,7 @@ PERL_CALLCONV OP* Perl_newPADOP(pTHX_ I32 type, I32 flags, SV* sv)
 #define PERL_ARGS_ASSERT_NEWPADOP      \
        assert(sv)
 
-PERL_CALLCONV AV*      Perl_padlist_dup(pTHX_ AV *srcpad, CLONE_PARAMS *param)
+PERL_CALLCONV PADLIST *        Perl_padlist_dup(pTHX_ PADLIST *srcpad, CLONE_PARAMS *param)
                        __attribute__warn_unused_result__
                        __attribute__nonnull__(pTHX_2);
 #define PERL_ARGS_ASSERT_PADLIST_DUP   \
diff --git a/sv.h b/sv.h
index 86af9df..7ec1c05 100644 (file)
--- a/sv.h
+++ b/sv.h
@@ -477,7 +477,7 @@ typedef U16 cv_flags_t;
     }          xcv_root_u;                                                     \
     GV *       xcv_gv;                                                         \
     char *     xcv_file;                                                       \
-    AV *       xcv_padlist;                                                    \
+    PADLIST *  xcv_padlist;                                                    \
     CV *       xcv_outside;                                                    \
     U32                xcv_outside_seq; /* the COP sequence (at the point of our       \
                                  * compilation) in the lexically enclosing     \