This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
pp_sort: move SAVETMPS later
authorDavid Mitchell <davem@iabyn.com>
Sat, 11 Jul 2015 12:58:47 +0000 (13:58 +0100)
committerDavid Mitchell <davem@iabyn.com>
Wed, 3 Feb 2016 08:59:36 +0000 (08:59 +0000)
Move the SAVETMPS to just after the PUSHSUB. This should make no
functional difference, because nothing should have affected the TMPS stack
between the old and the new code positions.

For the OPf_SPECIAL/ CXt_NULL case, which doesn't do a PUSHSUB,
do another SAVETMPS there too.

pp_sort.c

index 1e48042..df4c05f 100644 (file)
--- a/pp_sort.c
+++ b/pp_sort.c
@@ -1643,7 +1643,6 @@ PP(pp_sort)
            SV** newsp;
            const bool oldcatch = CATCH_GET;
 
-           SAVETMPS;
            SAVEOP();
 
            CATCH_SET(TRUE);
@@ -1673,6 +1672,7 @@ PP(pp_sort)
            if (!(flags & OPf_SPECIAL)) {
                cx->cx_type = CXt_SUB;
                PUSHSUB(cx);
+                SAVETMPS;
                if (!is_xsub) {
                    PADLIST * const padlist = CvPADLIST(cv);
 
@@ -1692,6 +1692,9 @@ PP(pp_sort)
 
                }
            }
+            else
+                SAVETMPS;
+
            cx->cx_type |= CXp_MULTICALL;
            
            start = p1 - max;