diff options
author | David Mitchell <davem@iabyn.com> | 2015-12-24 22:37:48 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2016-02-03 09:19:17 +0000 |
commit | cd97dc8d499d664d75b7362093b5f93b8eef282d (patch) | |
tree | 4bc2580923a3c634c0f4bc4572720e4617332888 /pp_ctl.c | |
parent | 31705cdacf6f9aab26c6d405eaaaa3e1cf3d9b72 (diff) | |
download | perl-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.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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; |