----- Original Message -----
From: "Joseph Ryan" <[EMAIL PROTECTED]>
To: "Benjamin Goldberg" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Sunday, July 27, 2003 7:56 PM
Subject: Re: approaching python


> Benjamin Goldberg wrote:
>
> >K Stol wrote:
> >
> >>The register stuff, I presume, is register allocation and the like? When
> >>targeting IMCC, you can use an infinite amount of registers. Just keep a
> >>counter in the code generator, each time a new register is needed, just
> >>increment the counter and add a "${S|N|I|P}" in front of it (example:
> >>$P1). IMCC does register allocation and spilling.
> >>So this is not really difficult.
> >>
> >
> >Nono, the problem isn't that python uses *more* registers than
> ><whatever>, but rather, that it doesn't use registers at all.  Instead,
> >it uses a stack.  So, for example, python's add instruction might get
> >translated into the following pir or pasm code:
> >
> >   restore P0
> >   restore P1
> >   clone P0, P0
> >   add P0, P1
> >   save P0
> >
> >Needless to say, this is not efficient, due to how slow parrot's push
> >and pop operations are.

this is not what I meant. I didn't want the code generator to generate stack
based instructions, but to generate the most efficient instructions to get
something done, which in the case of Parrot, are register based
instructions.

----- Original Message -----
From: "Vladimir Lipskiy" <[EMAIL PROTECTED]>
To: "perl6-internals" <[EMAIL PROTECTED]>; "Benjamin Goldberg"
<[EMAIL PROTECTED]>
Sent: Monday, July 28, 2003 1:47 AM
Subject: Re: approaching python


> > Nono, the problem isn't that python uses *more* registers than
> > <whatever>, but rather, that it doesn't use registers at all.  Instead,
> > it uses a stack.  So, for example, python's add instruction might get
>
> Nobody said Python used more registers than <whatever>. Michal
> just worried if it would be problematic to deal with the register stuff.
> That's why he was hesitating whether to translate Python into IMCC
> or into Perl6 that could have handled all the register stuff by itself.
> And Klaas-Jan was trying to convince him that the register stuff
> wasn't such a beast with IMCC.
>
>
Yep!

Ok. let's review this for a moment, because I began to doubt myself.

At this moment, we have the original Python parser, written in Python.
There's also a code generator (CG) which produces python bytecode.
So, when a new CG is written in Python, that produces IMC instead, then we
have a compiler that translates python->IMC, and this compiler is completely
written in Python, right?

The eventual target is: a compiler that translates Python to IMC, written in
IMC (this could be compiled by Parrot to a pbc file, for efficiency)

When we use the Python->IMC compiler (written in Python) to compiler itself,
then we get a Python->IMC compiler written (generated by the Python->IMC
compiler) in IMC.

Maybe it's not possible to have the eval instruction right away, in the new
Python->IMC code generator. As long as this command is not used in the code
for this new code generator, this can just be skipped, and it may be
implemented in IMC by hand, and inserted into the new code generator
(Python->IMC, written in IMC)

Klaas-jan


Reply via email to