[Newcompiler] Compiling the decompilable

Klaus D. Witzel klaus.witzel at cobss.com
Sat Oct 14 14:55:01 UTC 2006


On Sat, 14 Oct 2006 16:18:09 +0200, Mathieu Suen wrote:
> Klaus D. Witzel a écrit :
>> Attached is SourceCode2BytecodeTest.st which tests bytecode resulting
>> from source code.
>>
>> With the new compiler there are two cases red (store followed by pop
>> does not combine to popAndStore).
>
> I saw one that is normal #testReturnTopFromBlock
> you should do:
>
> testReturnTopFromBlock
> 	| selector methodNode scanner |
> 	selector := (methodNode := self compile2methodNode: 'returnTopFromBlock  
> ^[ia]') selector.

Sorry, the 'ia' name should have already gone away and be replaced by the  
'instVar' name (has nothing to do with your suggestion).

> 	scanner := InstructionStream on: methodNode method.
>
> beceause if you do nothing the compiler optimize it as a "quick self  
> return" so you will not see the block.

Hhm, the new compiler currently does not optimize the block away. And I do  
not expect that it will.

A statement like '[instVar]' is an expression, why should the compiler  
*not* push it onto the stack? Would you say the same for '{[instVar]}' or  
even just 'instVar'? These three statements are legitimate expressions,  
regardless of their value and their effect. Imagine I do 'instVar halt'  
then later change that to 'instVar'. I do so in order to not forget that I  
still want to do something with instVar, but am too lazy now to also send  
something to instVar. And I can query for 'inst var refs ...' in any  
browser and find the exact location of code again.

/Klaus



More information about the Newcompiler mailing list