But in this simple example, I could remove t2 and use t1 instead.
No, "o1 foo", "o2 bar: t1", "o3 bar: t1" could have side-effects that influence what "o1 foo" returns. No tool on the world (without additional knowledge) can safely replace "t2" with "t1".
It is about the slot, not about the value. This is a perfectly legal transformation:
| t1 | t1 := o1 foo. o2 bar: t1. o3 bar: t1.
t1 := o1 foo. o2 bar: t1. o3 bar: t1.
That is the same what register allocators do. t1, as a slot, is not going to be read anymore, thus, the slot can be used to hold another temporary value.
Luckily Smalltalk is not a register machine. Even if your example looks perfectly linear, the order in which the statements are executed is pretty much unpredictable (think of exceptions, continuations, reflection, ...).
Well, anyway, I just hope that I can work around the frame size limitations when I encounter them in real code.
The NewCompiler had a visitor that would overflow excess literals into arrays. You could theoretically do the same for excess temps. Lukas -- Lukas Renggli www.lukas-renggli.ch