This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
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.