At 12:59 PM 05-23-2001 -0400, Dan Sugalski wrote:
>Okay, folks, here's the current conundrum:
>
>Should Parrot be a register or stack-based system, and if a register-based 
>one, should we go with typed registers?

<snip>

>My current thoughts are this:
>
>We have a set of N registers. They're all linked. Nothing implicitly sets 
>values in any of the registers (if you want an integer value, you need to 
>make one). Each register has a set of validity markers for each type (int, 
>flaot, string, PMC) that may or may not be bits. We have a stack of sorts 
>that we can push the registers on to if we need.

In the section I snipped, you described "linked" registers in relation to 
multiple sets of typed registers, with linking meaning that IntR1 would 
have the same value as FloatR1, etc.  What do you mean by "linked" here, 
with each register being (as I read it) dynamically typed?

Is N fixed, or can we have different number of visible registers at a 
time?  When we push registers onto the stack, do we push them individually, 
or as a set?

I mean, can we get away with something like (assuming C++-style overloading 
on "Register"):

------------------
Register rFile[MAXREGSTACK][N];
int rDepth = 0;

ParrotOp
add(int addend, int addor, int sum)
{
     rFile[rDepth][sum] = rFile[rDept][addor] + rFile[rDepth][addend];
}

ParrotOp
pushrframe(void)
{
    if (rDepth == MAXREGSTACK)
       die("Register Stack exceeded");

    rDepth++;
}

------------------------

Or we could go the SPARC register window route:
(Note:  SPARC register windows overlap: they have three sets of 8 
registers, and when a push happens, the old 3rd set becomes the new 1st 
set, allowing the caller and callee to share a set of 8 registers)
------------------------

Register *rFile = NULL;
Register *rFrame = NULL;
int rFileSize = 0;

ParrotOp
add(unsigned int addend, unsigned int addor, unsigned int sum)
{
   assert(sum < 3*N); assert(addend < 3*N); assert (addor < 3*N);
   rFrame[sum] = rFrame[addend] + rFrame[addor]
}

ParrotOp
pushRframe
{
   if ((rFrame - rFile) < rFileSize - 5*N) {
     if (resize(rFile,rFileSize*2)) {
       rFileSize *= 2;
     } else {
       die("Register Stack Frame out of memory");
     }
   }
   rFrame += 2*N;
}

--------------------------


>I'm definitely feeling unsure about this, so feel free (please!) to wade 
>in with comments, criticisms, or personal attacks... :)
>
>                                         Dan
>
>--------------------------------------"it's like this"-------------------
>Dan Sugalski                          even samurai
>[EMAIL PROTECTED]                         have teddy bears and even
>                                      teddy bears get drunk

Reply via email to