In perl.git, the branch smoke-me/davem/contextsB2 has been created
<http://perl5.git.perl.org/perl.git/commitdiff/b628da63aab55c619fbad812c759e0369f9f9097?hp=0000000000000000000000000000000000000000>
at b628da63aab55c619fbad812c759e0369f9f9097 (commit)
- Log -----------------------------------------------------------------
commit b628da63aab55c619fbad812c759e0369f9f9097
Author: David Mitchell <[email protected]>
Date: Fri Dec 25 12:03:00 2015 +0000
Document CxLVAL()
M cop.h
commit 912955096af7efdab749fcd4bd1045eec7e2d61a
Author: David Mitchell <[email protected]>
Date: Fri Dec 25 11:51:37 2015 +0000
CX_POPFOO(): assert cx is of the right type
At the start of each CX_POPFOO(cx) macro, add an assertion that cx is of
type CXt_FOO.
M cop.h
commit 56fc59a263688072acb3633db2b990fdf2aff12f
Author: David Mitchell <[email protected]>
Date: Fri Dec 25 11:07:28 2015 +0000
rename POPFOO() to CX_POPFOO()
Rename all the context-popping macros such as POPBLOCK and POPSUB, by
giving them a CX_ prefix. (Do TOPBLOCK too).
This is principally to deliberately break any existing non-core use of
these non-API macros, as their behaviour has changed in this branch.
In particular, POPBLOCK(cx) no longer decrements the cxt stack pointer
nor sets cx; instead, cx is now expected to already point to the stack
frame which POPBLOCK should process.
At the same time, giving them a CX_ prefix makes it clearer that these
are all part of a family of macros that manipulate the context stack.
The PUSHFOO() macros will be renamed in a later commit.
M cop.h
M ext/XS-APItest/APItest.xs
M op.c
M perl.c
M pp.c
M pp_ctl.c
M pp_hot.c
M pp_sort.c
M pp_sys.c
M scope.c
M t/op/args.t
commit 2b772a6c91507b756d005ad96b60afa63f92c07b
Author: David Mitchell <[email protected]>
Date: Thu Dec 24 23:12:37 2015 +0000
pp_redo()): reorder some stuff
It probably doesn't make any difference, but reorder the FREETMPS,
CX_LEAVE_SCOPE and TOPBLOCK so it matches the order we do things when
leaving a scope.
M pp_ctl.c
commit 759658d7a3aea0cc124ef77979e7ae1c6df3bc44
Author: David Mitchell <[email protected]>
Date: Thu Dec 24 22:37:48 2015 +0000
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.
M pp_ctl.c
M t/perf/benchmarks
commit 57afef893ee875340b3582d916d9ce24326d0660
Author: David Mitchell <[email protected]>
Date: Thu Dec 24 21:48:23 2015 +0000
S_unwind_loop(): remove opname param
This is only used for error messages, and can be derived from
OP_NAME(PL_op); so for efficiency, don't pass it.
M pp_ctl.c
commit 8e2b297739a48bd1a970bc6f8d998871aa7db731
Author: David Mitchell <[email protected]>
Date: Thu Dec 24 21:33:49 2015 +0000
S_unwind_loop(): return pointer rather than index
return &cxstack[cxix] rather than cxix, since this is what the caller
actually needs.
M pp_ctl.c
commit bbdf172a81a4d440ec904fb6712213ee1dcdf16b
Author: David Mitchell <[email protected]>
Date: Thu Dec 24 20:30:15 2015 +0000
factor out common actions in TOPBLOCK and POPBLOCK
M cop.h
commit df5217be797b42c4ab9f23c55bdae2fdb834747c
Author: David Mitchell <[email protected]>
Date: Thu Dec 24 19:44:05 2015 +0000
dounwind(): do a POPBLOCK for final cx frame.
Previously dounwind() relied on the caller to a TOPBLOCK or POPBLOCK
following the call to dounwind(). It's debatable who should be
responsible. Arguably its more efficient for dounwind() not to do a
POPBLOCK, since the caller will probably immediately follow on with
POPFOO; POPBLOCK for the next context frame anyway.
Logically however, dounwind() should do this, and its not possible
for the caller to do so retrospectively, as context frame cxstack_ix + 1
may have been overwritten by the time dounwind returns.
Also, the changes in this branch mean that the old PL_tmps_floor is now
saved in the context struct rather than on the save stack, so code that
does C<dounwind(-1); LEAVE_SCOPE();> will no longer automatically
restore PL_tmps_floor. With thiis commit, it will.
The change to pp_return reflects that we now need to copy any return args
*before* donwind() is called, so that "return $1" will mg_get($1) while
the correct (inner) PL_curpm is still in scope.
M pp_ctl.c
M t/op/sub.t
commit e668b16d634ac9b506eb8e0e8363f47efe2c42f2
Author: David Mitchell <[email protected]>
Date: Mon Dec 21 16:33:57 2015 +0000
pp_break(): don't use TOPBLOCK
It appears to be using TOPBLOCK purely for its effect of resetting
PL_stack_sp. Since the next op will be pp_leavegiven which will do a
POPBLOCK, the other actions of TOPBLOCK are redundant. So just set
PL_stack_sp directly.
M pp_ctl.c
commit da8d895a9aaf67f40d7653d6771a5efa4c40c063
Author: David Mitchell <[email protected]>
Date: Mon Dec 21 16:00:59 2015 +0000
tweak POPLOOP and CXt_LOOP_* order
Re-arrange the order of the CXt_LOOP_* to make it easier for compilers
to produce efficient code, and tweak POPLOOP so that the code for
freeing ary and cur is shared (as they occupy the same position in the
union).
M cop.h
commit ed7c92fd1a671f077024266ad31487317b0d1126
Author: David Mitchell <[email protected]>
Date: Mon Dec 21 15:45:57 2015 +0000
fix CxFOREACH
It wasn't detecting CXt_LOOP_LAZYIV as a 'for' loop type. This only
affected 'given' and 'break' (which need to distinguish between being
in a 'given' block and being in a 'for' block).
M cop.h
M t/op/switch.t
commit 5146a695b2b8fd1e0a189650817fed771189712e
Author: David Mitchell <[email protected]>
Date: Mon Dec 21 13:32:13 2015 +0000
only set CXp_FOR_DEF with CXp_FOR_GV
C<for (...)> is a special-case of C<for $pkg_var (...)>, so CXp_FOR_DEF
should only be set when CXp_FOR_GV also is. So in pp_enteriter(), only
test for (PL_op->op_private & OPpITER_DEF) in the GV branch and assert
that it's otherwise unset. This is slightly more efficient in the non-GV
branches.
Also add some more commentary to the CXp_FOR_* flag definitions.
M cop.h
M pp_ctl.c
commit 4c6645c5c8de9d1c59fe3add8a5f72191bdc36fa
Author: David Mitchell <[email protected]>
Date: Fri Dec 18 22:09:58 2015 +0000
give POP_SAVEARRAY() macro a cx arg
rather than just assuming that there's a 'cx' var in scope
M cop.h
M pp_ctl.c
commit a54f5120a6fec6459337cd8929df5a249621a479
Author: David Mitchell <[email protected]>
Date: Fri Dec 18 22:07:25 2015 +0000
clarify code comment in pp_goto(()
M pp_ctl.c
commit 9359f5fe67a910bc72252bf50234885889e2c503
Author: David Mitchell <[email protected]>
Date: Fri Dec 18 21:33:10 2015 +0000
APItest.xs: fixup clone_with_stack()
Make the unwinding and freeing of the old interpreter up to date
with the latest handling of PL_scopestack.
M ext/XS-APItest/APItest.xs
commit 3a18ceae4a6b3b3292204b0c124891ed3d625f3d
Author: David Mitchell <[email protected]>
Date: Fri Dec 18 20:18:13 2015 +0000
fixup cx_dup()
By visual inspection, tweak bits of the context stack duplicating code
to reflect recent changes in this branch, especially new fields, or
whether fields hold a reference count or not.
Since I don't use Windows, this has largely been done blind.
M sv.c
commit 768d6a3c57379efe2b894b0875c0ff6912405eee
Author: David Mitchell <[email protected]>
Date: Fri Dec 18 16:36:54 2015 +0000
pp_iter: optimise integer setting in for (1..10) {}
If the target SV is a simple SVt_IV, which it is likely to be,
just update it directly rather than calling sv_setiv()
M pp_hot.c
commit b0fb0144c7da99635241c73b06d241513ac9c4b1
Author: David Mitchell <[email protected]>
Date: Fri Dec 18 15:09:42 2015 +0000
fix *_ = "" for 0 .. 1;
RT #123994
pp_iter couldn't handle GvSv(gv) being NULL.
In that ticket, Tony Cook suggested two possible fixes. First,
always instantiate the GvSV slot at the start of pp_iter by using
GvSVn rather than GvSV in the CxITERVAR() macro;
Second, test for it being null within the two 'range' branches,
(for(1..9), for('a'..'z')), and if so create it. One advantage of doing
it there is that there's already code for (re)creating the SV if the
reference count is != 1. It also means that the list and array cases
(for(@a), for(1,3,5)) which always put the next iterated SV into the
pad/GvSV slot don't waste time creating and then immediately discarding an
SV if GvSV was NULL.
I went for the second fix.
It also means that's there's no longer any need in pp_enteriter to
initially poulate GvSV is it was null, as this will be detected during
the first pp_iter() anyway.
M pp_ctl.c
M pp_hot.c
M t/op/for.t
commit 1bf3e0d0bc1cd2279356b5bb7541e98fedb6b4df
Author: David Mitchell <[email protected]>
Date: Fri Dec 18 12:34:37 2015 +0000
pp_enteriter: use efficient SvREFCNT_inc variant
replace a couple of SvREFCNT_inc() with SvREFCNT_inc_simple_void_NN().
Also add a couple of code comments.
M pp_ctl.c
commit e430bb4b6e32460bb3b8bb7896e333062a4af9d2
Author: David Mitchell <[email protected]>
Date: Thu Dec 17 17:50:52 2015 +0000
provide some basic documentation for Perl_dounwind
M pp_ctl.c
commit 7715dde41d46c063dd43a4f4ebdc24edcf8225ed
Author: David Mitchell <[email protected]>
Date: Thu Dec 17 17:34:36 2015 +0000
TOPBLOCK: make comment clear its used by goto too
M cop.h
commit 79a576cf6bd203453aa2cf2bf8357db6c1bc6791
Author: David Mitchell <[email protected]>
Date: Thu Dec 17 17:30:48 2015 +0000
POPSUB_ARGS: move a code comment to the right line
M cop.h
commit d6e2a1e0ae7730da6644cc7bfa0d14fd74c98bec
Author: David Mitchell <[email protected]>
Date: Thu Dec 17 12:37:17 2015 +0000
pp_ctl.c: s/newsp/oldsp/g
There are various pp_leavefoo() functions that have similar code along the
lines of
SV **newsp;
newsp = PL_stack_base + cx->blk_oldsp;
Rename all these vars to 'oldsp' to reduce the cognitive dissonance.
The name 'newsp' was a hangover from when POPBLOCK used to implicitly
set a var called 'newsp.
M pp_ctl.c
commit 204b9be17b9ad24555031421d7dfeb37d019e7d2
Author: David Mitchell <[email protected]>
Date: Thu Dec 17 12:13:09 2015 +0000
replace leave_common() with leave_adjust_stacks()
Make the remaining callers of S_leave_common() use leave_adjust_stacks()
instead, then delete this static function.
This brings the benefits of freeing TEMPS on all scope exists that
has already been introduced on sub exits; uses the optimised code for
creating mortal copies; and finally unifies all the different 'process
return args on scope exit' implementations into single function.
M embed.fnc
M embed.h
M pp_ctl.c
M pp_hot.c
M proto.h
M t/op/do.t
M t/op/grep.t
commit 5fb99868f32b3650611191d8178b3d6f5490dab0
Author: David Mitchell <[email protected]>
Date: Wed Dec 16 14:52:22 2015 +0000
make pp_return() use leave_adjust_stacks()
It was using S_leave_common(), but that's shortly to be removed. It also
required adding an extra arg to leave_adjust_stacks() to indicate where to
shift the return args to. This will also be needed for when we replace the
remaining uses of S_leave_common() with leave_adjust_stacks().
M embed.fnc
M embed.h
M pp_ctl.c
M pp_hot.c
M proto.h
commit 48241279bf2de0c4db8e32a67ca20b1c82fb19c2
Author: David Mitchell <[email protected]>
Date: Wed Dec 16 12:30:01 2015 +0000
make pp_leavesublv use S_leavesub_adjust_stacks()
Currently S_leavesub_adjust_stacks() is just used by pp_leavesub.
Rename it to Perl_leave_adjust_stacks(), extend its functionality
slightly, then make pp_leavesublv() use it too.
This means that lvalue sub exit gains the benefit of FREETMPS being done,
and (where mortal copying needs doing) the optimised copying code.
It also means there is now one less version of the "process args on scope
exit" code.
pp_leavesublv() still does a scan of its return args looking for things to
croak() on, but leaves everything else to leave_adjust_stacks().
leave_adjust_stacks() is intended shortly to be used in place of
S_leave_common() too, thus unifying all args-on-scope-exit code.
The changes to leave_adjust_stacks() in this commit (apart from the
renaming and doc changes) are:
* a new arg to indicate what condition to use to decide whether to
pass or copy the arg;
* a new branch to mortalise and ref count bump an arg
M embed.fnc
M embed.h
M pp_ctl.c
M pp_hot.c
M proto.h
commit b0908a4d3420dae57216d7766a6db796e6f28fc0
Author: David Mitchell <[email protected]>
Date: Mon Dec 14 12:10:45 2015 +0000
pp_leavesublv(): document PL_sv_undef exception
M pp_ctl.c
commit 042571a51be1b82f411b4ceec6de847a6c8af760
Author: David Mitchell <[email protected]>
Date: Mon Dec 14 11:55:14 2015 +0000
pp_leavesublv(): croak on *all* PADTMPs
pp_leavesublv() generally croaks on returned PADTMPs when called in lvalue
context. However, an exception was made in scalar context if the PADTMP
had set magic. This was to allow for things like
sub :lvalue { $tied{foo} }
and
sub :lvalue { substr($foo,1,2) }
However, it was later found that in places like pp_substr(), when
returning a PVLV, it should return a new mortal rather than upgrading
its pad target to PVLV, because the PVLV holds a reference to $foo which
then gets delayed being freed indefinitely.
Since places like pp_susbtr() no longer return lvalue PADTMPs, there's
no longer any need to make a special exception in pp_leavesublv().
I've added an assertion to the effect that PADTMPs don't have set
container magic, but I've added the assert to pp_leavesub() rather than
pp_leavesublv(), since the former is much likely to be used in many weird
situations and edge cases that would quickly flush out any false
assumptions.
If this assumption is wrong and the exception needs to be re-instated in
pp_leavesublv(), then presumably it needs adding to the ARRAY context
branch too - I'm assuming that its previous absence there was an oversight;
i.e.
sub foo :lvalue { $tied{foo}, substr($foo,1,2) }
foo() = (1,2);
should work too.
M pp_ctl.c
M pp_hot.c
commit 582caebc78bd002d7a79b189cbdc49e2ec77d530
Author: David Mitchell <[email protected]>
Date: Sun Nov 8 15:16:09 2015 +0000
pp_leavesub(): call FREETMPS and optimise
Currently pp_leavesub() doesn't call FREETMPS. Presumably this is due to
the danger of freeing temps that need to exist beyond the return, such
as the mortal copies we make of return args, or return args that are
already temps.
The down side of this is that temps aren't freed until the next nextstate
is executed following the function call. If the function isn't near a
statement boundary, then it may be a while before temps are freed; e.g.
in f(g()), when g() returns, its temps continue to exist during the call
to f(). For recursive subs it gets worse, although there is a specific
hack already in pp_leavesub() that says in scalar context if CvDEPTH > 1,
then temporarily RC++ the single return value then do a FREETMPS. This
can in theory leak if something dies during the FREETMPS.
This commit provides a more general solution. During the course of
processing (usually mortal copying) the return args, it divides the
current temps stack frame into two halves, with the temps that need
keeping migrating to the bottom half. It then does a FREETMPS equivalent
only of the top half.
This is actually more efficient than it sounds; but in addition, the code
has been heavily optimised: in particular the call to sv_mortalcopy()
has been unrolled and inlined, and within that code common cases (such as
IV, RV) handled directly, and the mortal stack is only checked/extended
once, rather than for every arg.
Also, the arg adjust / freetmps code has been moved out of pp_leavesub()
and into a separate static function.
M pp_hot.c
M t/op/sub.t
M t/perf/benchmarks
commit 0a1ad8296b93d49f5f1a89fe18c91044f8c0f140
Author: David Mitchell <[email protected]>
Date: Fri Dec 4 15:50:54 2015 +0000
move SET_SVANY_FOR_BODYLESS_IV() from sv.c to sv.h
Ditto for SET_SVANY_FOR_BODYLESS_NV.
The IV variant will shortly be needed in pp_hot.c, so make it
available outside sv.c. For now, protect with #ifdef PERL_CORE,
so as little as possible is changed by this commit.
M sv.c
M sv.h
commit 8c3e5ecfabbd435bee387bc8991f52218147dd0b
Author: David Mitchell <[email protected]>
Date: Mon Nov 16 14:40:04 2015 +0000
Perl_runops_debug(): do FREETMPS
In runops_debug() wrap the optional printing of next op, arg stack
etc with ENTER/SAVETMPS, FREETMPS/LEAVE - so that temporaries created by
the dump output are promptly freed, and thus don't alter the tmps stack.
(I'm trying to debug some tmps stack corruption, and running with -Dst
made the problem go away).
M dump.c
commit ae33939eefb9b6582c8476380d73f1fd0f969ab6
Author: David Mitchell <[email protected]>
Date: Mon Nov 9 21:11:58 2015 +0000
optimise sv_setsv_flags()
This commit does two things.
First, it streamlines and re-orders some of the initial tests,
such as 'is sstr already freed?'.
Second, it looks for a reasonably common case where both sstr and dstr are
SVt_NULL/SVt_IV. This covers undef, int and refs, where the SV hasn't
previously been used for other things (like strings).
With just SVt_NULL/SVt_IV, we know that the SV won't have a real body, and
won't need one and can be very quick.
The check for SVt_NULL/SVt_IV is a single compare-and-branch, so
has a minimal effect on users of sv_setsv_flags() that have more complex
types.
M sv.c
M t/perf/benchmarks
commit 82411118177d84ef4649e5f6443de39ec64af9ce
Author: David Mitchell <[email protected]>
Date: Sun Nov 8 20:08:20 2015 +0000
intrvar.h: document PL_tmps_max
Its name implies that it's the top allocated element; in fact it's top+1.
M intrpvar.h
commit f56b9c068e30792c9b3fd941a0b8d654b06e0a7a
Author: David Mitchell <[email protected]>
Date: Sun Nov 8 15:05:01 2015 +0000
pp_leavesub: reset SP in void context
In void context, pp_leavesub() doesn't bother resetting SP to the
base; either as an efficiency measure, or as an oversight (the other
pp_leavefoo functions do reset).
This is mostly harmless, as being void context, it's likely to immediately
execute pp_nextstate or similar, which will reset the stack anyway.
However with attributes, something like
my @foo :attr = ()
causes attributes::import() to be called in void context, and whatever
dross it leaves on the stack becomes part of the assign, i.e. that assign
becomes the equivalent of:
my (@foo, dross) = ()
which again is fairly harmless, if slightly inefficient.
However, the next commit should make pp_leavesub() call FRETMPS,
which means that 'dross' may now include freed SVs, which will make
pp_aassign choke.
This commit also requires ext/XS-APItest/t/call.t to be fixed.
Some tests in there (added years ago by myself) test the statu quo; that
is, it expects that calling call_sv(G_VOID) will leave return args on the
stack. Now it doesn't.
M ext/XS-APItest/t/call.t
M pp_hot.c
commit 3f807eb1b8e6df5213e736996a46e94e8e8b15f5
Author: David Mitchell <[email protected]>
Date: Sun Nov 8 19:19:02 2015 +0000
Perl_free_tmps(): don't test for PL_sv_undef
Each sv being popped off the tmps stack is compared against PL_sv_undef,
and if so, the SvTEMP_off(sv); SvREFCNT_dec_NN(sv); is skipped.
This condition was added by 8aacddc1 back in 2001, as part of a commit
to add support for hash placeholders. Initially it used &PL_sv_undef in
HE value slots to indicate a placeholder. In a later commit, that was
changed to &PL_sv_placeholder, but the test in free_tmps() continued
to test against &PL_sv_undef.
Im not sure what the original intent was, but I strongly suspect that
whatever purpose it may have originally served, it no longer served that
after the switch to PL_sv_placeholder.
On a purely pragmatic note, I can't see any harm in untemping PL_sv_undef;
at worst its ref count will occasionally reach 0, and the special code in
sv_free2() will reset its count to SvREFCNT_IMMORTAL. And no tests
fail....
M scope.c
commit dd1df767d5bb909e1e73a13e1a186d890b8f0d7d
Author: David Mitchell <[email protected]>
Date: Wed Oct 28 08:28:56 2015 +0000
restore PL_tmps_floor on exit
A couple of places were expecting dounwind(-1); LEAVE_SCOPE(0);
to restore PL_tmps_floor, since its old value was saved on the savestack.
Since that's now stored in the context struct instead, do
a POPBLOCK(&cxstack[0]).
This problem only showed up on 'make test' rather than 'make
test_harness', since only the former sets PERL_DESTRUCT_LEVEL.
M ext/XS-APItest/APItest.pm
M ext/XS-APItest/APItest.xs
M perl.c
commit f00de194977cf8d0326ac89470895b5ba1188171
Author: David Mitchell <[email protected]>
Date: Wed Oct 21 19:10:34 2015 +0100
extend magic copy test to all scope exit types
Commit v5.15.6-387-g6f48390 forced leavesub to copy returned items
if they were get-magical. Normally rvalue subs are supposed to return a
copy of their return args, but that copy is sometimes skipped if leavesub
thinks the side-effects will never be visible. Tied elements was an
example where the implementation leaked.
However, this applies equally well to other leave types, such as
do { ....}, so test for get magic in those too.
M pp_ctl.c
M t/op/gmagic.t
commit a94d18b7995a9a9580181f7259915a916f7a43df
Author: David Mitchell <[email protected]>
Date: Wed Oct 21 17:54:29 2015 +0100
test that pp_leavesub copies returned PADTMPs.
Although pp_leavesub() has in fact always done this, it was never actually
tested for.
M t/op/sub.t
commit 0d8164982c7b09c59836a70b6452859446008d2a
Author: David Mitchell <[email protected]>
Date: Wed Oct 21 13:10:44 2015 +0100
Always copy return values when exiting scope
v5.14.0-642-g3ed94dc fixed certain instances where returning from a sub
incorrectly returned the actual value rather than a copy, e.g.
sub f { delete $foo{bar} }
This was because if the value(s) being returned had SvTEMP set, copying
was skipped. That commit added an extra condition to the skip test,
SvREFCNT(sv) == 1.
However, this applies equally well to other scope exits, for example
do { ...; delete $foo{bar} }
So this commits adds the RC==1 test to S_leave_common() too, which handles
all the non-sub scope exits. As well as adding a test to do.t, it adds an
additional test to sub.t, since the original tests, although they
*detected* a non-copied return, didn't actually demonstrate a case where
it was actually harmful.
Note that S_leave_common() also sometimes skips on PADTMPs as well as
TEMPs, so this commit as a side-effect also makes it copy PADTMPs unless
their RC ==1. But since their RC should in fact almost always be 1 anyway,
in practice it makes no difference.
M pp_ctl.c
M t/op/do.t
M t/op/sub.t
commit aed2278b31f7169b8a8d5d207012950a5beec098
Author: David Mitchell <[email protected]>
Date: Wed Oct 21 12:28:35 2015 +0100
op/sub.t: fix ticket number in comment
Took me a while to track down that non-existent ticket!
M t/op/sub.t
commit bcdf41662f1ee68d1d069616f447a016cf541c59
Author: David Mitchell <[email protected]>
Date: Wed Oct 21 09:47:21 2015 +0100
make TOPBLOCK(cx) not set cx
i.e. replace
TOPBLOCK(cx);
with
cx = CX_CUR();
TOPBLOCK(cx);
This is part of general trend of separating out the cx/cxstack_ix
setting/manipulation from the save/restore actions
M cop.h
M pp_ctl.c
commit c6f5717a986158d8adab1b8de0eb68f36438fed6
Author: David Mitchell <[email protected]>
Date: Wed Oct 21 09:41:52 2015 +0100
rename DEBUG_CX() to CX_DEBUG()
For consistency with the new naming convention for context-stack macros.
Also, give it a cx arg rather than using CX_CUR()
M cop.h
M pp_ctl.c
commit 0e622d456d53cb687c4bd5123fe55db51fb9fd32
Author: David Mitchell <[email protected]>
Date: Wed Oct 21 09:28:52 2015 +0100
add CX_CUR() macro
This is simply
#define CX_CUR() (&cxstack[cxstack_ix])
M cop.h
M op.c
M perl.c
M pp.c
M pp_ctl.c
M pp_hot.c
M pp_sort.c
M pp_sys.c
M toke.c
commit a628541661de415c6856a18985f3da34786bd574
Author: David Mitchell <[email protected]>
Date: Mon Oct 19 17:21:58 2015 +0100
make POPSUBST re-entrant safe
M cop.h
commit 2ba2cb049e80330c17478203fb6a815dc5764f58
Author: David Mitchell <[email protected]>
Date: Mon Oct 19 17:14:58 2015 +0100
make POPGIVEN re-entrant safe
M cop.h
commit 2f694a4b46d75f5ca01b02e8ee5a2c0c69c7c248
Author: David Mitchell <[email protected]>
Date: Mon Oct 19 17:04:02 2015 +0100
make POPSUB re-entrant safe
M cop.h
commit 186ebc71e6445e4b1d3a5cd7e30e94a31d0b097f
Author: David Mitchell <[email protected]>
Date: Mon Oct 19 16:46:06 2015 +0100
make POPEVAL safe against re-entrancy
M cop.h
commit 524bc815b5168d6c1e5a3558c5723de8b103deae
Author: David Mitchell <[email protected]>
Date: Mon Oct 19 16:12:33 2015 +0100
make POPSUB and POPFORMAT re-entrant safe
In code like
sub DESTROY { exit }
sub f { push @_, bless [] }
f()
While leaving f, POPSUB will attempt to clear @_. This triggers the
destructor, which calls exit, which unwinds the context stack, calling
POPSUB again on thr same context stack entry.
Thus we need to to be careful that POPSUB can be called multiple times
on the same CX stack entry.
The general way of doing this is to NULL or update pointers *before*
calling SvREFCNT_dec() on the old value.
This commit also removes the old CxPOPSUB_DONE mechanism which was a poor
bandaid added at the last minute to 5.22 to try and achieve the basics
of what this commit does comprehensively (hopefully). Also, CxPOPSUB_DONE
was mainly a protection against re-entrantly calling LEAVE_SCOPE(). Since
that's now done before POPSUB rather than in the middle of it, it has
become reentrant-safe by default.
M cop.h
M pp_hot.c
M pp_sys.c
commit 2272bd5e5a98127c3ed59a0ae809cd5cdaf2d074
Author: David Mitchell <[email protected]>
Date: Sat Oct 17 15:22:05 2015 +0100
reorder 'struct block' fields.
On 64-bit builds, there was a 32-bit hole near the beginning. Shuffle this
towards the middle of the struct (just before the blk_u union).
Unfortunately this (moved) hole can't be filled by having an I32 at the
start of each union member, since struct block_eval is already the largest
and has no 32-bit fields.
Still, moving further on than some of the hotter fields can't hurt.
M cop.h
commit ce7cd0704182b82a0b4143db65989a7d4c5f1b8e
Author: David Mitchell <[email protected]>
Date: Sat Oct 17 14:52:50 2015 +0100
move and rename cx_old_savestack_ix
Earlier on in this branch I temporarily added cx_old_savestack_ix
as the first element in the context struct. This commit moves it down
32 bits so it now follows type/gimme/u16 in the sbu and blku unions.
This means that type is now back as the first item in the struct.
I've also renamed it blku_oldsaveix to be more in keeping with similar
field names.
M cop.h
M pp_ctl.c
M pp_hot.c
M pp_sort.c
M scope.c
commit 5bd15f6fcbe58b546ea3856d1b2869b31b57be6b
Author: David Mitchell <[email protected]>
Date: Sat Oct 17 13:24:30 2015 +0100
simplify two conditions in pp_iter:
- if (UNLIKELY(SvMAGICAL(av) || AvREIFY(av))) {
+ if (UNLIKELY(SvRMAGICAL(av))) {
This condition is deciding whether to call av_fetch or cheat and do
sv = AvARRAY(av)[ix].
The magic test is too broad: av_fetch() only handles the specially on
RMG, not all magic.
The AvREIFY condition was originally added by 64138690 in 2001. It was
an attempt to paper over the cracks if function args are deleted, then
iterate over @_, which now contains freed elements. Since pp_iter now
includes a 'freed sv' check itself, there's no need to call into av_fetch
which has a similar check.
This makes a slight functional change - previously if @_ contained a freed
element, av_fetch would silently return NULL; now instead, pp_iter
croaks with "Use of freed value in iteration", the same as it does with
all other cases involving freed elements being iterated over.
M pp_hot.c
M t/run/fresh_perl.t
commit 03aa2731c2f2a46bcef2e4a639f797b361ccaddb
Author: David Mitchell <[email protected]>
Date: Sat Oct 17 13:15:06 2015 +0100
PUSHLOOP_PLAIN: don't set unused fields
Currently PUSHLOOP_PLAIN sets a whole unch of fields that it isn't going
to ue to NULL or 0, e.g. blk_loop.itersave.
Skip this and leave them wild. Make cx_dump() not try to dump them for
CXt_LOOP_PLAIN
M cop.h
M scope.c
commit a30d78ec067583adc6727da4d4df1d702a659498
Author: David Mitchell <[email protected]>
Date: Sat Oct 17 12:56:15 2015 +0100
Eliminate cx->blk_loop.resetsp
Of all the loop types, only CXt_LOOP_LIST, i.e. for (1,2,3) {},
needs to keep anything on the stack, i.e. for all the others,
cx->blk_loop.resetsp can always equal cx->blk_oldsp.
For CXt_LOOP_LIST, the same value as resetsp is stored as
blk_loop.state_u.stack.basesp.
So we can eliminate the resetsp field. This is good as the loop substruct
is the largest (ITHREADS) or joint largest with eval (non-threaded).
Also, we now don't have to store that value for non-CXt_LOOP_LIST loops.
The downside is we now have to choose between basesp and oldsp in
pp_leaveloop and pp_last, based on CX type.
M cop.h
M pp_ctl.c
M scope.c
commit aed42d4c6d5389b7bb88434abd9b972cf4b2806e
Author: David Mitchell <[email protected]>
Date: Sat Oct 17 10:53:10 2015 +0100
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.
M pp_ctl.c
M pp_hot.c
commit b3681e53850e86935841827d7bdc41ce2a19afef
Author: David Mitchell <[email protected]>
Date: Sat Oct 17 00:18:44 2015 +0100
split CXt_LOOP_FOR into CXt_LOOP_LIST,CXt_LOOP_ARY
Create a new context type so that "for (1,2,3)" and "for (@ary)"
are now two separate types.
For the list type, we store the index of the base stack element in the
state union rather than having an array pointer. Currently this is just
the same as blk_resetsp, but this will shortly allow us to eliminate the
resetsp field from the struct block_loop - which is currently the largest
sub-struct within the block union.
Having two separate types also allows the two cases to be handled directly
in the main switch in the hot pp_iter code, rather than having extra
conditionals.
M cop.h
M lib/B/Op_private.pm
M opcode.h
M perl.h
M pp_ctl.c
M pp_hot.c
M regen/op_private
M scope.c
M sv.c
commit a5f4531da39889d7804ba5d0ae590476fa2b76ad
Author: David Mitchell <[email protected]>
Date: Fri Oct 16 16:20:47 2015 +0100
benchmarks: add some 'for' array iterating
M t/perf/benchmarks
commit 579a3fbedc83dc308ad91a5cf349644bc6dcf553
Author: David Mitchell <[email protected]>
Date: Fri Oct 16 14:32:26 2015 +0100
stop S_undo_inc_then_croak() doing CX_POP
I added this static function several commits commits ago but in hindsight
I don't like that a cx is passed to it and it does a CX_POP(cx). This is
too much like action at a distance. Instead make the caller save
cx->blk_eval.old_namesv and do the CX_POP itself, then pass namesv as an
arg.
M pp_ctl.c
commit ca5b164f6838ddbaed6e1dbe4267105bbd585084
Author: David Mitchell <[email protected]>
Date: Fri Oct 16 13:31:57 2015 +0100
pp_leaveeval: reset stack in VOID context
$ perl -Dst -e'eval"1"'
Gives:
....
((eval 1):1) leaveeval
=> (FREED)
Change it so that like all the other pp_leavefoo() functions, it does
if (gimme == G_VOID)
PL_stack_sp = newsp;
I can't think of any (non-debugging) perl-level badness the old behaviour
can be shown to demonstrate, but best not to have freed values left
dangling.
This also allows pp_leaveeval() to (like the other pp_leavefoo functions)
avoid doing a dSP with the associated unnecessary PUTBACKs and SPAGAINs.
Finally, the code to detect a false require is moved to earlier in the
function where it's in the same place as the rest of the stack arg
processing code.
M ext/XS-APItest/t/call.t
M pp_ctl.c
commit 94f2a462145e7ed502593716e1474aa6d67c4213
Author: David Mitchell <[email protected]>
Date: Fri Oct 16 13:07:23 2015 +0100
rename S_doeval() to S_doeval_compile()
This makes it a bit more obvious what niche in the "eval" ecosystem
that it occupies.
M cop.h
M embed.fnc
M embed.h
M pp_ctl.c
M proto.h
M t/op/eval.t
commit be2410056b72f2b09d8af711d4101005fae0721a
Author: David Mitchell <[email protected]>
Date: Fri Oct 16 12:19:44 2015 +0100
S_doeval(): tidy up comments
Also, replace
if (...) {
...
return;
}
else
B
with
if (...) {
...
return;
}
B
M pp_ctl.c
commit d205541789591f2979ed02916192a668a140c9ee
Author: David Mitchell <[email protected]>
Date: Fri Oct 16 12:00:46 2015 +0100
remove obsolete panic from die_unwind()
It panics if the context it has just popped back to isn't a CXt_EVAL.
Since we have just called dopoptoeval() which can only pop to an eval, and
since we assert that its an eval, this seems such an unlikely "this can
can never happen" that it doesn't really seem worth testing for.
It was added in perl5.000, and may have made slightly more sense then, as
there used to be a POPBLOCK just before it.
M pod/perldiag.pod
M pp_ctl.c
commit 2ddb78140be56689cd7ec728f7c1dbc2343c1fb0
Author: David Mitchell <[email protected]>
Date: Fri Oct 16 11:33:43 2015 +0100
pp_return: avoid potential CX stack realloc prob
M pp_ctl.c
commit 4d9e8abf526c223e299f060566c97e77eea48d65
Author: David Mitchell <[email protected]>
Date: Fri Oct 16 11:25:42 2015 +0100
Perl_die_unwind(): remove unneeded assert
Now that the order of things has changed, PL_curcop will always have just
been restored at this point. So there's no longer any needs to assert that
its the correct value.
M pp_ctl.c
commit a918f60efa83c22e5fd4fe058074996876fef8b2
Author: David Mitchell <[email protected]>
Date: Fri Oct 16 00:03:00 2015 +0100
add S_undo_inc_then_croak()
Consolidate into a single static function, code in 3 functions that all
'undo' an added %INC entry on failure, then croak.
M pp_ctl.c
commit d6ea01fc05a2bad44859344c36170ce9c6f1d8fb
Author: David Mitchell <[email protected]>
Date: Thu Oct 15 22:27:03 2015 +0100
POPEVAL: don't set optype
don't quietly set the local var optype; instead explicitly set it
in the couple of places its actually needed. This allows us to
get rid of a bunch of PERL_UNUSED_VAR(optype);
M cop.h
M pp_ctl.c
commit 443be2aba70253d4abd86fe8af28d1fc96ce7b05
Author: David Mitchell <[email protected]>
Date: Thu Oct 15 17:46:31 2015 +0100
add CX_POP(cx) macro: glorified cxstack_ix--
but with extra checking goodness on debugging builds.
M cop.h
M pp_ctl.c
M pp_hot.c
M pp_sort.c
M pp_sys.c
commit fbc7ae8d2fdd8af6b2efa038373edbc4010f17e7
Author: David Mitchell <[email protected]>
Date: Thu Oct 15 16:59:19 2015 +0100
simplify CHANGE_MULTICALL_FLAGS
But using POPSUB_COMMON(), we achieve commonality. This incurs the extra
overhead of restoring PL_comppad/PL_curpad, which is compensated for by
not having to temporarily protect PL_comppad in the following PUSHSUB.
M cop.h
commit ec74cbc3267ebcee1d4a5c1f5b7198baaaefaea8
Author: David Mitchell <[email protected]>
Date: Thu Oct 15 16:03:34 2015 +0100
remove redundant croak code in pp_leavesublv
Just before a code path that croaks, it does a POPSUB etc.
Since this will be done by the unwind following the croak anyway, it's
redundant.
M pp_ctl.c
commit a4c44059699bc11e9b3fe7f1081986a48d52c08d
Author: David Mitchell <[email protected]>
Date: Thu Oct 15 15:50:08 2015 +0100
factor common code into POPSUB_ARGS()
Some code that is common to POPSUB() and pp_coreargs, extract out
into a common macro. (There's some almost identical code in pp_goto,
so add a note there).
This makes pp_coreargs slightly less efficient, since it now tests for
AvREAL(av), when that should never be true. But it's not exactly hot code.
M cop.h
M pp.c
M pp_ctl.c
commit 0b6a3132165012c3eccc08cbf6090e586e92c696
Author: David Mitchell <[email protected]>
Date: Thu Oct 15 15:39:42 2015 +0100
pp_coreargs: rationalise @_ code
Make the code in pp_coreargs that cleans up @_ more like the code in
POPSUB, so that the two can eventually be extracted out into a common
macro.
M pp.c
commit 83224124098ef87f6264136f571020e97d7af68b
Author: David Mitchell <[email protected]>
Date: Thu Oct 15 14:58:35 2015 +0100
split some common POPSUB code into a macro
POP_MULTICALL duplicates some of the code in POPSUB, so extract it
out into a common macro.
M cop.h
commit 28f76dfddc1515d84714c9847de51aef0217a63f
Author: David Mitchell <[email protected]>
Date: Thu Oct 15 14:36:59 2015 +0100
make POPSUBST not cxstack_ix--
For consistency with with the new POPBLOCK, make POPSUBST(cx) no longer
set c nor decrement cxstack_ix. This also makes dounwind more consistent.
M cop.h
M pp_ctl.c
commit 1a2e64f6531ab41c54850c39b5300746c02bf513
Author: David Mitchell <[email protected]>
Date: Thu Oct 15 14:28:28 2015 +0100
dowinwind(): move common CX_LEAVE_SCOPE() outside
Now the every branch in the switch does CX_LEAVE_SCOPE(cx), hoist it
above the satrt of the switch.
M pp_ctl.c
commit 093daa3f14d902491c6236038a702b5356bd3b1e
Author: David Mitchell <[email protected]>
Date: Thu Oct 15 14:26:21 2015 +0100
dounwind: CX_LEAVE_SCOPE for CXt_SUBST too
This was the only branch that didn't clear up the context stack as
part of a context stack unwind.
M pp_ctl.c
commit 38ff44cd2671bc45b23aa7e889919cfe148e1636
Author: David Mitchell <[email protected]>
Date: Thu Oct 15 14:15:57 2015 +0100
move blku_old_savestack_ix to base of cxt struct
The previous commit moved the "old savestack" field of substitution
contexts into the shared root of the context union. This commit does the
same for all other context types
M cop.h
M pp_ctl.c
M pp_hot.c
M pp_sort.c
commit 6e4381b6ca942329d7edf999acec46d2cf26df0c
Author: David Mitchell <[email protected]>
Date: Thu Oct 15 14:04:09 2015 +0100
move sbu_oldsave into base of CX struct
the context struct is a union of two basic types: the substitution context
and everything else.
This commit moves the sbu_oldsave field from the substitution context
into the base of the context struct, so that the next commit will allow
the same field (and macros) to be used by *all* context types.
M cop.h
M pp_ctl.c
commit 51854f0b348206baebd13c6a574546fed0c455f3
Author: David Mitchell <[email protected]>
Date: Thu Oct 15 13:48:25 2015 +0100
move CX_LEAVE_SCOPE outside the POPFOO's
Currently every POPFOO macro has CX_LEAVE_SCOPE(cx) as its first action.
Since this is common code and not specific to a particular POPFOO type,
remove it from each POPFOO macro and make each caller of POPFOO explicitly
call CX_LEAVE_SCOPE() instead.
This should make no functional difference (but will help if you're
single-stepping the code in a debugger :-)
M cop.h
M pp_ctl.c
M pp_hot.c
M pp_sort.c
M pp_sys.c
commit a10b541405b6de7582f7f5a19cc1aa27e99adc46
Author: David Mitchell <[email protected]>
Date: Thu Oct 15 11:47:07 2015 +0100
do PL_tmps_floor save in PUSHBLOCK
Currently every individual PUSHFOO type does
cx->cx_u.cx_blk.blku_old_tmpsfloor = PL_tmps_floor;
PL_tmps_floor = PL_tmps_ix;
Move all these into PUSHBLOCK instead, which usually immediately precedes
the PUSHFOO.
M cop.h
M pp_sort.c
commit 43b114219169ef51bb104a698409ba3c582173e5
Author: David Mitchell <[email protected]>
Date: Thu Oct 15 11:34:41 2015 +0100
do PL_tmps_floor restore in POPBLOCK
Currently every individual POPFOO type does
PL_tmps_floor = cx->cx_u.cx_blk.blku_old_tmpsfloor
as its last action.
Move all these into POPBLOCK instead, which always immediately follows
the POPFOO.
M cop.h
M pp_sort.c
commit 58c5e26f962ffc991524df578ad6d03087b33a81
Author: David Mitchell <[email protected]>
Date: Thu Oct 15 11:16:14 2015 +0100
sort(!) out CXt_NULL and CXp_MULTICALL
A sort BLOCK is done using a CXt_NULL context type. Currently it has
the CXp_MULTICALL flag set. Remove this flag so that CXp_MULTICALL is
only set on CXt_SUB contexts.
Also add code comments in various places explainging that CXt_NULL is
likely to a sort BLOCK, and fix the comments in pp_return which said
a particular code path was only taken by sort BLOCK; it's also taken
be (?{...}) too.
M cop.h
M pp_ctl.c
M pp_sort.c
M sv.c
M t/re/re_tests
commit 36511db4bebc172d1bfd59ebab63c05918e28272
Author: David Mitchell <[email protected]>
Date: Thu Oct 15 08:52:18 2015 +0100
pp_sort: add missing CX_LEAVE_SCOPE()
The branch that does POPSUB has an implicit CX_LEAVE_SCOPE; the
other branch didn't; do add one for consistency. It's fairly harmless,
as pp_sort shortly afterwards does a LEAVE() anyway.
Also add an assertion to POPBLOCK that the save stack has been popped;
this is how I discovered the sort issue in the first place.
M cop.h
M pp_sort.c
commit 7f3676314c8130011890e3c9f3bce8a49bf3e08a
Author: David Mitchell <[email protected]>
Date: Mon Oct 12 15:33:56 2015 +0100
remove newpm param from POPBLOCK() macro.
Since all core usage of POPBLOCK now immediately restores PL_curpm,
there's no need to copy the old value to a temp var specified by the
caller; just make POPBLOCK itself restore PL_curpm in the same way that
it restores all the other PL_ vars.
M cop.h
M pp_ctl.c
M pp_hot.c
M pp_sort.c
M pp_sys.c
commit dfc3515b9e63648bccf4844dbf80e611464bded3
Author: David Mitchell <[email protected]>
Date: Mon Oct 12 14:56:35 2015 +0100
reverse the order of POPBLOCK; POPFOO
Currently most pp_leavefoo subs have something along the lines of
POPBLOCK(cx);
POPFOO(cx);
where POPBLOCK does cxstack_ix-- and sets cx to point to the top CX stack
entry. It then restores a bunch of PL_ vars saved in the CX struct.
Then POPFOO does any type-specific restoration, e.g. POPSUB decrements the
ref count of the cv that was just executed.
However, this is logically the wrong order. When we *enter* a scope, we do
PUSHBLOCK;
PUSHFOO;
so undoing the PUSHBLOCK should be the last thing we do. As it happens,
it doesn't really make any difference to the running, which is why we've
never fixed it before.
Reordering it has two advantages.
First, it allows the steps for scope exit to be the exact logical reverse
of scope exit, which makes understanding what's going on and debugging
easier.
It allows us to make the code cleaner.
This commit also removes the cxstack_ix-- and setting cx steps from
POPBLOCK; now we already expect cx to be set (which it usually already is)
and we do the cxstack_ix-- ourselves. This also means we can remove a
whole bunch of cxstack_ix++'s that were added immediately after the
POPBLOCK in order to prevent the context being inadvertently overwritten
before we've finished using it.
So in full,
POPBLOCK(cx);
POPFOO(cx);
is now implemented as:
cx = &cxstack[cxstack_ix];
... other stuff done with cx ...
POPFOO(cx);
POPBLOCK(cx);
cxstack_ix--;
Finally, this commit also tweaks PL_curcop in pp_leaveeval, since
otherwise PL_curcop could temporarily be NULL when debugging code is
called in the presence of 'use re Debug'. It also stops the debugging code
crashing if PL_curcop is still NULL.
M cop.h
M pp_ctl.c
M pp_hot.c
M pp_sort.c
M pp_sys.c
M regcomp.h
commit c7af4acb538bf23015355718dc81d98138e77413
Author: David Mitchell <[email protected]>
Date: Mon Oct 12 12:02:05 2015 +0100
make PL_tmps_floor restore consistent
On scope exit this is done:
PL_tmps_floor = cx->cx_u.cx_blk.blku_old_tmpsfloor;
This is mostly contained within the POPFOO macros; for those,
make it consistently the last entry in the macro. POPEVAL
didn't include this line; move it into the macro and out of the
various places where it's done explicitly.
This will allow us to move it into a revamped POPBLOCK macro shortly.
M cop.h
M pp_ctl.c
commit 0d76b9ce2b39ae35780b241bfb560d37d9c0aa36
Author: David Mitchell <[email protected]>
Date: Sun Oct 11 15:58:06 2015 +0100
simplify S_leave_common() and callers
Currently one of the args to S_leave_common() is supposed to be the
current stack pointer; it returns an updated sp. Instead make it get/set
PL_stack_sp directly.
e.g. in the caller, replace
dSP;
SP = S_leave_common(..., SP, ...);
PUTBACK;
with
S_leave_common(..., ...);
and in S_leave_common(), make it initially get PL_stack_sp, and before
returning, update PL_stack_sp.
M embed.fnc
M embed.h
M pp_ctl.c
M proto.h
commit 0d20f877c1dfa19706be316e903ff4b278affa55
Author: David Mitchell <[email protected]>
Date: Sat Oct 10 23:41:15 2015 +0100
eliminate weird gimme calc in pp_leave()
Some code in pp_leave that's been around in one form or another since
5.000, calculates the value of gimme in a complicated way, rather than
just using the saved value in the current context, like all the other
pp_leave* functions do.
I think this code is redundant; running the test suite with an assert that
the extra calculation doesn't change anything, doesn't produce any failures.
So out it goes.
(In particular. cxstack_ix can never be < 0 here.)
M pp_ctl.c
commit f06d5f958a7a2df607cc24a96b731a8f2b5cdb8e
Author: David Mitchell <[email protected]>
Date: Sat Oct 10 23:22:30 2015 +0100
eliminate LEAVESUB() macro
Many years ago, POPSUB was split into two parts, with a final cleanup
being done by the LEAVESUB() macro. After the previous commit, LEAVESUB
now always immediately follows POPSUB, so roll its action into the
last line of POPSUB and eliminate it.
This also allows us to remove the 'sv' parameter from POPSUB(), which
was needed purely to communicate to LEAVESUB() which var to process
M cop.h
M pp_ctl.c
M pp_hot.c
M pp_sort.c
commit a9372be0863f8871270d70f9fbf2f0cc8c75af41
Author: David Mitchell <[email protected]>
Date: Sat Oct 10 23:10:23 2015 +0100
make LEAVESUB() always immediately follow POPSUB()
Many years ago, POPSUB was split into two parts, with a final cleanup
being done by the LEAVESUB() macro. This is no longer needed;
shuffle LEAVESUB up a bit in various places so that it always immediately
follows POPSUB. Then the next commit will eliminate it altogether.
M cop.h
M pp_ctl.c
M pp_hot.c
commit c6b907690e9e320e9ca9f86aaefd1094cf03ed20
Author: David Mitchell <[email protected]>
Date: Sat Oct 10 23:01:55 2015 +0100
move CX_LEAVE_SCOPE into POPEVAL
All the other POPFOO types have CX_LEAVE_SCOPE as their first action.
Add it as the first action of POPEVAL too, and remove all the explicit
calls to CX_LEAVE_SCOPE dotted around near POPEVALs.
Note that this causes a slight change in behaviour in dounwind:
the CX_LEAVE_SCOPE is now done as the first action of POPEVAL there
rather than being done afterwards. This is now consistence will all other
uses of POPEVAL.
M cop.h
M pp_ctl.c
commit 325c9449d0824892ad1ccb4a6b4678ef9b257905
Author: David Mitchell <[email protected]>
Date: Sat Oct 10 22:49:46 2015 +0100
add CX_LEAVE_SCOPE(cx) macro
which is shorthand for
LEAVE_SCOPE(cx->cx_u.cx_blk.blku_old_savestack_ix)
This is the start of a new breed of macros designed to manipulate the
conetect stack, that have a CX_ prefix, that will eventually superede
the (PUSH/POP)(BLOCK/SUB/ETC) system.
M cop.h
M pp_ctl.c
M pp_hot.c
commit 068e27d8f36c813e70eb7850dc8250ec92dc364d
Author: David Mitchell <[email protected]>
Date: Sat Oct 10 22:38:54 2015 +0100
call LEAVE_SCOPE() before POPEVAL()
All the other POPFOO() types have
LEAVE_SCOPE(cx->cx_u.cx_blk.blku_old_savestack_ix);
as their first action.
POPEVAL doesn't include this. Instead, each place that does POPEVAL()
currently does a LEAVE_SCOPE() sometime shortly afterwards.
This commit moves all those LEAVE_SCOPE()s to just before each POPEVAL()
to make the behaviour like all the other context types.
This is the logically correct order: process all the savestack items
accumulated during the eval before popping the eval itself.
M pp_ctl.c
commit f921512adda26e172bed4811988f18cb6b01d5c9
Author: David Mitchell <[email protected]>
Date: Sat Oct 10 22:23:19 2015 +0100
POPBLOCK: don't set newsp and gimme
This macro used to set these two vars as a side-effect.
Since we now usually access those values before we call POPBLOCK,
it's wasteful to set them again.
M cop.h
M pp_ctl.c
M pp_sort.c
M pp_sys.c
commit 8443fb5057c1dd28871e5194a7edd8a13291906c
Author: David Mitchell <[email protected]>
Date: Sat Oct 10 16:31:28 2015 +0100
move POPBLOCK after arg stack munging
In various places where scope is left (pp_leave, pp_leavesub etc)
the perl argument stack is processed: a combination of shifting return
args down and mortalising or copying them. This is typically done in
S_leave_common() (although pp_leavesub(lv) roll their own).
Normally POPBLOCK() is called just before this, which
a) initialises cx;
b) sets newsp, gimme etc which are needed by S_leave_common()
c) restores a bunch of PL_ vars from the saved values in cx.
Logically, (c) should be the last thing done in the various pp_leave*
functions, as saving the vars is the first thing done in the various
pp_enter* functions.
This commit moves POPBLOCK after S_leave_common() as a first step towards
migrating it towards the end of the various functions.
It shouldn't make any functional difference, as the values of the various
restored vars aren't used by the arg munging code.
M pp_ctl.c
M pp_hot.c
commit ae5fed48ae2a4761b7200fd11e21b6008991fa04
Author: David Mitchell <[email protected]>
Date: Sat Oct 10 15:39:53 2015 +0100
add PUSH/POPBASICBLK macros.
Most contexts types have a pair, e.g. PUSHSUB/POPSUB for CXt_SUB.
Add them for a basic block too, CXt_BLOCK, i.e. pp_enter/pp_leave.
It makes things slightly more regular ahead of future refactoring.
M cop.h
M pp_ctl.c
commit f0c71675cfc8d7288156eb5b18c2a17aa89976e2
Author: David Mitchell <[email protected]>
Date: Mon Oct 5 16:59:05 2015 +0100
pp_leavewhen(): skip POPWHEN()
pp_leavewhen at some point will do an unconditional dounwind()
to pop the WHEN, BLOCK, and any other intermediate contexts, till it
returns to the enclosing FOR or GIVEN context. Thus there is no need to do
an initial POPBLOCK()/POPWHEN(), as this will be done by dounwind.
We just need to grab a couple of values from the top (GIVEN) context
to go arg stack processing correctly.
M pp_ctl.c
commit 0de06b956384168a3e6b057892def7f392a1b268
Author: David Mitchell <[email protected]>
Date: Mon Oct 5 16:23:07 2015 +0100
pp_leavewhen: simply for() handling
when returning control to an enclosing for loop, the next op to execute
(i.e. my_op->op_nextop) will be an OP_UNSTACK, which handles popping stuff
of stacks and doing PERL_ASYNC_CHECK(); so no need to do it here too.
M pp_ctl.c
commit 10f78c2aa307a6586173e53374b801ac441d174d
Author: David Mitchell <[email protected]>
Date: Mon Oct 5 15:50:18 2015 +0100
rename S_dopoptogiven() to S_dopoptogivenfor()
Since it searches the context stack for the next GIVEN *or* FOR LOOP
context, make the name better express its purpose.
M embed.fnc
M embed.h
M pp_ctl.c
M proto.h
commit 14c4289aa21827e210e0f6487644d5d6a2945b49
Author: David Mitchell <[email protected]>
Date: Mon Oct 5 14:48:35 2015 +0100
add loop benchmark tests
M t/perf/benchmarks
commit a7ae5a457ba1810f8ff2bb299fb640b322229550
Author: David Mitchell <[email protected]>
Date: Fri Aug 28 16:11:50 2015 +0100
Make remaining context types avoid ENTER/LEAVE
Previous commits have made the 'subbish' context types like SUB, EVAL
use the context stack to save the old values of PL_savestack_ix and
PL_tmps_floor rather than using ENTER/SAVETMPS/LEAVE; extend this
to the remaining contexts types; specifically loops, bare blocks and
given/when.
Note that this means that during context stack unwinding (e.g. in
dounwind()), LEAVE_SCOPE() is called for every context popped, whereas
before it was only done for each subbish context type.
This makes the ordering of the actions in scope unwinding match much more
closely the reverse order in which things were done during scope pushing;
for example entering and leaving a for loop will now do:
PUSHLOOP_FOR();
...
... code within loop which pushes stuff on the savestack
...
LEAVE_SCOPE(); /* pops the stuff from above */
POPLOOP();
The main reason for this commit (apart from increased consistency)
is that its a lot faster.
M cop.h
M pp_ctl.c
M pp_hot.c
commit 0e87d215dccf1a14659e7ec17153d8e629e74012
Author: David Mitchell <[email protected]>
Date: Mon Oct 5 10:57:09 2015 +0100
Consistently call leave_common() before POPFOO
In some places the code does
POPBLOCK(); POPFOO(); leave_common();
while in other places it does
POPBLOCK(); leave_common(); POPFOO();
Make it do the latter consistently. This is because the next commit
will make *all* context types do a LEAVE_SCOPE(), not just the 'subish'
ones as now. This means that any context type that can return args needs
to preserve its args before doing the LEAVE_SCOPE()/POPFOO(), not just the
sub ones.
For example this lexical var is declared within a LOOP_PLAIN:
sub foo {
{
my $x = 1;
$x;
}
}
where the return value of the loop block ($x) is also the return value of
the sub. So let leave_common() make a mortal copy of $x before POPLOOP
frees the lexicals in the inner scope.
Similar comments apply to calling leave_common() before calling
dounwind().
Note that where the LEAVE_SCOPE() is located it not yet consistent;
sometimes it's part of the POPFOO macro, sometimes it's not, and so has to
be done explicitly just before calling POPBAR.
M pp_ctl.c
commit 9905d039b443c31c675d6c93d345ececb879e26a
Author: David Mitchell <[email protected]>
Date: Fri Oct 2 17:28:00 2015 +0100
pp_given: avoid using savestack for old var
Add a new field, defsv_save, to struct block_givwhen, and use this
to save the previous $_ in 'when(expr)' rather than saving it on the save
stack.
Also add POPWHEN and POPGIVEN macros. The former is a no-op for now.
M cop.h
M pp_ctl.c
commit 351fe86a0cd8e1e0860c4d2e0768abbe68eb4f64
Author: David Mitchell <[email protected]>
Date: Fri Aug 28 15:37:23 2015 +0100
context: move couple of fields into block struct
A few of the block_foo substructs within the context struct have the
same two fields, old_savestack_ix and old_tmpsfloor. Move these into the
basic block struct so they can be used by all blockish context types.
This is basically a big renaming exercise and should make no functional
difference.
M cop.h
M pp_ctl.c
M pp_hot.c
M pp_sort.c
commit 34e1c4ab895847e0e2ec352962175d090a189da8
Author: David Mitchell <[email protected]>
Date: Fri Aug 28 08:37:42 2015 +0100
pp_enteriter, POPLOOP: simplify some code
merge some common code from branch arms and tidy up. Shouldn't make
any functional difference.
M cop.h
M pp_ctl.c
commit d7a609ce0693b59cf78bde15f7dca988b2808963
Author: David Mitchell <[email protected]>
Date: Fri Aug 28 08:21:05 2015 +0100
pp_enteriter: don't create new SV for GvSV slot
Currently in
for $pkg_var (...) {}
pp_enteriter() saves the current SV that's in the GvSV slot, then
replaces it with a newSV(0). Instead, leave it untouched. In the range
cases:
for $pkg_var (1..10) {}
for $pkg_var ('a'..'z') {}
a new SV will be created anyway in the first call to pp_iter(), since each
time round the loop it checks whether the refcount of the iterator vars is
greater than 1 and if so abandons it.
For the list case, e.g.
for $pkg_var (1,3,5) {}
for $pkg_var (@foo) {}
each call to pp_iter updates the GvSV slot to point to the current var,
so sticking a null SV in there initially, and freeing it the end is just
pointless extra work.
The only slight proviso is when the GvSV slot is initially NULL. In this
rare case we still create the SV, as it will be needed for the range
cases.
M pp_ctl.c
M t/op/for.t
commit 6af8c8d51d17ab2901770c19038c32d1a91e1fdf
Author: David Mitchell <[email protected]>
Date: Thu Aug 27 16:03:42 2015 +0100
add CXp_FOR_PAD, CXp_FOR_GV flags
These indicate that the loop is a for loop, with a lexical or package
iterator variable.
These flags make various tests simpler and more efficient.
This commit also fixes a bug introduced a couple of commits ago;
I was assuming that in POPLOOP, itersave being non-NULL indicated a
'for $lex' or 'for $pkg', but something like
local *x;
for $x (..) {}
leaves the loop with itersave set to NULL. Instead we can use the new
flags to indicate that itersave is valid.
M cop.h
M pp_ctl.c
M t/op/for.t
commit d34101e8562ed5aa88ad013aeb213d55217a557e
Author: David Mitchell <[email protected]>
Date: Thu Aug 27 14:45:13 2015 +0100
pp_enteriter: tidy itervar-setting code
rename itervar to itervarp since it's more like an SV** than an SV*,
and set itersave earlier so that it can be used directly rather than
repeatedly dereffing itervarp.
Shouldn't be any functional change.
M pp_ctl.c
commit 4d3bde55a27fb9080c42c5b0de3fa4bf1862238e
Author: David Mitchell <[email protected]>
Date: Thu Aug 27 13:43:49 2015 +0100
for loops: don't refcount bump orig var
In something like
for $pkg_var (...)
pp_enteriter() bumps the reference count or $pkg_var before making
itersave point to it. POPLOOP later decrements this ref count.
This bump is unnecessary; since we are effectively transferring ownership
(and thus ref count contribution) of the $pkg_var SV from the GvSV slot of
*pkg_var to the itersave slot of the context struct, the overall ref count
of the var should remain unchanged.
So skip the bump and later undo. This should make no functional difference;
it's just more efficient.
M cop.h
M pp_ctl.c
commit a29f5a8ddd3ab66a95081f4c7a64411312e5cef3
Author: David Mitchell <[email protected]>
Date: Thu Aug 27 13:40:20 2015 +0100
POPLOOP(): no need to mortalise current item
Now that pp_return() protects its return arg(s) against premature freeing
before calling dounwind(), there's no need for POPLOOP to mortalise the
current item.
M cop.h
commit 55ee8b25145b2b13ec4184ef30241d38101950db
Author: David Mitchell <[email protected]>
Date: Wed Aug 19 12:33:24 2015 +0100
Add itersave field to LOOP context struct
When entering a for loop, rather than saving the original loop variable on
the save stack, save it in the context struct. Quicker and simpler.
Note that as of this commit, entering a for loop no longer saves anything
on the save stack.
M cop.h
M pp_ctl.c
commit 089e3ba246d8cca847c879522b73642a77344a16
Author: David Mitchell <[email protected]>
Date: Thu Aug 27 12:13:58 2015 +0100
POPLOOP: call LEAVE_SCOPE()
in PUSHLOOP, save the current PL_savestack_ix, and in POPLOOP, do
LEAVE_SCOPE(cx->blk_loop.old_savestack_ix);
This is in preparation for shortly not wrapping loops in ENTER/LEAVE.
M cop.h
commit 9ddfd451a9abc83ee345834488b31e567b62e76e
Author: David Mitchell <[email protected]>
Date: Thu Aug 27 12:02:27 2015 +0100
pp_return(): reindent following previous commit
whitespace-only change
M pp_ctl.c
commit f97d9e51242debfe1bd2e4c9b943b07d8211e365
Author: David Mitchell <[email protected]>
Date: Tue Aug 25 13:57:55 2015 +0100
pp_return(): handle dounwind() freeing args
Currently only POPSUB (and other sub-like contexts, such as POPEVAL) do a
LEAVE_SCOPE() as well as restoring things from the context struct. This
means that if pp_return() does a dounwind() to pop back to the next
SUB/EVAL/FORMAT context, LEAVE_SCOPE() won't get called, and any return
values aren't prematurely freed, e.g. in the following
sub f {
for (...) {
my $x = 1;
return $x;
}
}
POPLOOP() won't call LEAVE_SCOPE(), so $x doesn't get freed.
The next commit is about to change that: POPLOOP() will indeed call
LEAVE_SCOPE(), (and later commits may make other POPFOO() types do that
too). So in preparation, this commit makes pp_return() preserve any return
args before calling dounwind().
M pp_ctl.c
M t/op/sub.t
M t/op/sub_lval.t
commit b2d2d2c2d723c9c3b7ab32b7a68be1b761e4c002
Author: David Mitchell <[email protected]>
Date: Wed Aug 26 11:34:59 2015 +0100
pp_leaveloop: use SVs_PADTMP|SVs_TEMP
When calling leave_common(), most callers specify the "safe" return SVs
that don't need copying as being those with SVs_PADTMP or SVs_TEMP
set (leaveeval is a correct exception to this this).
pp_leaveloop() specified no flags, meaning that it always copies. This
appears to be just be an oversight rather than being for any good reason.
M pp_ctl.c
commit c97d4cc9882249736fd27513895e979da9037c06
Author: David Mitchell <[email protected]>
Date: Wed Aug 26 09:53:09 2015 +0100
S_leave_common(): simplify SVs_PADTMP handling
Now that SVs_PADTMP is a simple flag again (at one point its meaning was
inferred from the state of two flags) it no longer needs special handling
in S_leave_common().
M pp_ctl.c
commit f4a461ca5f8f9749203825ebb281073a043946d8
Author: David Mitchell <[email protected]>
Date: Sun Jul 19 10:51:38 2015 +0100
for my $x (...): $x is always stale
Remove the code in pp_enteriter that turns $x's staleness off and schedules
on the save stack for it to be turned back on at scope exit.
Since 'for my $x' works by making $x's pad slot temporarily point to
each item in turn, the "real" $x which lives in the pad outside of loop
time can never be accessed by the usual closure tricks (BEGIN, eval,
nested named subs etc) during a loop, so doesn't need to be marked as not
stale.
Skipping this step is one less thing to be pushed onto the save stack
on each for loop entry.
M pp_ctl.c
commit 54fd2c4e320196b5bc2527b715c52e9527f251c7
Author: David Mitchell <[email protected]>
Date: Fri Jul 17 23:22:29 2015 +0100
pp_last: use debugging LEAVE variant
Make the two LEAVEs in pp_last() be instead
LEAVE_with_name("loop2");
LEAVE_with_name("loop1");
which is more self-documenting and will trap mistakes on DEBUGGING builds
M pp_ctl.c
commit 1d2cd60b77ef2abc731edca2b992d392c3cf9d48
Author: David Mitchell <[email protected]>
Date: Fri Jul 17 22:49:40 2015 +0100
only call leave_common in non-void context
A lot of the pp_leave* functions call S_leave_common() to process
any return args. Since many of these tend to be used in void context
(e.g. plain blocks {; ... }, for loops etc) tst gimme and only call
these function is non-void. For void context the function is mostly
a noop anyway; the only thing we're skipping is TAINT_NOT, which
doesn't matter in void context.
M pp_ctl.c
commit 346e1eec7f76bbe7d3b28891c4ed1ff58e55497a
Author: David Mitchell <[email protected]>
Date: Fri Jul 17 22:23:51 2015 +0100
CXt_EVAL: save savestack_ix and tmps_floor in CX
In the various places that do PUSHEVAL (eval, require etc), eliminate
ENTER; SAVETMPS
and instead save the old values of PL_savestack_ix and PL_tmps_floor
directly in the eval context frame, similarly to how subs have been
recently changed.
This is faster and cleaner.
M cop.h
M pp_ctl.c
commit cc876c89048d598ee555be10c72659a10c56190c
Author: David Mitchell <[email protected]>
Date: Fri Jul 17 21:51:25 2015 +0100
move SAVETMPS next to PUSHEVAL
In the various places where PUSHEVAL() is used, a SAVETMPS appears
shortly before it. Move each occurrence of SAVETMPS to just after the
SAVETMPS, in preparation shortly for making PUSHEVAL responsible for
saving PL_tmps_floor.
In theory this could make certain temporary items created during
eval/require startup to be freed slightly later. I don't know whether
this is is an issue or not. No tests fail ;-)
M pp_ctl.c
commit 393ccc4026e7eb593bef9ed49912e5e31e770880
Author: David Mitchell <[email protected]>
Date: Fri Jul 17 14:44:32 2015 +0100
call_sv(), fold_const(): different CX pop test
Perl_call_sv() and S_fold_constants() both have similar code that:
pushes an EVAL context, does a JMPENV_PUSH() and CALLRUNOPS(), then
optionally pops the EVAL context.
The optionally part depends on whether what's doing the dying
has already popped the context before long-jumping. Currently the decision
on whether to pop is based on whether the scope stack has already been
popped.
This commit changes that to whether the context stack has already been
popped, since shortly we're going to change eval contexts so that the old
savestack_ix is stored in the CX struct rather than on the scope stack.
I ran this code with some asserts that the two conditions were identical,
and nothing failed.
M op.c
M perl.c
commit 75593ab3dc5583d2233e6dd9d8d6f8732cc39f44
Author: David Mitchell <[email protected]>
Date: Thu Jul 16 14:44:06 2015 +0100
CXt_FORMAT: save ss_ix and tmps_floor in CX struct
To match the recent work in this branch on CXt_SUB, make CXt_FORMAT save
PL_savestack_ix and PL_tmps_floor in the context structure rather than
doing ENTER/SAVETMPS. It's more efficient and more consistent.
M cop.h
M pp_sys.c
commit 2884e25a17248ee73ec6ee743a661557bbfae134
Author: David Mitchell <[email protected]>
Date: Mon Jul 13 16:31:20 2015 +0100
pp_entersub(): reduce life of padlist var
only set it when it's needed
M pp_hot.c
commit 34cfa529c18a7605280fc6007f04476b78fd78db
Author: David Mitchell <[email protected]>
Date: Mon Jul 13 16:25:36 2015 +0100
pp_entersub: unroll some CvFLAGS(cv) tests
Do a single bit comparison rather than two conditionals. Slightly faster.
M pp_hot.c
commit 1e63cf017c93ab980cb63c0ca9e35c40f08d0530
Author: David Mitchell <[email protected]>
Date: Mon Jul 13 16:18:55 2015 +0100
pp_entersub(): reduce scope of gimme
Only calculate the gimme var where its needed.
M pp_hot.c
commit cb74d463f39b973f2bf02cc3eb137fea745c1dc9
Author: David Mitchell <[email protected]>
Date: Mon Jul 13 13:11:01 2015 +0100
pp_entersub(): don't prematurely calc hasargs
Currently at the top of pp_entersub() is:
const bool hasargs = (PL_op->op_flags & OPf_STACKED) != 0;
Defer testing this flag and/or saving it to a local var until
its actually needed. This is a micro-optimisation.
M pp_hot.c
commit 025ceb3549b6d07872ceade5a46e9f34d4e99608
Author: David Mitchell <[email protected]>
Date: Mon Jul 13 12:48:17 2015 +0100
revamp pp_entersub()'s CV locating code
The big switch statement at the top of pp_entersub() is intended
to extract the CV from the passed argument, which might be a CV, a GV,
a ref to a CV, etc etc.
In 5.22.0, an optimisation was added to stashes such that if an entry
contained only a CV, then a ref to the CV was stored in the stash, rather
than a GV. This means that in the common case for a plain sub call, sv is
now a ref to a CV rather than a GV. So update the code to:
1) remove the special-casing of GVs;
2) add special casing for the sv being a non-magical, non-overloaded RV
pointing to a CV;
3) add special casing for the sv being a CV (true on method calls);
3) move the rare "sv == &PL_sv_yes" test further down the condition chain;
4) generally rearrange the switch cases so that common things fall though
and uncommon things do a goto;
5) sprinkle more LIKELY() pixie dust.
Part of the intention of special-casing is to avoid doing an indirect
branch by avoiding the switch statement completely.
M pp_hot.c
commit fc5aeb21b55b4f0e064bcb8ae5b029f5498da5bb
Author: David Mitchell <[email protected]>
Date: Mon Jul 13 11:48:04 2015 +0100
tweak POPSUB()
re-order things slightly in POPSUB() so that values aren't being
read into local vars before they're needed (so the compiler doesn't
have to write the values back out to the local stack frame if it runs out
of spare registers).
Also, re-order the fields in struct block_sub so that they roughly
correspond with the order in which they are accessed by POPSUB. This is on
the voodoo theory that if the struct straddles a cache line, we may
trigger a prefetch of the second line, so the extra data will be ready for
us when we need it.
M cop.h
commit 0e3373bc35772dc8205f5f3185e0e2185ff0f08c
Author: David Mitchell <[email protected]>
Date: Sat Jul 11 22:13:51 2015 +0100
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.
M cop.h
M pp_ctl.c
M pp_hot.c
M pp_sort.c
M t/op/sub.t
commit 023633b52fbd18dffb57baad4fbc40f9cbf2d35c
Author: David Mitchell <[email protected]>
Date: Sat Jul 11 16:43:25 2015 +0100
pp_hot.c: skip unnecessary test
This condition:
!CvROOT(cv) && !CvXSUB(cv)
can be simplified because those two cv fields are actually
the same slot in a union.
M pp_hot.c
commit cf1fb11bc084eba717189be90090eca0fe58b2b4
Author: David Mitchell <[email protected]>
Date: Sat Jul 11 15:37:11 2015 +0100
pp_entersub(): simplify autoload logic
eliminate a label and goto by by just setting cv to null on failure,
and have a single "if (!cv) croak()" test at the end of the loop.
M pp_hot.c
commit 27645bf62024766abce7ffc2f089628b8a8c1f44
Author: David Mitchell <[email protected]>
Date: Sat Jul 11 15:30:38 2015 +0100
pp_entersub(): eliminate a label
replace:
retry:
if (A) die;
if (B) {
...;
goto retry;
}
with
while (B) {
...;
}
if (A) die;
it's functionally equivalent except that the A test is now only
tried after we have been successful at B. This is ok, because
A is testing for an uncloned closure prototype, while B is looking
for a CV stub which needs autoloading,and it doesn't rally matter
which we test for first.
M pp_hot.c
commit 1b15bce4504de9705001d20d66ac95d527813e9b
Author: David Mitchell <[email protected]>
Date: Sat Jul 11 14:42:56 2015 +0100
add old_tmpsfloor field to CXt_SUB context frame
Rather than saving and restoring PL_tmps_floor on subroutine entry/exit
by using SAVETMPS and the save stack, store the old value directly
in the context struct and make PUSHSUB/POPSUB handle the saving and
restoring.
M cop.h
M pp_ctl.c
M pp_hot.c
M pp_sort.c
commit 15afaca2a77228da8ab6d0057a22a1ecf48dc8fa
Author: David Mitchell <[email protected]>
Date: Sat Jul 11 14:16:29 2015 +0100
PUSH_MULTICALL: move SAVETMPS later
Move the SAVETMPS to just after the PUSHSUB. This should make no
functional difference, because nothing should have affected the TMPS stack
between the old and the new code positions.
M cop.h
commit 98f853da577fec20a5997cbcd8eb50a6f60eacb3
Author: David Mitchell <[email protected]>
Date: Sat Jul 11 14:04:59 2015 +0100
pp_dbstate: do SAVETMPS etc in both branches
pp_dbstate() does an XS or non-XS subroutine call to &DB::DB;
move the SAVETMPS from before the (if CvISXSUB(cv)) test to the head of
both branches. This duplication of code is currently a noop, but will
shortly allow us to handle things differently in the two branches.
M pp_ctl.c
commit ae0dfa92c73c825eced610e4fa1883f1750eb03c
Author: David Mitchell <[email protected]>
Date: Sat Jul 11 13:58:47 2015 +0100
pp_sort: move SAVETMPS later
Move the SAVETMPS to just after the PUSHSUB. This should make no
functional difference, because nothing should have affected the TMPS stack
between the old and the new code positions.
For the OPf_SPECIAL/ CXt_NULL case, which doesn't do a PUSHSUB,
do another SAVETMPS there too.
M pp_sort.c
commit 7721dc902c9b7abd581a425b30a6256a230be421
Author: David Mitchell <[email protected]>
Date: Sat Jul 11 13:45:01 2015 +0100
pp_goto: do SAVETMPS etc in XS and non-XS branches
Move a SAVETMPS;SAVEFREESV(cv); from before the "if (CvISXSUB(cv))" test
to the head of both branches. This duplication of code is currently
a NOOP, but will shortly allow us to handle things differently in the two
branches.
M pp_ctl.c
commit 16a2f9a634ff92eb3c2681dd6cbe54489e52d22a
Author: David Mitchell <[email protected]>
Date: Sat Jul 11 13:32:03 2015 +0100
pp_entersub(): move SAVETMPS next to PUSHSUB
It it intended that eventually PUSHSUB() will do the SAVETMPS itself,
so move the SAVETMPS up so that it's next to the PUSHSUB.
There should be nothing between those two points that use the TEMPS stack,
so this commit should have no functional effect.
M pp_hot.c
commit 38a49e1cadffc5ae85e6bf67e23e5371a62c9a5d
Author: David Mitchell <[email protected]>
Date: Sat Jul 11 13:10:00 2015 +0100
pp_entersub(): remove an unnecessary condition
The code that scans the args list making mortal copies is protected by an
if (LIKELY(hasargs)) {
However, a sub called as "&foo;" (which is how hasargs is determined)
won't have pushed anything on the stack, so the first part of that code
block, "while (svp < SP)", will drop out immediately.
So skip doing the hasargs test.
NB - it's possible in theory for XS code to call call_sv() jn such a way
as to both have !hasargs but with stuff on the stack; in this worst case,
we just waste a bit of time making some mortal copies of those args.
M pp_hot.c
commit 1ae5b042fe856effb0aaa3bba005e5d35cbfb367
Author: David Mitchell <[email protected]>
Date: Sat Jul 11 12:43:43 2015 +0100
pp_entersub(): mortal-copy args earlier
Move the code earlier which makes a mortal copy of any PADTMP args.
This should make no functional difference, but will shortly allow
us to move the SAVETMPS earlier too (while still coming after the
mortal copying).
M pp_hot.c
commit 21e45055cf1c91a11f5e59a1e4ebadee116b96eb
Author: David Mitchell <[email protected]>
Date: Sat Jul 11 11:49:13 2015 +0100
pp_leavesub: simplify recursion test
Part of pp_leavesub() tests whether we're in recursion by looking
at CvDEPTH(cx->blk_sub.cv). Instead, just directly check
cx->blk_sub.olddepth, which is equivalent (allowing for an offset of 1)
but faster.
M pp_hot.c
commit 38a789c4ec0f1a14098bc8716059df1bf2ef27b2
Author: David Mitchell <[email protected]>
Date: Sat Jul 11 11:05:55 2015 +0100
clear_defarray(): clear @_ if possible
clear_defarray() is called during sub exit to clean up @_ in the
less common case where @_ has somehow gotten reified.
At the moment it just frees the old @_, then creates a new AV and
sticks it in pad[0].
This commit changes it so that for the reasonably common case of a reified
@_ where it's not magical and only has a reference count of 1, just call
av_clear() on it, rather than freeing and recreating.
Typical code that will benefit from this change is be something like:
sub f { push @_, ...; ... }
which causes the AV to be reified, but not to become otherwise visible.
M pp_hot.c
commit c2590c49f9a78abfa843688727eec5bf95dcf83a
Author: David Mitchell <[email protected]>
Date: Sat Jul 11 10:52:49 2015 +0100
pp_goto(): use clear_defarray()
In pp_goto(), use the newly-added clear_defarray() function
to the clear the old @_. This ensures that POPSUB() and pp_goto()
do the same thing. Note that clear_defarray() is actually better than
the old pp_goto() code, in that it pre-sizes the newly-created array
to match the size of the array being abandoned.
M pp_ctl.c
commit 97b82bb4491f939fe213bc2e3e23f0c118006111
Author: David Mitchell <[email protected]>
Date: Sat Jul 11 10:40:23 2015 +0100
add Perl_clear_defarray()
This function implements the less commonly used branch in the POPSUB()
macro that clears @_ in place, or abandons it and creates a new array
in pad slot 0 of the function (the common branch is where @_ hasn't been
reified, and so can be clered simply by setting fill to -1).
By moving this out to a separate function we can avoid repeating the same
code everywhere the POPSUB macro is used; but since its only used
in the less frequent cases, the extra overall of a function call doesn't
matter.
It has a currently unused arg, 'abandon', which will be used shortly.
M cop.h
M embed.fnc
M embed.h
M pp_hot.c
M proto.h
commit 24f9a2d278bb3a50c7cffd719fcb16ca8bd78b34
Author: David Mitchell <[email protected]>
Date: Sat Jul 11 10:06:39 2015 +0100
avoid leaking @_ in goto
pp_goto temporarily bumps the reference count of @_ while doing
LEAVE_SCOPE(), to stop it getting prematurelly freed. If something
dies during the save stack unwinding, it will leak.
Instead, make it mortal.
M pp_ctl.c
M t/op/svleak.t
commit 48b065692c6cb34399067313f3814f9db6b6be7e
Author: David Mitchell <[email protected]>
Date: Thu Jul 9 09:22:38 2015 +0100
goto.t: add freeing CV test
This code SEGVed in a cpan/ module while I was messing with pp_goto.
Add it to t/op/goto.t so that it can SEGV there instead.
M t/op/goto.t
commit ff6be9013b0bf0163debfcd28a844355160fff83
Author: David Mitchell <[email protected]>
Date: Sun Jul 5 10:21:14 2015 +0100
pp_goto: do the DIEing before the POPing
Rearrange the beginning of the 'goto &func' part of pp_goto so that it
does most of its error checks (e.g. "Can't goto subroutine from an eval")
before it starts doing "return-ish" stuff. This makes the code slightly
cleaner, especially as it doesn't have to undo the SvREFCNT_inc(cv) guard
in every die branch.
M pp_ctl.c
commit 9c81bc693d4cc7baf461b3ca554d1dea33911406
Author: David Mitchell <[email protected]>
Date: Sun Jul 5 10:08:25 2015 +0100
eliminate a goto in pp_goto (!)
Replace a C-level goto with a while loop: logically equivalent,
but doesn't use a goto. (I know, I know, this is in pp_goto, but even
so...)
M pp_ctl.c
commit ae173df6706cda6ce70be9edd83a8ecbb3eda334
Author: David Mitchell <[email protected]>
Date: Fri Jul 3 11:40:01 2015 +0100
pp_goto: a couple of cosmetic changes
had a lable outdented 2, not 4 chars, and move a comment describing
what a branch does from before to after the 'if'.
M pp_ctl.c
commit 08a4aa0289b9b1549ad3a4daa007027f929c9d80
Author: David Mitchell <[email protected]>
Date: Fri Jul 3 11:14:30 2015 +0100
make POP_SAVEARRAY() safe
POP_SAVEARRAY() frees the current @_ and restores it to the callers value.
As currently defined, it frees the old AV then updates GvAV(PL_defgv). If
the free old the old AV triggers a destructor for example, then in
theory something bad could happen.
I couldn't actually find a simple failure case, but I suspect that
something like
sub f { *_ = bless [], 'Foo' }
where Foo::DESTROY is an XS sub that messes with GvAV(PL_defgv), could do
it.
Anyway to play safe, this commit updates the GvAV() slot and *then* frees
the old AV. This our normal modus operandi in other places anyway.
The equivalent code in pp_goto already does this the safe way. This commit
also updates pp_goto to use the (now equivalent) POP_SAVEARRAY() macro.
M cop.h
M pp_ctl.c
commit ec748e1e8fcf1bc5a4b60f1a6c3c583cbc62ddd7
Author: David Mitchell <[email protected]>
Date: Thu Jul 2 10:14:14 2015 +0100
t/perf/benchmarks: add a few sub and goto tests
M t/perf/benchmarks
commit a58a0131d539b68efeaeb7a77b4c3043511036fa
Author: David Mitchell <[email protected]>
Date: Wed Jul 1 20:19:23 2015 +0100
pp_entersub: skip resetting @_
Whenever we leave a sub by whatever means (pp_leavesub, pp_return,
pp_goto, die etc) it is the responsibility of the code that pops
the SUB context to clean up the private @_ of that sub (i.e pad[0])
so that it's empty and not real.
There's some code in pp_entersub that duplicates this check. I believe
this check is unnecessary and so this commit removes it and replaces it
with an assert. It was added by 221373f04 in 1999 to fix the issue
described in
Subject: [ID 19991015.010] [BUG 5.005_62 Assertation failed:
"pp_ctl.c" line 2443]
Message-Id: <[email protected]>
There were two fixes applied for this issue; the other was
0253cb4. I think the second commit actually fixed the issue and the
first fix was a red herring.
If my newly-added assert fails, it implies that something needs fixing in
the context-popping code, rather than in pp_entersub.
In fact the new assert showed up one issue: the special-case handling
of @_ for &CORE::undef in pp_coreargs wasn't emptying the array,
so I added a CLEAR_ARGARRAY().
M pp.c
M pp_hot.c
commit 127e52cc075245ece44b726b18af79e90cffe429
Author: David Mitchell <[email protected]>
Date: Wed Jul 1 16:50:53 2015 +0100
improve @_ commentary in pp_goto
Following on from the previous commit which removed cx.argarray,
remove 'argarray' from the comments about @_, and at the same time
generally overhaul those comments; in particular, explaining how
it's a two part process of donating the current @_ to the new sub.
M pp_ctl.c
commit cec18027d1d3701b971f7ff6dd04afe656ea818a
Author: David Mitchell <[email protected]>
Date: Wed Jul 1 13:37:32 2015 +0100
eliminate the argarray field from the CX struct
At the end of a normal sub call there are often 3 AVs of interest
associated with @_; these are:
cx->blk_sub.savearray the caller's @_
GvAV(PL_defgv) the current sub's current @_
cx->blk_sub.argarray the current sub's original @_
Note that those last two can differ: if for example the sub does
local *_ = [];
Each sub's arg array is created and stored in pad slot 0 at the time
the sub is created. When a sub is called, pp_entersub() does
cx->blk_sub.argarray = PL_curpad[0]
The argarray field is used in two main places:
* at subroutine exit, to clear/abandon the sub's original @_;
* in pp_caller, to set @DB::args to the caller(n)'s args.
In the first case, the last few commits have arranged things so that at
that point, PL_curpad always points to the current pad of the sub being
exited from. So we can just use PL_curpad[0] rather than
cx->blk_sub.argarray.
In the second case (which is not performance critical), we can just use
cx->blk_sub.cv
and
cx->blk_sub.olddepth+1
to find the pad of that call frame's CV.
So we can eliminate the argarray field. This saves a write during
a sub call, and potentially reduces the size of the context struct.
It also makes the code marginally less confusing: there are now 3 arrays
pointed to from 3 places, rather than 3 arrays pointed to from 4 places.
The asserts added in the previous commit confirmed that using argarray
is the same as using PL_curpad[0]; They also confirmed that the current
PL_curpad matches the current CV at the current depth. Those latter
asserts are kept for now.
M cop.h
M pp.c
M pp_ctl.c
M pp_hot.c
M pp_sort.c
M sv.c
commit 823fbff7304e435dedf641c657ff3cf7a2f7d3f2
Author: David Mitchell <[email protected]>
Date: Wed Jul 1 12:21:06 2015 +0100
assert that it's safe to remove CX.argarray field
This commit adds assertions that demonstrate that the next commit is safe.
See the description of that commit for details.
M cop.h
M pp.c
M pp_ctl.c
commit dee6b0efaf0845885bdf689be13fe823364ef872
Author: David Mitchell <[email protected]>
Date: Wed Jul 1 09:57:51 2015 +0100
Unwind save stack in sync with POPEVAL
During normal exit from an eval, both POPEVAL and LEAVE are done,
meaning that the context stack and save stack are unwound in lockstep.
However, during an exception, dounwind() does the POPEVAL but not the
LEAVE, leaving them temporarily out of step.
About a 2 years ago, with v5.19.3-139-g2537512, subs and formats were
changed so that the save stack popping was done in sync in dounwind.
This commit extends that to evals too.
I'm doing this principally so that PL_compad will always be restored at
the correct moment, which will shortly allow me to eliminate the argarray
field from the context struct.
NB: unlike POPSUB and POPFORMAT, I've added the LEAVE_SCOPE to dounwind
rather than directly adding to the POPEVAL macro - this is because the
various places that use POPEVAL typically use it earlier than the
comparable places with POPSUB, which means they aren't ready to pop the
save stack yet.
NNB: The LEAVE_SCOPE can't be extended to all context types in dounwind(),
only to sub-ish types - specifically the types that can be 'return'ed from.
This is because if you 'return' from a sub or eval, pp_return will
unwind all contexts down to the next sub or eval (discarding all the loops
etc that it escaping out of), but the args it is returning shouldn't
be prematurely freed.
M pp_ctl.c
commit bd79813e399674f5a7b7106e4ae0a841df191375
Author: David Mitchell <[email protected]>
Date: Wed Jul 1 07:56:39 2015 +0100
pp_goto: skip restoring PL_comppad
Now that PL_comppad is saved in the context struct rather than on the save
stack, we can better control when and how it is restored. In the case of
pp_goto, there's no need to restore the caller's PL_comppad in the non-XS
case, since we will be immediately setting it to the new function's pad.
AS well as being slightly more efficient, this avoids restoring PL_comppad
too early, where if we subsequently croak we re-process the CXt_SUB block
in dounwind, but this time with the wrong pad.
In particular, by having always PL_curpad[0] == cx.argarray at sub exit
time, we can shortly eliminate the argarray field.
M pp_ctl.c
commit 81719c32751fdb2b4c9e15a6d1c20dd630ffe8d3
Author: David Mitchell <[email protected]>
Date: Tue Jun 30 08:03:43 2015 +0100
undef *_; goto &f: update cx.argarray
In something like
sub f { goto &g }
normally g's pad[0] is updated to hold the passed-across @_, and the
context block's argarray field is updated to point to g's @_ too.
However in the case of
sub f { undef *_; goto &g }
cx.argarray isn't being updated. This is probably harmless (I couldn't
come up with a test case that fails), but for consistency, update it too.
This is mainly so that over the next few commits, this condition will come
to apply consistently:
cx.argarray == PL_curpad[0]
and so the argarray field can be eliminated.
M pp_ctl.c
commit 0832b076a707cf3439b3e2554e6d474ec98e0449
Author: David Mitchell <[email protected]>
Date: Mon Jun 29 12:33:35 2015 +0100
make "for my $lex {}" faster under ITHREADS
Normally at the start of a 'for' iteration (pp_enteriter), we store the
address of the GV or the address of the pad slot of the iteration variable
in the CX struct, so we can quickly access and update it in pp_iter. For
the ITHREADS case however, the pad may change if the thread is cloned, so
instead the address of PL_comppad was stored, and then updated during
cloning. This meant that on each iter, we would have to retrieve the saved
PL_comppad address from the ctx struct, retrieve the targ from the saved
my_op, and do a (perlish) array indexing.
Thuis commit makes this faster by, for the ITHREADS case, storing both
PL_comppad and svp = &PLcurpad[targ]. In pp_iter(), we're fast by directly
accessing *svp; while storing PL_comppad allows us to update both it and
svp during thread cloning.
This requires one extra pointer in the block_loop part of the context
union under threads, but this is already smaller than some other parts of
the union, so has no effect.
Note that the oldcomppad field was formerly part of the itervar_u union,
but is now a separate field within the larger block_loop struct (but only
on threaded builds).
Note also that the tests I've added I retrieved from an old WIP private
branch that contained a forerunner of this commit, so they may not be
entirely relevant to the current form of this commit. But extra tests
can never hurt, so I've included them.
M cop.h
M ext/XS-APItest/t/clone-with-stack.t
M pp_ctl.c
M sv.c
M t/op/for.t
M t/perf/benchmarks
commit 4139400b20ab31cebd1404c0878955d5d653a2d2
Author: David Mitchell <[email protected]>
Date: Mon Jun 29 12:02:18 2015 +0100
eliminate cx->blk_sub.oldcomppad
In the CXt_SUB sub-struct of the context struct, there is a field
called oldcomppad. Despite the "old" in its name, this field actually
stores the value of PL_comppad of the new sub, not of the caller.
It's only use currently is in POPSUB() when abandoning a reified @_, to
locate PL_curpad[0] of the current sub in order to stick a new empty AV
there. This is a relatively rare occurrence, and the pad slot can be
found (slightly less efficiently) from the saved CV and its depth.
M cop.h
M pp_ctl.c
M pp_hot.c
M pp_sort.c
M sv.c
commit a38414f4ab650fdfe06f69dbeb5bd9f848e2251f
Author: David Mitchell <[email protected]>
Date: Mon Jun 29 11:36:27 2015 +0100
document unrolled PUSHSUB/POPSUB
some places in the code do some or all of the same activities as
PUSHSUB() and POPSUB(). Add comments in those places pointing out that
it's a partially unrolled PUSH/POPSUB(). This will also help if someone
greps the code looking for all the places in core that supposedly does
a PUSH/POPSUB.
M cop.h
M pp_ctl.c
commit 426bc815e2624df86e90821fe0780e0bdf2a7d9c
Author: David Mitchell <[email protected]>
Date: Mon Jun 29 11:27:36 2015 +0100
save old PL_comppad in CXt_SUB/FORMAT block
Currently when we call a sub, the old value of PL_comppad is
saved on the save stack using SAVECOMPPAD(). Instead, save it in
a new field in the context struct, called prevcomppad. This is simpler
and more efficient.
Note that there is already a confusingly-named field in the CXt_SUB
context struct called oldcomppad, which holds the value of PL_comppad for
the *current* sub, not for its caller. So the new field had to be called
something else.
One side effect of this is that an existing bug - which causes too much
to be popped off the savestack when dieing while leaving a sub scope - is
now more noticeable, since PL_curpad and SAVEt_CLEARSV are now out of
sync: formerly, the unwinding of the save stack restored PL_curpad in
lockstep. The fix for this will come later in this branch, when the whole
issue of context stack popping order and reentrancy is addressed; for
now, a TODO test has been added.
M cop.h
M pp_ctl.c
M pp_hot.c
M pp_sort.c
M pp_sys.c
M regexec.c
M sv.c
M t/op/sub.t
commit a0c76bc06faa48b44e698019147ab309e891d408
Author: David Mitchell <[email protected]>
Date: Fri Jun 26 12:17:59 2015 +0100
pp_entersub: remove extraneous SAVETMPS
The branch that handles "no cv, try autoload" does a SAVETMPS.
This serves no purpose, since we will shortly be doing another SAVETMPS
anyway with no intervening ENTER.
M pp_hot.c
commit f2bd357d3d736d8c2095f383addfc7ff35e88de4
Author: David Mitchell <[email protected]>
Date: Thu Jun 25 16:08:02 2015 +0100
pp_goto: SvREFCNT_dec(oldcv) *after* undef test
pp_goto does a LEAVE, then checks that the new CV hasn't been undefed
by the LEAVE. If it has, it croaks.
Move the decrementing of the old CV's ref count and depth to *after*
this check, since the POPSUB done during the croak unwind will do the
decrement also. Otherwise the old sub will be doubly freed.
M pp_ctl.c
M t/op/goto.t
commit eb0fb03b1a65c17ebd07e7ed19aa67d297fba8e4
Author: David Mitchell <[email protected]>
Date: Thu Jun 25 15:18:25 2015 +0100
pp_goto(): reorder LEAVE_SCOPE for consistency
pp_leavesub (via POPSUB()) does a LEAVE_SCOPE before decrementing the CV's
ref count and depth; pp_goto does it after. Reorder it for consistency
with leavesub.
At this point I make no assertion as to which way round is the most
correct.
M pp_ctl.c
commit 3aaa7015cfe1c53ed18a4d531df3bc0def083b46
Author: David Mitchell <[email protected]>
Date: Thu Jun 25 15:08:37 2015 +0100
pp_goto: use cx->blk_oldscopesp
POPSUB() does:
LEAVE_SCOPE(PL_scopestack[cx->blk_oldscopesp - 1])
while pp_goto(), which manually does the relevant actions from POPSUB(),
does:
LEAVE_SCOPE(PL_scopestack[PL_scopestack_ix - 1])
For consistency, make pp_goto() use cx->blk_oldscopesp instead. In fact
at that point they should both hold the same value (and I've added an
assert to that effect), since we should have just popped any nested
scopes.
M pp_ctl.c
commit d7ac6482c4b1aecdfe598aeac0179201e7184277
Author: David Mitchell <[email protected]>
Date: Thu Jun 25 12:05:50 2015 +0100
SvREFCNT_inc(cv) recursive subs
A CXt_SUB context frame owns 1 reference count to the CV being called,
but only if it's the bottom-level call to that CV; recursive calls don't
count.
This commit changes it so that every CXt_SUB frame owns a reference count.
This removes a lot of "if (CvDEPTH(cv) < 2)" type tests from the code and
makes things generally simpler and less bug-prone.
For ordinary (non-recursive) sub calls it will now be slightly faster, as
it no longer has to do the CvDEPTH check on sub entry and exit; for subs
being recursed into, it will probably be slightly slower, as although it
no longer has to the CvDEPTH check on entry and exit, it now has to do a
refcnt ++/-- instead.
This also means that a deeply recursing sub will have a very high ref
count; but there is no new additional danger of overflow, as sv_refcnt is
U32 while xcv_depth is I32: so the latter will still overflow earlier
anyway.
M cop.h
M pp_ctl.c
M pp_sort.c
M sv.c
commit 9ae28f8efb07eb85e04191993c2a42bd4cc955c6
Author: David Mitchell <[email protected]>
Date: Thu Jun 25 10:48:58 2015 +0100
eliminate an SAVEFREESV(cv) from PUSHSUB
When a CXt_SUB context is pushed, the reference count of the CV is
increased (and is effectively owned by that context frame). It is
decremented when the context frame is popped.
There was an issue in that the POPSUB was done before the LEAVE,
which meant that at sub exit, the sub could be freed before stuff that
referred to that sub was done (such as lexicals being cleaned up by
SAVEt_CLEARSV).
This was fixed by perl-5.005_02-2095-gb0d9ce3, which split POPSUB
into POPSUB and LEAVESUB with the latter responsible for the decrement.
So for example code might do POPSUB; LEAVE; LEAVSUB.
However this wasn't sufficient, because a similar thing happened during
die, for example
sub d {die}
my $f;
$f = sub {my $x=1; $f = 0; d};
eval{ $f->() };
since all *all* the CXt_SUB contexts were popped with POPSUB/LEAVSUB
*before* LEAVE was called.
I fixed this with perl-5.8.0-3206-gb36bdec, by adding another increment to
the CV and doing a SAVEFREESV(cv), both in PUSHSUB. This meant that
the save stack would hold at least one reference to the CV while being
unwound.
However, v5.19.3-139-g2537512 then changed things so that POPSUB also
did a LEAVE. This means that now, die unwinds the context stack and the
save stack in lockstep, so my second fix is now redundant. So this commit
undoes it, saving an rc++/-- and SAVEFREE(cv) per sub call.
M cop.h
-----------------------------------------------------------------------
--
Perl5 Master Repository