[squeak-dev] Re: 64 bit images (was Re: The Trunk: Collections-dtl.268.mcz)

Andreas Raab andreas.raab at gmx.de
Mon Jan 4 16:15:28 UTC 2010


Hi Jannik -

A couple of comments. First, If wordSize is a constant, put it into a 
class var. That's the best practice pattern for dealing with constants 
and I see no reason why one would opt to use an ivar for a value that 
never changes. See for example the EndianCache in SmalltalkImage and 
other use of constants throughout the system.

As for caching, if I understand your description correctly, then system 
tracer is storing the correct value for the traced image. When the image 
starts, your cache code invalidates the known to be correct value which 
is later lazily filled in with the same value again. So what observable 
effect does your cache invalidation have?

#startUp isn't the first method sent, not by a very long shot - in 
particular when you mess with the execution machinery you have to be 
aware that a method like #initialPC might be called before you ever get 
to the point where you invalidate that cache (I'm not sure if this can 
happen in this concrete case). In any case you should trace through the 
startup sequence to find out just how much other code is executed before 
getting there.

My recommendations would be to make WordSize a class variable, leave the 
lazy initialization in (it might be helpful during install etc) but add 
a nice comment explaining that only system tracer ever modifies that 
value when a 32/64 bit image is written. And leave out the pointless 
cache invalidation :-)

Cheers,
   - Andreas

Laval Jannik wrote:
> Hi Andreas,
> 
>> This may be the stupid question of the day, but can someone explain to me why we aren't just hard-wiring the word size (say in a CompiledMethod class var or so)? It's not like the primitive would *ever* return anything else unless you grind the image through SystemTracer,
> 
> the value of wordSize is initialized only one time,
> If wordSize is nil, it takes the value of the primitive 40.
> 
>> and if you do that, SystemTracer can simply update those values.
> 
> Yes, it does. SystemTracer pushes the value of primitive 40 in wordSize. 
> 
>> It seems silly to build caches, primitives, cache invalidation for a value which will never ever change dynamically. Besides I think the cache invalidation might be wrong -
> 
> The "cache" is synchronized with the VM only one time after the creation of the image,
> I think it is better than a hard-writing value.
> 
>> how do you know that initialPC or other word size related methods aren't sent before the startUp method is executed?
> 
> startUp method is the first method executed at the startup, no ?
> 
> But in SystemTracer, the value is initialized in "clonePreStartup" method. So there is no problem with potential method calls before startUp.
> 
>> Cheers,
>>  - Andreas
> 
> 
> Cheers,
> 
> ---
> Jannik Laval
> ---




More information about the Squeak-dev mailing list