Faster VM

sqrmax at cvtci.com.ar sqrmax at cvtci.com.ar
Fri Feb 19 22:51:44 UTC 1999


Hi.

I think this extract can be useful (Intel stuff):

Structuring C Code to Help Compilers Optimize

The compiler will need to know the dependencies of the program in order to 
optimize the code as much as possible. The
following rules will assist in this operation: 

     Careful use of pointers 
          Use of pointers will make data dependence vague. Thus, code 
optimization will be performed less
          aggressively.

     Minimize Use of Global Variables 
          The large scope of global variables limits the optimization 
abilities of the compiler

     Do Not Completely Unroll Loops 
          Loops are good on the PentiumÆ processor
          The compiler understands the CPU architecture
          Using a modern compiler will provide better loop optimizations

     Avoid Mixing 16 and 32 Bit Code 
          In 32 bit C code, avoid SHORT
          In 32 bit ASM, avoid 16 bit registers (ax, bx, etc.)
          Operand Size Override prefix is generated adding 1 clock and 
limiting instruction pairing

I've also found descriptions of how do the BTB works on plain Pentium 
processors and PPRO, PII and PMMX. Extremely interesting, the later suckers 
"compress" branch instructions by using a pseudo finite state model and then 
predict based on that! *VERY* clever, it can predict branch patterns and learn on 
the way.

Moreover, I've found several articles and files (following links from the 
url in a previous message of mine) about optimizing for intel processors, 
especially an expansion/extension on the intel's manual worth roughly 350kb of 
raw text. *DEEP* and *HUGE* stuff... it gave me a headache after roughly 3 
hours of reading and absorpting. I wish I had my sourcer working so I would be 
able to take a look at the VM's assembler code... do you know how can I get 
that to take a look in general?

Andres.





More information about the Squeak-dev mailing list