At 03:21 PM 9/6/2001 +0100, Dave Mitchell wrote:
>Simon Cozens <[EMAIL PROTECTED]> wrote:
> > On Thu, Sep 06, 2001 at 02:54:29PM +0100, Dave Mitchell wrote:
> > > So I guess I'm asking whether we're abandoning the Perl 5 concept
> > > of a pad full of tmp targets, each hardcoded as the target for individual
> > > ops to store their tmp results in.
> >
> > Not entirely; the last thing we want to be doing is creating PMCs at
> > runtime.
>
>Sorry, I thought you were suggesting that at compile time a fixed number of
>tmp PMCs would be created, and slots 1-N of the PMC registers would be set
>permanently to point to them. Which is why I was concerned about the
>possibility of N+1 tmps being needed.

What we're going to do is have a get_temp opcode to fetch temporary PMCs. 
Where do they come from? Leave a plate of milk and cookies on your back 
porch and the Temp PMC Gnomes will bring them. :)

Seriously, we'll have a bunch of them handy for fetching as need be. The 
interpreter will manage it for us. (And we may go with the 'preallocated 
list of temps generated at scope entry' method that perl 5 uses)

> > > If a certain number of PMC regs are 'hardcoded' with pointers to
> > > PMC tmps, then we need to address register overflow, eg an expression 
> like
> > >
> > > foo($x+1, $x+2, ...., $x+65);
> >
> > That's slightly different, though, because that'll all be passed in as
> > a list.
>
>So how does that all work then? What does the parrot assembler for
>
>         foo($x+1, $x+2, ...., $x+65)
>
>look like roughly - and where do the 65 tmp PMCs come from? In Perl 5 they're
>the 65 pad tmps associated with the add ops.

         new P0, list            # New list in P0
         get_lex P1, $x          # Find $x
         get_type I0, P1         # Get $x's type
         set_i I1, 1             # Set our loop var
$10:   new P2, I0               # Get a temp of the same type as $x
         add P2, P1, I1          # Add counter to $x, store result in P2
         push P0, P2             # Push it into the list
         eq I1, 65, $20, $10     # If loop counter's 65 goto $20, else $10
$20     call foo                # Call the sub


At least that's one way to do it. The compiler may generate different code.

                                        Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to