diff options
author | David Mitchell <davem@iabyn.com> | 2014-02-27 15:30:26 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2014-02-27 16:16:18 +0000 |
commit | 60779a30f61297ad86e175f686b7bc697c7b8e51 (patch) | |
tree | e1e560a9e7820e720fd99ef8f3d3c8ba46880dc6 /pp.c | |
parent | 89a18b40609cfdfc4af7414a628064c743b836bd (diff) | |
download | perl-60779a30f61297ad86e175f686b7bc697c7b8e51.tar.gz |
don't set SvPADTMP() on PADGV's
Under threaded builds, GVs for OPs are stored in the pad rather than
being directly attached to the op. For some reason, all such GV's were
getting the SvPADTMP flag set. There seems to be be no good reason for
this, and after skipping setting the flag, all tests still pass.
The advantage of not setting this flag is that there are quite a few
hot places in the code that do
if (SvPADTMP(sv) && !IS_PADGV(sv)) {
...
I've replaced them all with
if (SvPADTMP(sv)) {
assert(!IS_PADGV(sv));
...
Since the IS_PADGV() macro expands to something quite heavyweight, this is
quite a saving: for example this commit reduces the size of pp_entersub by
111 bytes.
Diffstat (limited to 'pp.c')
-rw-r--r-- | pp.c | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -571,8 +571,10 @@ S_refto(pTHX_ SV *sv) SvTEMP_off(sv); SvREFCNT_inc_void_NN(sv); } - else if (SvPADTMP(sv) && !IS_PADGV(sv)) + else if (SvPADTMP(sv)) { + assert(!IS_PADGV(sv)); sv = newSVsv(sv); + } else { SvTEMP_off(sv); SvREFCNT_inc_void_NN(sv); @@ -1707,10 +1709,11 @@ PP(pp_repeat) SvREADONLY_on(*SP); } #else - if (*SP) - { - if (mod && SvPADTMP(*SP) && !IS_PADGV(*SP)) + if (*SP) { + if (mod && SvPADTMP(*SP)) { + assert(!IS_PADGV(*SP)); *SP = sv_mortalcopy(*SP); + } SvTEMP_off((*SP)); } #endif @@ -4896,8 +4899,10 @@ PP(pp_lslice) is_something_there = TRUE; if (!(*lelem = firstrelem[ix])) *lelem = &PL_sv_undef; - else if (mod && SvPADTMP(*lelem) && !IS_PADGV(*lelem)) + else if (mod && SvPADTMP(*lelem)) { + assert(!IS_PADGV(*lelem)); *lelem = firstrelem[ix] = sv_mortalcopy(*lelem); + } } } if (is_something_there) |