diff options
author | Daniel Dragan <bulk88@hotmail.com> | 2012-11-23 16:15:04 -0500 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-11-23 18:00:39 -0800 |
commit | 630b72b081fe290d04732279e069c327eea82b09 (patch) | |
tree | 4f6f482b4e9d8f36d78f2b88f734768597c6b8d4 /sv.h | |
parent | b899e89d91e81e631e553a5b805e8d068828dbf0 (diff) | |
download | perl-630b72b081fe290d04732279e069c327eea82b09.tar.gz |
SvPVXtrue single eval->multiple eval
Make SvTRUE and SvPVXtrue smaller and faster in machine code on non GCC
compilers.
This commit implements my posts here,
http://www.nntp.perl.org/group/perl.perl5.porters/2012/11/msg195720.html
and in my commit message in commit 4cc783efe0 . SvPVXtrue was added in
commit 4bac9ae47b . No reason was given why SvPVXtrue is single eval, but
its only use is in multi eval SvTRUE. A non GCC compiler will write to
PL_Xpv and PL_Sv, and still keep the SV * and PV *s in a register for the
next operations/instructions. The writes to PL_Xpv and PL_Sv are needless.
The use of PL_Xpv and PL_Sv is self explanatory C lang wise. As said in the
ML post, this commit causes overall code bloat because of incorrect uses
of passing macro args that make calls (ERRSV for example) to SvTRUE. This
will have to be fixed in the future. All of the pp opcode funcs decrease
tiny bit in size after this commit. See the ML list post for details.
Diffstat (limited to 'sv.h')
-rw-r--r-- | sv.h | 20 |
1 files changed, 11 insertions, 9 deletions
@@ -1733,11 +1733,6 @@ Like sv_utf8_upgrade, but doesn't do magic on C<sv>. # define SvPVbytex_nolen(sv) ({SV *_sv = (sv); SvPVbyte_nolen(_sv); }) # define SvTRUEx(sv) ({SV *_sv = (sv); SvTRUE(_sv); }) # define SvTRUEx_nomg(sv) ({SV *_sv = (sv); SvTRUE_nomg(_sv); }) -# define SvPVXtrue(sv) \ - ({XPV *nxpv; \ - (nxpv = (XPV*)SvANY(sv)) \ - && (nxpv->xpv_cur > 1 \ - || (nxpv->xpv_cur && *(sv)->sv_u.svu_pv != '0'));}) #else /* __GNUC__ */ @@ -1756,12 +1751,19 @@ Like sv_utf8_upgrade, but doesn't do magic on C<sv>. # define SvPVbytex_nolen(sv) ((PL_Sv = (sv)), SvPVbyte_nolen(PL_Sv)) # define SvTRUEx(sv) ((PL_Sv = (sv)), SvTRUE(PL_Sv)) # define SvTRUEx_nomg(sv) ((PL_Sv = (sv)), SvTRUE_nomg(PL_Sv)) -# define SvPVXtrue(sv) \ - ((PL_Xpv = (XPV*)SvANY(PL_Sv = (sv))) \ - && (PL_Xpv->xpv_cur > 1 \ - || (PL_Xpv->xpv_cur && *PL_Sv->sv_u.svu_pv != '0'))) #endif /* __GNU__ */ +#define SvPVXtrue(sv) ( \ + ((XPV*)SvANY((sv))) \ + && ( \ + ((XPV*)SvANY((sv)))->xpv_cur > 1 \ + || ( \ + ((XPV*)SvANY((sv)))->xpv_cur \ + && *(sv)->sv_u.svu_pv != '0' \ + ) \ + ) \ +) + #define SvIsCOW(sv) (SvFLAGS(sv) & SVf_IsCOW) #define SvIsCOW_on(sv) (SvFLAGS(sv) |= SVf_IsCOW) #define SvIsCOW_off(sv) (SvFLAGS(sv) &= ~SVf_IsCOW) |