[squeak-dev] Re: Boolean over-optimization #ifTrue:/#ifFalse:

Igor Stasenko siguctua at gmail.com
Wed Mar 5 06:39:33 UTC 2008

On 05/03/2008, Paolo Bonzini <bonzini at gnu.org> 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, so people can do like:

Compiler turnOffOptimizations.
MyClass compileAll.
Compiler turnOnOptimizations.

>  Paolo

Best regards,
Igor Stasenko AKA sig.

More information about the Squeak-dev mailing list