[Python-Dev] Eliminating the block stack (was Re: Store x Load x --> DupStore)

Guido van Rossum gvanrossum at gmail.com
Mon Feb 21 04:47:08 CET 2005


> >>Eliminating the blockstack would be nice (esp. if it's enough to get
> >>frames small enough that they get allocated by PyMalloc) but this
> >>seemed to be tricky too (or at least Armin, Samuele and I spent a
> >>cuple of hours yakking about it on IRC and didn't come up with a clear
> >>approach).  Dynamically allocating the blockstack would be simpler,
> >>and might acheive a similar win.  (This is all from memory, I haven't
> >>thought about specifics in a while).

I don't know if this helps, but since I invented the block stack
around 1990, I believe I recall the main reason to make it dynamic was
to simplify code generation, not because it is inherently dynamic. At
the time an extra run-time data structure seemed to require less
coding than an extra compile-time data structure. The same argument
got me using dicts for locals; that was clearly a bottleneck and
eliminated long ago, but I think we should be able to lose the block
stack now, too. Somewhat ironically, eliminating the block stack will
reduce the stack frame size, while eliminating the dict for locals
added to it. :-)

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list