Skip to content

Commit 3ea8bc9

Browse files
bulk88tonycoz
authored andcommitted
remove a branch in SvIV_please_nomg
On VC 2003 and GCC 4.6.3, this patch decreases from 3 branches to 2 branches that machine code that makes up SvIV_please_nomg. Functionality should be identical as before. This is intended to make math functions like pp_add faster. Due to complexity/my time, SvIV_please wasn't optimized. "(SvNOK(sv) || SvPOK(sv)" was optimized to "(SvFLAGS(sv) & (SVf_NOK|SVf_POK))" on GCC and VC 2003 before this patch, so that change reenforces what the optimizer already did before. .text section of miniperl.exe size in bytes gcc 32b 4.6.3 -O2 before 0x10d154 gcc 32b 4.6.3 -O2 after 0x10d064 vc2003 before 0xa4odf vc2003 after 0xa406f
1 parent 7de6b80 commit 3ea8bc9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sv.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,11 +1313,11 @@ sv_force_normal does nothing.
13131313
Not guaranteed to stay returning void */
13141314
/* Macro won't actually call sv_2iv if already IOK */
13151315
#define SvIV_please(sv) \
1316-
STMT_START {if (!SvIOKp(sv) && (SvNOK(sv) || SvPOK(sv))) \
1316+
STMT_START {if (!SvIOKp(sv) && (SvFLAGS(sv) & (SVf_NOK|SVf_POK))) \
13171317
(void) SvIV(sv); } STMT_END
13181318
#define SvIV_please_nomg(sv) \
1319-
(!SvIOKp(sv) && (SvNOK(sv) || SvPOK(sv)) \
1320-
? (SvIV_nomg(sv), SvIOK(sv)) \
1319+
(!(SvFLAGS(sv) & (SVf_IOK|SVp_IOK)) && (SvFLAGS(sv) & (SVf_NOK|SVf_POK)) \
1320+
? (sv_2iv_flags(sv, 0), SvIOK(sv)) \
13211321
: SvIOK(sv))
13221322
#define SvIV_set(sv, val) \
13231323
STMT_START { \

0 commit comments

Comments
 (0)