Allocation of PASM registers (in PASM mode)

kjstol parrotcode at gmail.com
Sun Jan 11 11:41:27 UTC 2009


On Sun, Jan 11, 2009 at 4:36 AM, Will Coleda <will at coleda.com> wrote:

> On Sat, Jan 10, 2009 at 11:28 PM, Allison Randal <allison at parrot.org>
> wrote:
> > Klaas-Jan Stol wrote:
> >> hi,
> >>
> >> There is one minor detail on register allocation unclear to me,
> >> regarding PASM registers (in PASM files).
> >> When using/specifying PASM registers in PASM code, must these exact
> >> registers be used, or should the PASM compiler do the allocation?
> >>
> >> So, when writing:
> >>
> >> new P42, 'Integer'
> >> set P42, 100
> >> print P42
> >>
> >> Should P42 be mapped to P0 (i.e. the first available register), or
> >> should P42 be used (thus allocating at least 43 (counting from 0)
> >> registers).
> >> It's the difference between full power to the user (s/he might know what
> >> s/he's doing), or doing the allocation for the user.
> >>
> >> IMCC was originally written to handle the register allocation, as the
> >> default assembler did not handle that (which basically implies that
> >> register allocation should not be done in PASM mode). I do  not intend
> >> to change the implementation of IMCC (which, AFAIK, does register
> >> allocation even in PASM mode), but for PIRC, I can go either way: submit
> >> the PASM registers to the register allocator/optimizer, or use the
> >> registers as specified by the user.
> >
> > As far as the user is concerned, they have no guarantee that P42 is
> > allocated to any particular register. The only guarantee they have is
> > that P42 will hold the value they stored in it for as long as that value
> > is used within the program. This allows us to plug in any number of
> > allocation schemes behind the scenes.
> >
> > In PIRC you're free to do whatever you want, but I prefer option B):
> > intelligently allocate registers, and don't allocate 1000 registers just
> > because someone used P999.
> >
> > Allison
> > _______________________________________________
> > http://lists.parrot.org/mailman/listinfo/parrot-dev
> >
>
> If P42 in PASM acts the same way as $P42 in PIR, why do we have two
> different ways to say the same thing?
>

I would sure hate having to remove all '$' characters, should it be
deprecated ;-)

Seriously, Coke's point is valid. I was wrong in my earlier suspicion that
IMCC is doing register allocation in PASM mode; it doesnt. (easy to test:
write a PASM script, using register 42 (or any other non-zero, as IMCC's
allocator starts at 0), compile to bytecode and disassemble it.

For PIRC, the behavior can be changed by a trivial update. (it's even
documented ;-)

kjs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.parrot.org/pipermail/parrot-dev/attachments/20090111/fe522d81/attachment.htm 


More information about the parrot-dev mailing list