This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
pp_dbstate: do SAVETMPS etc in both branches
authorDavid Mitchell <davem@iabyn.com>
Sat, 11 Jul 2015 13:04:59 +0000 (14:04 +0100)
committerDavid Mitchell <davem@iabyn.com>
Wed, 3 Feb 2016 08:59:36 +0000 (08:59 +0000)
pp_dbstate() does an XS or non-XS subroutine call to &DB::DB;
move the SAVETMPS 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 13781e2..8ae7d39 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -1957,7 +1957,6 @@ PP(pp_dbstate)
            return NORMAL;
 
        ENTER;
-       SAVETMPS;
 
        SAVEI32(PL_debug);
        SAVESTACK_POS();
@@ -1966,6 +1965,7 @@ PP(pp_dbstate)
        SPAGAIN;
 
        if (CvISXSUB(cv)) {
+            SAVETMPS;
            PUSHMARK(SP);
            (void)(*CvXSUB(cv))(aTHX_ cv);
            FREETMPS;
@@ -1975,6 +1975,7 @@ PP(pp_dbstate)
        else {
            PUSHBLOCK(cx, CXt_SUB, SP);
            PUSHSUB_DB(cx);
+            SAVETMPS;
            cx->blk_sub.retop = PL_op->op_next;
            CvDEPTH(cv)++;
            if (CvDEPTH(cv) >= 2) {