diff options
author | David Mitchell <davem@iabyn.com> | 2012-09-25 12:47:51 +0100 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2012-11-10 13:39:31 +0000 |
commit | ad9e6ae10fb581c6c053b862286f8e187063c3ab (patch) | |
tree | 5b8ebbab6d70ac51787cc1f23567a9e450443087 /pad.c | |
parent | 71324a3bc4a9e86bdeeabcaf87f9cdac28ba7510 (diff) | |
download | perl-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.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -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; } |