[squeak-dev] Compiler

Bert Freudenberg bert at freudenbergs.de
Thu Jun 21 10:11:23 UTC 2012


On 2012-06-20, at 20:24, Nicolas Cellier wrote:

> 2012/6/20 Bert Freudenberg <bert at freudenbergs.de>:
>> 
>>>> in practice a unary method can have at most 56 temps, but that's shared with the stack [...] To overcome this we would need larger context objects.
>> 
>> - Bert -
> 
> Oh, but for the number of args, I already have a hack squeak-ready in
> Smallapack, I just pass a single Array, and for the internal temps, we
> could use the same trick, maybe I did that too in VW.
> 
> I was more thinking of the depth of nested message a + (b + (c + (d +
> ... will be translated as
> push a; push b; push c; push d; ...; send +; send +; send +
> Is there a limitation there ?


No limit (except for method size). The stack of this context only needs to hold all the arguments for a single of these sends. It's cleared when the control returns to this context so it can be re-used for the next cascaded message send.

That's why, for example, long brace arrays are compiled as 

	(Array braceStream: N) nextPut: expr1; nextPut: expr2; nextPut: expr3; ... nextPut: exprN

whereas short ones used to be compiled as

	Array braceWith: expr1 with: expr2 with: expr3

Nowadays the short ones use Eliot's new "pop n into new array" byte code.

- Bert -




More information about the Squeak-dev mailing list