Teeny optimization in S_hv_magic_check
[p5sagit/p5-mst-13.2.git] / pp_ctl.c
index 4dc0046..3a6c64f 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -1409,7 +1409,7 @@ Perl_die_where(pTHX_ const char *message, STRLEN msglen)
                    sv_catpvn(err, prefix, sizeof(prefix)-1);
                    sv_catpvn(err, message, msglen);
                    if (ckWARN(WARN_MISC)) {
-                       STRLEN start = SvCUR(err)-msglen-sizeof(prefix)+1;
+                       const STRLEN start = SvCUR(err)-msglen-sizeof(prefix)+1;
                        Perl_warner(aTHX_ packWARN(WARN_MISC), SvPVX_const(err)+start);
                    }
                }
@@ -2297,11 +2297,13 @@ PP(pp_goto)
            if (cxix < cxstack_ix)
                dounwind(cxix);
            TOPBLOCK(cx);
-           if (CxTYPE(cx) == CXt_EVAL)
+           SPAGAIN;
+           if (CxTYPE(cx) == CXt_EVAL) {
                if (CxREALEVAL(cx))
                    DIE(aTHX_ "Can't goto subroutine from an eval-string");
                else
                    DIE(aTHX_ "Can't goto subroutine from an eval-block");
+           }
            if (CxTYPE(cx) == CXt_SUB && cx->blk_sub.hasargs) {
                /* put @_ back onto stack */
                AV* av = cx->blk_sub.argarray;
@@ -2341,6 +2343,7 @@ PP(pp_goto)
            SAVETMPS;
            SAVEFREESV(cv); /* later, undo the 'avoid premature free' hack */
            if (CvXSUB(cv)) {
+               OP* retop = cx->blk_sub.retop;
                if (reified) {
                    I32 index;
                    for (index=0; index<items; index++)
@@ -2365,17 +2368,15 @@ PP(pp_goto)
                    SV **newsp;
                    I32 gimme;
 
+                   /* XS subs don't have a CxSUB, so pop it */
+                   POPBLOCK(cx, PL_curpm);
                    /* Push a mark for the start of arglist */
                    PUSHMARK(mark);
                    PUTBACK;
                    (void)(*CvXSUB(cv))(aTHX_ cv);
-                   /* Pop the current context like a decent sub should */
-                   POPBLOCK(cx, PL_curpm);
-                   /* Do _not_ use PUTBACK, keep the XSUB's return stack! */
                }
                LEAVE;
-               assert(CxTYPE(cx) == CXt_SUB);
-               return cx->blk_sub.retop;
+               return retop;
            }
            else {
                AV* padlist = CvPADLIST(cv);
@@ -2661,9 +2662,9 @@ PP(pp_cswitch)
 STATIC void
 S_save_lines(pTHX_ AV *array, SV *sv)
 {
-    register const char *s = SvPVX_const(sv);
-    register const char *send = SvPVX_const(sv) + SvCUR(sv);
-    register I32 line = 1;
+    const char *s = SvPVX_const(sv);
+    const char *send = SvPVX_const(sv) + SvCUR(sv);
+    I32 line = 1;
 
     while (s && s < send) {
        const char *t;
@@ -2944,8 +2945,8 @@ S_doeval(pTHX_ int gimme, OP** startop, CV* outside, U32 seq)
        LEAVE;
        if (optype == OP_REQUIRE) {
             const char* msg = SvPVx(ERRSV, n_a);
-           SV *nsv = cx->blk_eval.old_namesv;
-           (void)hv_store(GvHVn(PL_incgv), SvPVX_const(nsv), SvCUR(nsv),
+           SV *nsv = cx->blk_eval.old_namesv;
+           (void)hv_store(GvHVn(PL_incgv), SvPVX_const(nsv), SvCUR(nsv),
                           &PL_sv_undef, 0);
            DIE(aTHX_ "%sCompilation failed in require",
                *msg ? msg : "Unknown error\n");
@@ -3857,7 +3858,7 @@ run_user_filter(pTHX_ int idx, SV *buf_sv, int maxlen)
 {
     dVAR;
     SV *datasv = FILTER_DATA(idx);
-    int filter_has_file = IoLINES(datasv);
+    const int filter_has_file = IoLINES(datasv);
     GV *filter_child_proc = (GV *)IoFMT_GV(datasv);
     SV *filter_state = (SV *)IoTOP_GV(datasv);
     SV *filter_sub = (SV *)IoBOTTOM_GV(datasv);