On Sun, 27 Jul 2003, Joseph Ryan wrote: > Benjamin Goldberg wrote: > > >[...] 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. > > Well, thats because you're trying to make a register machine act like a > stack machine. It would be more efficient to translate add as: > > $P2 = $P0 + $P1
Having looked into how this actually works in python, I don't think that we actually have to worry about the stack issue at all. Python's stack problems seem to be confined to the bytecode level, so if you're translating the bytecode directly, you'd need to either simulate the stack or work around it somehow, but, as far as I can tell, it should be no problem at all to generate register-aware code from the parse tree and not worry about the stack at all. Sincerely, Michal J Wallace Sabren Enterprises, Inc. ------------------------------------- contact: [EMAIL PROTECTED] hosting: http://www.cornerhost.com/ my site: http://www.withoutane.com/ --------------------------------------