In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/99f2bdb73be3903396f516d5e49d52326c5190a0?hp=bf7d9bd8c2ce0991949f97d6d8f45f37c52eeed2>
- Log ----------------------------------------------------------------- commit 99f2bdb73be3903396f516d5e49d52326c5190a0 Author: Daniel Dragan <[email protected]> Date: Thu Jan 17 18:38:07 2013 -0500 rearrange initializations in S_intuit_more for better code gen MS VC 2003 in my experiance does not reorder var initializations with constants to reduce their liveness. This commit attempts to defer initialization until right before the var is first used. I can't explain exactly why less instructions or shorter addressing happened since I didnt record what the asm looked like before. On VC 2003 -O1 -GL, S_intuit_more was previously 0x4B5 bytes of 32 bit machine code long, after it this change it is 0x4A3 bytes long. These changes should have no user visible effect. The scope of the vars was not reduced to avoid large indentation changes which would be required under C89 and Perl code formatting policy. ----------------------------------------------------------------------- Summary of changes: toke.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/toke.c b/toke.c index 987a68d..411fb42 100644 --- a/toke.c +++ b/toke.c @@ -3831,16 +3831,16 @@ S_intuit_more(pTHX_ char *s) return FALSE; else { /* this is terrifying, and it works */ - int weight = 2; /* let's weigh the evidence */ + int weight; char seen[256]; - unsigned char un_char = 255, last_un_char; const char * const send = strchr(s,']'); + unsigned char un_char, last_un_char; char tmpbuf[sizeof PL_tokenbuf * 4]; if (!send) /* has to be an expression */ return TRUE; + weight = 2; /* let's weigh the evidence */ - Zero(seen,256,char); if (*s == '$') weight -= 3; else if (isDIGIT(*s)) { @@ -3851,6 +3851,8 @@ S_intuit_more(pTHX_ char *s) else weight -= 100; } + Zero(seen,256,char); + un_char = 255; for (; s < send; s++) { last_un_char = un_char; un_char = (unsigned char)*s; -- Perl5 Master Repository
