This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
pp_goto: do SAVETMPS etc in XS and non-XS branches
authorDavid Mitchell <davem@iabyn.com>
Sat, 11 Jul 2015 12:45:01 +0000 (13:45 +0100)
committerDavid Mitchell <davem@iabyn.com>
Wed, 3 Feb 2016 08:59:36 +0000 (08:59 +0000)
Move a SAVETMPS;SAVEFREESV(cv); from before the "if (CvISXSUB(cv))" test
to the head of both branches. This duplication of code is currently
a NOOP, but will shortly allow us to handle things differently in the two
branches.

pp_ctl.c

index 0cff221..13781e2 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -2776,8 +2776,6 @@ PP(pp_goto)
             }
 
            /* Now do some callish stuff. */
-           SAVETMPS;
-           SAVEFREESV(cv); /* later, undo the 'avoid premature free' hack */
            if (CvISXSUB(cv)) {
                SV **newsp;
                I32 gimme;
@@ -2788,6 +2786,9 @@ PP(pp_goto)
                 PERL_UNUSED_VAR(newsp);
                 PERL_UNUSED_VAR(gimme);
 
+                SAVETMPS;
+                SAVEFREESV(cv); /* later, undo the 'avoid premature free' hack */
+
                /* put GvAV(defgv) back onto stack */
                if (items) {
                    EXTEND(SP, items+1); /* @_ could have been extended. */
@@ -2830,6 +2831,9 @@ PP(pp_goto)
            else {
                PADLIST * const padlist = CvPADLIST(cv);
 
+                SAVETMPS;
+                SAVEFREESV(cv); /* later, undo the 'avoid premature free' hack */
+
                 /* partial unrolled PUSHSUB(): */
 
                cx->blk_sub.cv = cv;