[squeak-dev] Compiling with macro inliner switch [was: Boolean over-optimization #ifTrue:/#ifFalse:]

Klaus D. Witzel klaus.witzel at cobss.com
Wed Mar 5 08:13:20 UTC 2008

On Wed, 05 Mar 2008 07:39:33 +0100, Igor Stasenko wrote:

> On 05/03/2008, Paolo Bonzini wrote:
>> Igor Stasenko wrote:
>>  > Hello,
>>  >
>>  > i currently tried to implement a proxy (subclass of ProtoObject) with
>>  > own IfTrue:/ifFalse: methods.
>>  > What i can't understand, is why VM throws me with #mustBeBoolean
>>  > message instead of doing real send if optimized pattern fails (when
>>  > receiver of #IfTrue: is a non-boolean)?
>> Because you cannot distinguish #ifTrue:#ifFalse: sends from #whileTrue:
>>  for example, and because there are no BlockC{ontext,losure} objects for
>>  the argument blocks.
> So, the only way is to compile method without optimization of #ifTrue  
> #ifFalse:, to make sure they do real sends?
> If yes, i'd like to see optimizations optional,

For Rob Wither's project I've made a small patch  
NoMacroCompiler-kwl.1dot5.cs which allows to specify per method (in a  
pragma) or system-wide that macros are inlined or result in a full send.  
Could be adapted to select what kind of macro not/to optimize. I've also  
identified which Squeak .image methods *must* be compiled *with* macro  
inlineing so that the .image does not crash/get stuck. And out of  
meta-programming/memory reasons, the implementation of #whileTrue*,  
#whileFalse* must be compiled *with* inlineing ;-)

Let me know if that's interesting to you.


> so people can do like:
> Compiler turnOffOptimizations.
> MyClass compileAll.
> Compiler turnOnOptimizations.
>>  Paolo

More information about the Squeak-dev mailing list