This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
simplify CHANGE_MULTICALL_FLAGS
authorDavid Mitchell <davem@iabyn.com>
Thu, 15 Oct 2015 15:59:19 +0000 (16:59 +0100)
committerDavid Mitchell <davem@iabyn.com>
Wed, 3 Feb 2016 08:59:44 +0000 (08:59 +0000)
But using POPSUB_COMMON(), we achieve commonality. This incurs the extra
overhead of restoring PL_comppad/PL_curpad, which is compensated for by
not having to temporarily protect PL_comppad in the following PUSHSUB.

cop.h

diff --git a/cop.h b/cop.h
index 57b56d8..3c57540 100644 (file)
--- a/cop.h
+++ b/cop.h
@@ -1319,16 +1319,9 @@ See L<perlcall/LIGHTWEIGHT CALLBACKS>.
        PADLIST * const padlist = CvPADLIST(cv);                        \
        cx = &cxstack[cxstack_ix];                                      \
        assert(CxMULTICALL(cx));                                        \
-       CvDEPTH(multicall_cv) = cx->blk_sub.olddepth;                   \
-        SvREFCNT_dec_NN(multicall_cv);                                  \
+        POPSUB_COMMON(cx);                                              \
        cx->cx_type = (CXt_SUB|CXp_MULTICALL|flags);                    \
-        {                                                               \
-            /* save a few things that we don't want PUSHSUB to zap */   \
-            PAD * const prevcomppad = cx->blk_sub.prevcomppad;          \
-           PUSHSUB(cx);                                                \
-            /* undo the stuff that PUSHSUB zapped */                    \
-            cx->blk_sub.prevcomppad = prevcomppad ;                     \
-        }                                                               \
+        PUSHSUB(cx);                                                   \
         if (!(flags & CXp_SUB_RE_FAKE))                                 \
             CvDEPTH(cv)++;                                             \
        if (CvDEPTH(cv) >= 2) {                                         \