summaryrefslogtreecommitdiff
path: root/pad.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2012-09-25 12:47:51 +0100
committerDavid Mitchell <davem@iabyn.com>2012-11-10 13:39:31 +0000
commitad9e6ae10fb581c6c053b862286f8e187063c3ab (patch)
tree5b8ebbab6d70ac51787cc1f23567a9e450443087 /pad.c
parent71324a3bc4a9e86bdeeabcaf87f9cdac28ba7510 (diff)
downloadperl-ad9e6ae10fb581c6c053b862286f8e187063c3ab.tar.gz
pad_free(): don't clear SVs_PADSTALE
pad_free() clears the SVs_PADTMP bit. Since that bit is now shared with SVs_PADSTALE, that gets cleared on state vars. It didn't matter up till now, but the next commit will start optimising away pad ops, and op_null() will call pad_free() which would clear the SVs_PADSTALE bit. So only clear SVs_PADTMP/SVs_PADSTALE for non-lexical var ops.
Diffstat (limited to 'pad.c')
-rw-r--r--pad.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/pad.c b/pad.c
index 258b39ee10..2292aaf9b5 100644
--- a/pad.c
+++ b/pad.c
@@ -1810,6 +1810,7 @@ void
Perl_pad_free(pTHX_ PADOFFSET po)
{
dVAR;
+ SV *sv;
ASSERT_CURPAD_LEGAL("pad_free");
if (!PL_curpad)
return;
@@ -1824,9 +1825,11 @@ Perl_pad_free(pTHX_ PADOFFSET po)
PTR2UV(PL_comppad), PTR2UV(PL_curpad), (long)po)
);
- if (PL_curpad[po] && PL_curpad[po] != &PL_sv_undef) {
- SvFLAGS(PL_curpad[po]) &= ~SVs_PADTMP; /* also clears SVs_PADSTALE */
- }
+
+ sv = PL_curpad[po];
+ if (sv && sv != &PL_sv_undef && !SvPADMY(sv))
+ SvFLAGS(sv) &= ~SVs_PADTMP;
+
if ((I32)po < PL_padix)
PL_padix = po - 1;
}