summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-07-09 05:50:04 -0700
committerFather Chrysostomos <sprout@cpan.org>2011-07-09 06:13:39 -0700
commit939052121c6c8b75252bdfed0ddc88cefd0ed61e (patch)
tree12e68bcad6e1e7f40359ad6a4fffcd84da3923b7
parentf199eb7b218aa1d4586d6302a63fbc9d40cfbc62 (diff)
downloadperl-939052121c6c8b75252bdfed0ddc88cefd0ed61e.tar.gz
Free temps on recursive scalar lvalue sub exit
See the thread starting at <83877DD1-4624-4497-B784-0F8DA25DB4A8@cpan.org>. I still don’t know why this does not apply to list context. As with most lvalue sub fixes, this involves deleting code.
-rw-r--r--pod/perldelta.pod5
-rw-r--r--pp_ctl.c8
2 files changed, 6 insertions, 7 deletions
diff --git a/pod/perldelta.pod b/pod/perldelta.pod
index 6ba42ebfe4..6e3f67c920 100644
--- a/pod/perldelta.pod
+++ b/pod/perldelta.pod
@@ -97,6 +97,11 @@ C<study> now uses considerably less memory for shorter strings. Strings shorter
than 65535 characters use roughly half the memory than previously, strings
shorter than 255 characters use roughly one quarter of the memory.
+=item *
+
+Recursive calls to lvalue subroutines in lvalue scalar context use less
+memory.
+
=back
=head1 Modules and Pragmata
diff --git a/pp_ctl.c b/pp_ctl.c
index 0727372f03..554e47f945 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -2313,12 +2313,6 @@ S_return_lvalues(pTHX_ SV **mark, SV **sp, SV **newsp, I32 gimme,
SvREADONLY(TOPs) ? (TOPs == &PL_sv_undef) ? "undef"
: "a readonly value" : "a temporary");
}
- else { /* Can be a localized value
- EXTEND_MORTAL(1); * subject to deletion. */
- PL_tmps_stack[++PL_tmps_ix] = *SP;
- SvREFCNT_inc_void(*SP);
- *++newsp = *SP;
- }
}
else {
/* sub:lvalue{} will take us here. */
@@ -2333,7 +2327,7 @@ S_return_lvalues(pTHX_ SV **mark, SV **sp, SV **newsp, I32 gimme,
);
}
}
- else if (MARK < SP) {
+ if (MARK < SP) {
if (cx->blk_sub.cv && CvDEPTH(cx->blk_sub.cv) > 1) {
*++newsp = SvREFCNT_inc(*SP);
FREETMPS;