summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2014-02-27 15:30:26 +0000
committerDavid Mitchell <davem@iabyn.com>2014-02-27 16:16:18 +0000
commit60779a30f61297ad86e175f686b7bc697c7b8e51 (patch)
treee1e560a9e7820e720fd99ef8f3d3c8ba46880dc6 /pp_hot.c
parent89a18b40609cfdfc4af7414a628064c743b836bd (diff)
downloadperl-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_hot.c')
-rw-r--r--pp_hot.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/pp_hot.c b/pp_hot.c
index 552be61129..ae88d83f48 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -1916,8 +1916,10 @@ PP(pp_iter)
*itersvp = NULL;
Perl_croak(aTHX_ "Use of freed value in iteration");
}
- if (SvPADTMP(sv) && !IS_PADGV(sv))
+ if (SvPADTMP(sv)) {
+ assert(!IS_PADGV(sv));
sv = newSVsv(sv);
+ }
else {
SvTEMP_off(sv);
SvREFCNT_inc_simple_void_NN(sv);
@@ -2432,7 +2434,8 @@ PP(pp_grepwhile)
SAVEVPTR(PL_curpm);
src = PL_stack_base[*PL_markstack_ptr];
- if (SvPADTMP(src) && !IS_PADGV(src)) {
+ if (SvPADTMP(src)) {
+ assert(!IS_PADGV(src));
src = PL_stack_base[*PL_markstack_ptr] = sv_mortalcopy(src);
PL_tmps_floor++;
}
@@ -2693,8 +2696,10 @@ try_autoload:
while (items--) {
if (*MARK)
{
- if (SvPADTMP(*MARK) && !IS_PADGV(*MARK))
+ if (SvPADTMP(*MARK)) {
+ assert(!IS_PADGV(*MARK));
*MARK = sv_mortalcopy(*MARK);
+ }
SvTEMP_off(*MARK);
}
MARK++;
@@ -2760,8 +2765,10 @@ try_autoload:
SSize_t items = SP - mark;
while (items--) {
mark++;
- if (*mark && SvPADTMP(*mark) && !IS_PADGV(*mark))
+ if (*mark && SvPADTMP(*mark)) {
+ assert(!IS_PADGV(*mark));
*mark = sv_mortalcopy(*mark);
+ }
}
}
/* We assume first XSUB in &DB::sub is the called one. */