develooper Front page | perl.perl6.internals | Postings from May 2001

Stacks & registers

Thread Next
From:
Dan Sugalski
Date:
May 23, 2001 09:58
Subject:
Stacks & registers
Message ID:
5.1.0.14.0.20010523124715.0213c300@24.8.96.48
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?

My personal preference here is to make Parrot a register based system. I 
can wrap my head around that a lot easier than a stack system, it's 
something I'm comfortable with, there's lots of literature on optimizing 
this sort of system, and I just generally like it better. (I cut my 
programming teeth on 6502s... so sue me :) Stack based systems have a 
certain appeal--they're simpler generally, which is fine. I'm not too 
worried about simpler as much as I am faster, and I think we can get faster 
out of registers. (Or, if you prefer, "named temporaries" instead of 
registers. Whatever)

If (or when, I suppose, barring a Really Good Counter-Argument) we go the 
register route, then, should we have typed registers like most CPUs do? A 
set of PMC pointer registers, a set of integer registers, a set of 
floating-point registers, a set of string registers? And if we do go with 
typed registers, should they be linked together? (So that the int in 
Iregister 1 matches the integer value of the PMC in Pregister 1, and the 
float value in Fregister 1?) And if they're linked (And should they all be 
linked, or only some of them) should we guarantee consistency, or should 
the bytecode explicitly make various registers valid or invalid?

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.

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
dan@sidhe.org                         have teddy bears and even
                                      teddy bears get drunk


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