summaryrefslogtreecommitdiff
path: root/scope.c
diff options
context:
space:
mode:
authorDaniel Dragan <bulk88@hotmail.com>2012-11-18 21:16:39 -0500
committerFather Chrysostomos <sprout@cpan.org>2012-11-18 20:17:19 -0800
commit623e28c6c86d5d4c8c412d8ccf1d046acfc77d49 (patch)
treed79c463011620008a1843a8e9de70bb883707ebf /scope.c
parentb1b0854bd0007475cf5a2630594138a1fff131e2 (diff)
downloadperl-623e28c6c86d5d4c8c412d8ccf1d046acfc77d49.tar.gz
reduce scope of a var in save_clearsv
svp is a pointer to a pad array slice. It is derefed to set a sv flag. It's optimized scope previous extended past the savestack_grow call. By moving the flag setting before any calls in save_clearsv, svp does not have to be carried across any calls. On some platforms there will be a benefit (args transfered in vol regs for example, AMD64 Win64), on others none since it will be reread from the stack after any child call anyway. I assume the SvPADSTALE_off flag will have no effect on the panic croak. After this commit, the only auto var carried through a call is offset_shifted (and unavoidably my_perl). I saw a drop in the size of save_clearsv from 0x5A to 0x58. The saving and use of 1 nonvol reg on x86 32 bit VC 2003 was reduced, total stack frame reduced by 1 pointer, since VC 2003 read svp off the stack only once at the start of save_clearsv and kept it in a nonvol reg for the rest of this func's body.
Diffstat (limited to 'scope.c')
-rw-r--r--scope.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/scope.c b/scope.c
index 75b2835ec5..4f00ab71b3 100644
--- a/scope.c
+++ b/scope.c
@@ -522,13 +522,13 @@ Perl_save_clearsv(pTHX_ SV **svp)
PERL_ARGS_ASSERT_SAVE_CLEARSV;
ASSERT_CURPAD_ACTIVE("save_clearsv");
+ SvPADSTALE_off(*svp); /* mark lexical as active */
if ((offset_shifted >> SAVE_TIGHT_SHIFT) != offset)
Perl_croak(aTHX_ "panic: pad offset %"UVuf" out of range (%p-%p)",
offset, svp, PL_curpad);
SSCHECK(1);
SSPUSHUV(offset_shifted | SAVEt_CLEARSV);
- SvPADSTALE_off(*svp); /* mark lexical as active */
}
void