This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
stop goto &foo wasting stack space
authorDave Mitchell <davem@fdisolutions.com>
Sat, 21 May 2005 21:38:55 +0000 (21:38 +0000)
committerDave Mitchell <davem@fdisolutions.com>
Sat, 21 May 2005 21:38:55 +0000 (21:38 +0000)
it used to push @_ onto the end of the stack; now it pops the stack
back to the old watermark first.

p4raw-id: //depot/perl@24534

pp_ctl.c

index 4dc0046..bb8aab7 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -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;