[pypy-dev] Thoughts on Stackless support

Christian Tismer tismer at stackless.com
Fri Dec 9 13:56:46 CET 2005


Hi pypy-dev,

Richard and I are prototyping stuff for Stackless support.
While doing this (only testing stuff, still no start on a module),
certain things struck us to be considered:

The existing support for yielding the current frame is very
poweful, being some one-shot continuation.
There is only a tiny wrapper necessary which updates this
continuation on every shot, and we have the concept of coroutines
in RPython. (Greenlets are almost the same)

Instead of just going for Greenlets/Tasklets on application level,
I think it makes very much sense to have coroutine support
built into RPython all the time. We can implement all kinds of stuff
with this, like generators and iterators would be very nice to
implement without having to think about state. We just need something
that yields, and let the rest be done by the builtin magic.

But maybe a much better reason to do this is the ability to write
real garbage collectors, because stack unwinding gives us total
control over all the objects!

Having that said, I now really agree that we should end up rewriting
the stackless support as a graph transformation. ATM, things are
happening at the very end, without knowledge of the rtyper. But if
we really use stack unwinding to implement iterators, it would be
great to do this in an explicit way, so that we can apply inlining
to it.

Explicit support of unwinding would mean to insert the extra
checking into the code, and to build state tuples which are
chained into the heap emulated stack. It would be great to also
have a way to avoid all of this, if iterators get inlined.
Right now, I have a hard time imaginating how this would work,
because we are using global structures for the chain of stack
records. Maybe it is no problem at all.

cheers - chris
-- 
Christian Tismer             :^)   <mailto:tismer at stackless.com>
tismerysoft GmbH             :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9A     :    *Starship* http://starship.python.net/
14109 Berlin                 :     PGP key -> http://wwwkeys.pgp.net/
work +49 30 802 86 56  mobile +49 173 24 18 776  fax +49 30 80 90 57 05
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today?   http://www.stackless.com/



More information about the Pypy-dev mailing list