Hi Eliot, hi John, This is what I do: - create a class var in SystemDictionary - accessors (wordSize and wordSize:), the first one can initialize the variable if nil, the second is to modify the value in case of 64bits image. Maybe the second one could be integrated in System-Tracing file. - in CompiledMethod, initialPC use it. Maybe we could integrate it in pharoCore. Cheers, Jannik ======= 'From PharoCore1.1ALPHA of ''19 October 2009'' [Latest update: #11088] on 16 December 2009 at 11:06:21 pm'! IdentityDictionary subclass: #SystemDictionary instanceVariableNames: 'cachedClassNames ' classVariableNames: 'LastImageName LastQuitLogPosition LowSpaceProcess LowSpaceSemaphore MemoryHogs ShutDownList SpecialSelectors StartUpList StartupStamp SystemChanges WordSize ' poolDictionaries: '' category: 'System-Support'! !SystemDictionary class methodsFor: 'initialization' stamp: 'jannik.laval 12/16/2009 22:40'! wordSize WordSize ifNil: [WordSize := [SmalltalkImage current vmParameterAt: 40] on: Error do: [4]]. ^WordSize! ! !SystemDictionary class methodsFor: 'initialization' stamp: 'jannik.laval 12/16/2009 22:40'! wordSize: aNumber WordSize := aNumber! ! IdentityDictionary subclass: #SystemDictionary instanceVariableNames: 'cachedClassNames' classVariableNames: 'LastImageName LastQuitLogPosition LowSpaceProcess LowSpaceSemaphore MemoryHogs ShutDownList SpecialSelectors StartUpList StartupStamp SystemChanges WordSize' poolDictionaries: '' category: 'System-Support'! !CompiledMethod methodsFor: 'accessing' stamp: 'jannik.laval 12/16/2009 22:41'! initialPC "Answer the program counter for the receiver's first bytecode." ^ (self numLiterals + 1) * SystemDictionary wordSize + 1! ! ======= |
addWordSizeInSystemDictionary.1.cs
Description: Binary data
On Dec 16, 2009, at 18:32 , Eliot Miranda wrote: Um, I'm _quite_ serious on insisting that Smalltalk wordSize be implemented in some way that caches the value in e.g. a class variable (or class inst var for max speed) that is reevaluated on startup. initialPC is evaluated a lot, e.g. once for every method in a "browse inst var refs". This is performance-critical, and going to a slow primitive to access something that can only change at startup is not a good idea. Please arrange that e.g. SystemDictionary gains a class var that caches the word size. |
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project