diff options
author | Daniel Dragan <bulk88@hotmail.com> | 2014-10-10 16:11:25 -0400 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2014-10-10 14:52:14 -0700 |
commit | 09b319af290eb2abf83cf6fb2fb1aef76535d319 (patch) | |
tree | 2f17ced8decff2d76f81eab091d43db470b0e2e3 /ext/DynaLoader | |
parent | cbf3d0f6a515715bb20f6172aaf6b6d77202a1f3 (diff) | |
download | perl-09b319af290eb2abf83cf6fb2fb1aef76535d319.tar.gz |
move dMY_CXT in dlutils.c closer to first use
By computing dMY_CXT right before its first and usually last use, my_cxt
pointer doesn't need to be carried across function calls in SaveError. This
frees a C stack auto and/or register from being saved and restored in
SaveError. On VC 2003 32 bits -O1 threaded, the machine code size in bytes
dropped from 0x72 to 0x70 after this patch.
Diffstat (limited to 'ext/DynaLoader')
-rw-r--r-- | ext/DynaLoader/dlutils.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/ext/DynaLoader/dlutils.c b/ext/DynaLoader/dlutils.c index ffcd109ea8..70703b15f4 100644 --- a/ext/DynaLoader/dlutils.c +++ b/ext/DynaLoader/dlutils.c @@ -132,7 +132,6 @@ dl_generic_private_init(pTHX) /* called by dl_*.xs dl_private_init() */ static void SaveError(pTHX_ const char* pat, ...) { - dMY_CXT; va_list args; SV *msv; const char *message; @@ -147,9 +146,12 @@ SaveError(pTHX_ const char* pat, ...) message = SvPV(msv,len); len++; /* include terminating null char */ + { + dMY_CXT; /* Copy message into dl_last_error (including terminating null char) */ - sv_setpvn(MY_CXT.x_dl_last_error, message, len) ; - DLDEBUG(2,PerlIO_printf(Perl_debug_log, "DynaLoader: stored error msg '%s'\n",dl_last_error)); + sv_setpvn(MY_CXT.x_dl_last_error, message, len) ; + DLDEBUG(2,PerlIO_printf(Perl_debug_log, "DynaLoader: stored error msg '%s'\n",dl_last_error)); + } } #endif |