Switching to use foo struct on Windows VM

tim Rowledge tim at rowledge.org
Sun Jul 15 23:50:24 UTC 2007

On 15-Jul-07, at 11:55 AM, sig wrote:

> The only platform , which uses another level of indirection is RiscOS
> (which passes
> 'globalStructDefined: false'  to CCodeGeneratorGlobalStructure).
> when globalStructDefined: false, it not generates a line in each
> function (register struct foo * foo = &fum;) and uses foo directly (it
> seems that 'foo' declared somewhere in platform code, because
> CCodeGeneratorGlobalStructure omits declaration of foo, when
> globalStructDefined: false).
The ARM compiler makes it nice and easy to declare global register  
variables and foo is so declared. It means that all those globals are  
accessible by a nice simple
LDR val, [foo, #offsetforval]
instead of
LDR val, [stackframe base, #offset1]
LDR val,[val, #offsetforval]
which also gets replicated for stores.

The idea for global register variables was (so far as I know) another  
bit of genius from Eliot; he had been faking it by spoofing the SUN  
compiler and since I couldn't be bothered to try the same trickery on  
the ARM cc I spoke to the guys at ARM that wrote the compiler and  
persuaded them to add the facility as a proper pragma. IIRC it was  
worth about 30% performance back in 1988 on a 12MHz ARM3 system. At  
some later date I believe Eliot was able to persuade the gcc people  
to add a similar capability.

tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
If it was easy, the hardware people would take care of it.

More information about the Squeak-dev mailing list