Debugging confusion -- too many stacks!

Christian Tismer tismer at tismer.com
Sun Apr 2 10:52:12 EDT 2000


Hey, we forgot about a stack :-))

Michael Hudson wrote:
> 
> Christian Tismer <tismer at tismer.com> writes:
> 
> > This VM stack could also be replaced by a set of registers, since
> > the maximum stack size is always known at compile time.
> 
> My gut tells me that making this work with exceptions would be a dog.

I don't think so. Exception handlers have their own little stack
in each frame. It is currently fixed to 20 items, wasting quite
a lot of space most of the time (and this will vanish in
Stackless "Heresy" 1.2), but it won't cause problems with a
register machine.

> It's the sort of thing that might be fun to play with if the compiler
> and eval loop were written in Python, but if I have to hack C to play
> with these things, it just becomes tedious.  Still, maybe if I have a
> month or two with nothing else to do...

A while ago, I considered this, too. Meanwhile I don't, since
it doesn't bear a very reasonable speed gain. The win would be
to have less of the tiny operations occouring all the time,
and to have less of stack pointer operations. But when looking
closer to it, you will find that the most slowdown lies in
the outmost interpreter loop, which checks for periodic things
for every opcode, regardless wether it is very fast or a slow
function call.
In Stackless Python, I have stolen these cycles already. The eval
loop has some internal shortcuts to avoid this many checks. The fast
opcodes are all running as fast as possible, avoiding these
checks. One could still save some jumps and some assignments,
but this is not enough to justify the lots of changes that a
register implementation would impose to other modules.

It can still make sense to provide a hand-full of combined
opcodes which have high frequency. jump_if_true combined
with pop_top for instance, or some load/store combinations.
If you have a proposal, and if you will support them through
the bytecodehacks, I'd be happy to add them to Stackless Heresy.

Thanks for reminding me of that extra stack :-)

ciao - chris

-- 
Christian Tismer             :^)   <mailto:tismer at appliedbiometrics.com>
Applied Biometrics GmbH      :     Have a break! Take a ride on Python's
Kaunstr. 26                  :    *Starship* http://starship.python.net
14163 Berlin                 :     PGP key -> http://wwwkeys.pgp.net
PGP Fingerprint       E182 71C7 1A9D 66E9 9D15  D3CC D4D7 93E2 1FAE F6DF
     we're tired of banana software - shipped green, ripens at home




More information about the Python-list mailing list