summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2015-12-24 22:37:48 +0000
committerDavid Mitchell <davem@iabyn.com>2016-02-03 09:19:17 +0000
commitcd97dc8d499d664d75b7362093b5f93b8eef282d (patch)
tree4bc2580923a3c634c0f4bc4572720e4617332888 /pp_ctl.c
parent31705cdacf6f9aab26c6d405eaaaa3e1cf3d9b72 (diff)
downloadperl-cd97dc8d499d664d75b7362093b5f93b8eef282d.tar.gz
optimise bare 'next'
If a 'next' without a label appears directly in the scope of the current loop, then skip searching the context stack for a suitable LOOP context.
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 142dec7783..c222dbbb7b 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -2546,7 +2546,10 @@ PP(pp_next)
{
PERL_CONTEXT *cx;
- cx = S_unwind_loop(aTHX);
+ /* if not a bare 'next' in the main scope, search for it */
+ cx = CX_CUR();
+ if (!((PL_op->op_flags & OPf_SPECIAL) && CxTYPE_is_LOOP(cx)))
+ cx = S_unwind_loop(aTHX);
TOPBLOCK(cx);
PL_curcop = cx->blk_oldcop;