diff options
author | David Mitchell <davem@iabyn.com> | 2015-10-17 10:53:10 +0100 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2016-02-03 09:18:29 +0000 |
commit | 8a1f10dd1e1964fa64cd0dff7196cf3f1f503ae1 (patch) | |
tree | 1310af3fdb36a05a49605ae10eaa89119995ee33 /pp_ctl.c | |
parent | 93661e56c6b52b1bf34963a3a62b2a766381cccd (diff) | |
download | perl-8a1f10dd1e1964fa64cd0dff7196cf3f1f503ae1.tar.gz |
pp_iter(): optimise stack handling
Make pp_enteriter() do EXTEND(SP,1); then there's no need for pp_iter() to
check for space to push PL_sv_yes/no each time round the loop.
Since the only stack manipulation in pp_iter is now just pushing a boolean
at the end, remove dSP etc and just directly push to PL_stack_sp at the
end.
Diffstat (limited to 'pp_ctl.c')
-rw-r--r-- | pp_ctl.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -2235,6 +2235,7 @@ PP(pp_enteriter) AvFILL(cx->blk_loop.state_u.ary.ary) + 1 : -1; } + /* EXTEND(SP, 1) not needed in this branch because we just did POPs */ } else { /* iterating over items on the stack */ cx->cx_type |= CXt_LOOP_LIST; @@ -2243,6 +2244,9 @@ PP(pp_enteriter) (PL_op->op_private & OPpITER_REVERSED) ? cx->blk_oldsp + 1 : cx->blk_loop.state_u.stack.basesp; + /* pre-extend stack so pp_iter doesn't have to check every time + * it pushes yes/no */ + EXTEND(SP, 1); } RETURN; |