summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteffen Mueller <smueller@cpan.org>2012-09-12 14:52:46 +0200
committerSteffen Mueller <smueller@cpan.org>2012-09-16 13:41:38 +0200
commit22ade07d6a4f442c7a3e970195597fd0cb266e0d (patch)
tree7935b5cd24fe1992e6a4dc93b85f739ae944e6c3
parenta6075c7300c497a2e670c1d26bb60551c0075e32 (diff)
downloadperl-22ade07d6a4f442c7a3e970195597fd0cb266e0d.tar.gz
Save one NULL assignment per TMP
This assignment looks really rather like overzealous cleanliness. It's a hot path. Now it's death by 999 cuts instead of 1000.
-rw-r--r--scope.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/scope.c b/scope.c
index e3b4c79df2..42e3af872c 100644
--- a/scope.c
+++ b/scope.c
@@ -160,8 +160,13 @@ Perl_free_tmps(pTHX)
/* XXX should tmps_floor live in cxstack? */
const I32 myfloor = PL_tmps_floor;
while (PL_tmps_ix > myfloor) { /* clean up after last statement */
- SV* const sv = PL_tmps_stack[PL_tmps_ix];
- PL_tmps_stack[PL_tmps_ix--] = NULL;
+#ifdef PERL_POISON
+ SV* const sv = PL_tmps_stack[PL_tmps_ix];
+ PoisonWith(sv, 1, sizeof(SV *), 0xAB);
+ PL_tmps_ix--;
+#else
+ SV* const sv = PL_tmps_stack[PL_tmps_ix--];
+#endif
if (sv && sv != &PL_sv_undef) {
SvTEMP_off(sv);
SvREFCNT_dec(sv); /* note, can modify tmps_ix!!! */