This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
pp_entersub(): move SAVETMPS next to PUSHSUB
authorDavid Mitchell <davem@iabyn.com>
Sat, 11 Jul 2015 12:32:03 +0000 (13:32 +0100)
committerDavid Mitchell <davem@iabyn.com>
Wed, 3 Feb 2016 08:59:36 +0000 (08:59 +0000)
It it intended that eventually PUSHSUB() will do the SAVETMPS itself,
so move the SAVETMPS up so that it's next to the PUSHSUB.
There should be nothing between those two points that use the TEMPS stack,
so this commit should have no functional effect.

pp_hot.c

index ae8b2a4..5f795b5 100644 (file)
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -3516,6 +3516,8 @@ PP(pp_entersub)
 
        PUSHBLOCK(cx, CXt_SUB, MARK);
        PUSHSUB(cx);
+       SAVETMPS;
+
        cx->blk_sub.retop = PL_op->op_next;
        if (UNLIKELY((depth = ++CvDEPTH(cv)) >= 2)) {
            PERL_STACK_OVERFLOW_CHECK();
@@ -3548,7 +3550,6 @@ PP(pp_entersub)
            Copy(MARK+1,AvARRAY(av),items,SV*);
            AvFILLp(av) = items - 1;
        }
-       SAVETMPS;
        if (UNLIKELY((cx->blk_u16 & OPpENTERSUB_LVAL_MASK) == OPpLVAL_INTRO &&
            !CvLVALUE(cv)))
             DIE(aTHX_ "Can't modify non-lvalue subroutine call of &%"SVf,