Leopold Toetsch <[EMAIL PROTECTED]> writes:

> Piers Cawley <[EMAIL PROTECTED]> wrote:
>> Leopold Toetsch <[EMAIL PROTECTED]> writes:
>
>>> We don't have a problem WRT register preservation, the problem arises
>>> due to register re-using.
>
>> Ah! [a light goes on over Piers's head].
>
>>>> Or am I missing something fundamental?
>
>>> I don't know ;)
>
>> I was. Hmm... bugger. So, unless we make the register allocator solve
>> the halting problem, the rule becomes "If you're playing silly beggars
>> with continuations and you're expecting to get at something in a
>> 'surprising' way, stuff it in a lexical or we guarantee that you will be
>> anally violated by an enraged waterbuffalo that's just sick to death of
>> non-determinism"?
>
> This would make quite a fine explanation in the docs, except that's a
> bit unclear about "stuff *it*". The waterbuffalo is concerned of
> preserved *temporary* variables too.

I just thought of a heuristic that might help with register
preservation:

A variable/register should be preserved over a function call if either of the
following is true:

1. The variable is referred to again (lexically) after the function has
   returned.  
2. The variable is used as the argument of a function call within the
   current compilation unit.

Condition 2 is something of a bugger if you have big compilation units,
but register allocation is always going to be a pain when there are big
compilation units around.

Reply via email to