diff options
author | David Mitchell <davem@iabyn.com> | 2015-07-11 22:13:51 +0100 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2016-02-03 08:59:36 +0000 |
commit | 8ae997c5a3d6ec713ecf3e698d17ad6090022c7d (patch) | |
tree | c0840745b84031f7d9c47ce5a4a4006a4ec3bce3 /pp_sort.c | |
parent | f29834c676387b28afd9f5c538f0a5e2c97abd36 (diff) | |
download | perl-8ae997c5a3d6ec713ecf3e698d17ad6090022c7d.tar.gz |
Eliminate ENTER/LEAVE from sub calls
Every sub call is wrapped in an ENTER/LEAVE pair, which uses the next
free slot on the scope stack to save and then restore the old value of
PL_savestack_ix. Instead, store the old value in a new field in the
context structure, old_savestack_ix. This is quicker and simpler.
Not that we keep the ENTER/LEAVE for XS sub calls, as they don't push a
context frame, and so have nowhere else to remember PL_savestack_ix.
As a side-effect, this commit fixes a TODO test in t/op/sub.t,
which was related to dying while popping a context, then re-popping that
context. For the second pop, the scopestack has since been overwritten
and so too much was getting popped from the savestack. Since we no longer
use the scopestack, it's no longer an issue.
Diffstat (limited to 'pp_sort.c')
-rw-r--r-- | pp_sort.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -1642,6 +1642,7 @@ PP(pp_sort) PERL_CONTEXT *cx; SV** newsp; const bool oldcatch = CATCH_GET; + I32 old_savestack_ix = PL_savestack_ix; SAVEOP(); @@ -1697,6 +1698,7 @@ PP(pp_sort) cx->blk_sub.old_tmpsfloor = PL_tmps_floor; PL_tmps_floor = PL_tmps_ix; } + cx->blk_sub.old_savestack_ix = old_savestack_ix; cx->cx_type |= CXp_MULTICALL; |