This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
dowinwind(): move common CX_LEAVE_SCOPE() outside
authorDavid Mitchell <davem@iabyn.com>
Thu, 15 Oct 2015 13:28:28 +0000 (14:28 +0100)
committerDavid Mitchell <davem@iabyn.com>
Wed, 3 Feb 2016 08:59:43 +0000 (08:59 +0000)
Now the every branch in the switch does CX_LEAVE_SCOPE(cx), hoist it
above the satrt of the switch.

pp_ctl.c

index b174a05..5c57580 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -1510,44 +1510,38 @@ Perl_dounwind(pTHX_ I32 cxix)
         PERL_CONTEXT *cx = &cxstack[cxstack_ix];
        DEBUG_CX("UNWIND");                                             \
        /* Note: we don't need to restore the base context info till the end. */
+
+        CX_LEAVE_SCOPE(cx);
+
        switch (CxTYPE(cx)) {
        case CXt_SUBST:
-            CX_LEAVE_SCOPE(cx);
            POPSUBST(cx);
            continue;  /* not break */
        case CXt_SUB:
-            CX_LEAVE_SCOPE(cx);
            POPSUB(cx);
            break;
        case CXt_EVAL:
-            CX_LEAVE_SCOPE(cx);
            POPEVAL(cx);
            break;
        case CXt_BLOCK:
-            CX_LEAVE_SCOPE(cx);
             POPBASICBLK(cx);
            break;
        case CXt_LOOP_LAZYIV:
        case CXt_LOOP_LAZYSV:
        case CXt_LOOP_FOR:
        case CXt_LOOP_PLAIN:
-            CX_LEAVE_SCOPE(cx);
            POPLOOP(cx);
            break;
        case CXt_WHEN:
-            CX_LEAVE_SCOPE(cx);
            POPWHEN(cx);
            break;
        case CXt_GIVEN:
-            CX_LEAVE_SCOPE(cx);
            POPGIVEN(cx);
            break;
        case CXt_NULL:
             /* there isn't a POPNULL ! */
-            CX_LEAVE_SCOPE(cx);
            break;
        case CXt_FORMAT:
-            CX_LEAVE_SCOPE(cx);
            POPFORMAT(cx);
            break;
        }