summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2014-02-26 20:47:32 +0000
committerDavid Mitchell <davem@iabyn.com>2014-02-27 16:16:18 +0000
commitbdf02c570d69e9038a07f0ec1049f4f26aedf15a (patch)
tree133a6d968187948688e1ec464101374c48704370 /pp_hot.c
parent3689ad62af25f0d4cbf68f0b9f1583d8035434f0 (diff)
downloadperl-bdf02c570d69e9038a07f0ec1049f4f26aedf15a.tar.gz
pp_entersub(): tweak some vars
make the scope of item be smaller; don't assign +1 to MARK when we will shortly overwrite it; use a local var to to store &GvAV(PL_defgv) to avoid recalculating it use a _NN variant of SvREFCNT_inc Shaves 2% off the object size of pp_entersub.
Diffstat (limited to 'pp_hot.c')
-rw-r--r--pp_hot.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/pp_hot.c b/pp_hot.c
index 6d44d90d2e..7397a91b99 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -2647,7 +2647,6 @@ try_autoload:
if (!(CvISXSUB(cv))) {
/* This path taken at least 75% of the time */
dMARK;
- SSize_t items = SP - MARK;
PADLIST * const padlist = CvPADLIST(cv);
I32 depth;
@@ -2662,6 +2661,9 @@ try_autoload:
PAD_SET_CUR_NOSAVE(padlist, depth);
if (LIKELY(hasargs)) {
AV *const av = MUTABLE_AV(PAD_SVl(0));
+ SSize_t items;
+ AV **defavp;
+
if (UNLIKELY(AvREAL(av))) {
/* @_ is normally not REAL--this should only ever
* happen when DB::sub() calls things that modify @_ */
@@ -2669,11 +2671,12 @@ try_autoload:
AvREAL_off(av);
AvREIFY_on(av);
}
- cx->blk_sub.savearray = GvAV(PL_defgv);
- GvAV(PL_defgv) = MUTABLE_AV(SvREFCNT_inc_simple(av));
+ defavp = &GvAV(PL_defgv);
+ cx->blk_sub.savearray = *defavp;
+ *defavp = MUTABLE_AV(SvREFCNT_inc_simple_NN(av));
CX_CURPAD_SAVE(cx->blk_sub);
cx->blk_sub.argarray = av;
- ++MARK;
+ items = SP - MARK;
if (UNLIKELY(items - 1 > AvMAX(av))) {
SV **ary = AvALLOC(av);
@@ -2683,7 +2686,7 @@ try_autoload:
AvARRAY(av) = ary;
}
- Copy(MARK,AvARRAY(av),items,SV*);
+ Copy(MARK+1,AvARRAY(av),items,SV*);
AvFILLp(av) = items - 1;
MARK = AvARRAY(av);