The more I tried to change/fix the compiler and checking the failing
testcases,
the more I learn about it.
Finally I think the compiler and testcases are mostly right and my
understanding was wrong.

My (wrong) assumptions were:
- the "numTemps" in the method header is always the number of declared
temps, regardless whether they end up in an indirection vector
- the inlined ifTrue: and the inlined whileTrue: blocks are handled the
same way,

both assumptions are wrong:
A method that starts with
foo
| a b c|

and all temps end up in an indirect vector has only 1 tempvar, the
"indirection vector" and even "numTemps" in the method header is 1.

ifTrue and whileTrue are handled differently for example in this case

|a|
a:=1.
(...) ifTrue:[
... assign to  "a"
... create a block which uses "a"
]

the block only needs a copy of "a", as it is not changed after the creation
of the block

|a|
a:=1.
[...] whileTrue:[
... assign to  "a"
... create a block which uses "a"
]

here we need a indirection vector, because the while-block *can* loop
repeatedly and change the value of "a" after
an block was created.

If this is all correct, there is only one problem in this special case (my
example above):
If there is no assignment within the loop at all, there is no need to
create a indirection vector and
all used vars (a b c) can just be copied.


Or am I still confused ?!


nicolai

Reply via email to