This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Eliminate ENTER/LEAVE from sub calls
authorDavid Mitchell <davem@iabyn.com>
Sat, 11 Jul 2015 21:13:51 +0000 (22:13 +0100)
committerDavid Mitchell <davem@iabyn.com>
Wed, 3 Feb 2016 08:59:36 +0000 (08:59 +0000)
commit8ae997c5a3d6ec713ecf3e698d17ad6090022c7d
treec0840745b84031f7d9c47ce5a4a4006a4ec3bce3
parentf29834c676387b28afd9f5c538f0a5e2c97abd36
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.
cop.h
pp_ctl.c
pp_hot.c
pp_sort.c
t/op/sub.t