develooper Front page | perl.perl6.internals | Postings from November 2004

Re: Continuations, basic blocks, loops and register allocation

Thread Previous | Thread Next
From:
Jeff Clites
Date:
November 13, 2004 14:08
Subject:
Re: Continuations, basic blocks, loops and register allocation
Message ID:
82613F5E-35C0-11D9-AFE8-000393A6B9DA@mac.com
On Nov 13, 2004, at 11:16 AM, Matt Fowles wrote:

> All~
>
> On Sat, 13 Nov 2004 10:52:38 -0800, Jeff Clites <jclites@mac.com> 
> wrote:
>> On Nov 13, 2004, at 8:53 AM, Leopold Toetsch wrote:
>>> We'd have just to force using lexicals for all vars
>>
>> Having variable-size register sets would solve this, since you could
>> have fixed assignments of variables to registers, and not have to
>> suffer the overhead of moving data between registers and lexical pads
>> over-and-over. Well, it doesn't really "solve" it--just makes it
>> workable.
>
> I like the idea of mandating lexicals vars.  This would also eliminate
> the need for spilling (I think), as the register allocator would only
> need to refetch the lexical rather than save it off somewhere to be
> restored later.

In a way I feel like they're both same thing, just under a different 
description: spilling means moving data back-and-forth between 
registers and some other storage, and so does using lexicals.

But the only reason we have to do that sort of dance (under either 
description) is because we are RISC-ish: We have a limited number of 
registers, and calculations can only target registers (that is, you 
can't add 2 numbers directly in a lexical pad or other storage--they 
have to be moved to registers first). You don't have to move data 
back-and-forth if either you have an unlimited number of (preserved) 
registers, or you allow calculations to act directly on other memory 
locations. And I think this is again just two different ways of 
describing the same thing: you have an unlimited number of stable 
storage locations, and you do calculations directly from those 
locations. It's just that the former (unlimited preserved registers) 
feels cleaner, and doesn't require an explosion of op variants.

That's oversimplifying a bit, but I feel like those are the core issues 
(stemming from the observation of Leo's that continuations in effect 
give all variables a lifetime that extends to their entire block, in 
most cases).

JEff


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About