[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Register allocation with shadowed locals at same level
- From: Rob Kendrick <rjek@...>
- Date: Mon, 18 Jan 2010 13:34:52 +0000
On Mon, 18 Jan 2010 11:10:48 -0200
Roberto Ierusalimschy <email@example.com> wrote:
> > Nod. Although a simple algorithm to detect if there's already a
> > local with the same name declared within the same scope, and to
> > reuse that register (after emptying it) would be a solution to the
> > problem. [...]
> You cannot do that. Inner functions may still use the first variable,
> even if its name is shadowed.
Although only if such functions are defined between declarations. Are
there any other cases, other than functions, that lock such variables?
> > [...] having a spare register for some more locals, should you need
> > them.
> Have you ever needed more registers than the compiler provides?
I've not, but I have certainly seen people complain about hitting the
limit before. The issue for me is how these values are essentially
leaked in some circumstances.