Ann: Stackless technology merge under the way

Christian Tismer tismer at
Thu Oct 17 08:03:43 CEST 2002

Hi friends,

Stackless is changing heavily, once again.
After yesterday's move to Python 2.2.2,
I am now working on an integration of the old
technology (software only) and the new (modifying
the hardware stack).

This has a number of advantages:
- porting of existing applications, which depend on the
   old changes to Python's interpreter, becomes much easier.
   They tend to rely on a Python version of 2.0 or lower
   and use the old structures at the same time. Supporting
   these, again, makes it possible to do stepwise upgrades.
- existing applications like thread pickling (written by will be enabled again and merged into
   Stackless as a feature. While limited to
   plain frame contexts (no C function or method calls
   in between), this is very worth doing.
- the core Stackless code is using C stack manipulations
   right now in order to reduce stack size. This is not
   guaranteed to work with every C extension, since it is
   hard to check whether a foreign C call is sitting on the
   stack and relying on variables which must stay in place.
   The old technology was only able to switch Python stacks,
   when no recursive C calls were existing. This locks switches
   of C extensions automagically.
- the new technology can be removed from the Python core
   and be only used for the stackless extension, for tasklet
   switching. This is not decided yet, but an option.
- the amount of C stack space to me moved around is reduced
   drastically by this hybrid approach, since most of these
   vanish automatically. Although stack compression has been
   prepared (and will be supported), this is more time efficient.

The reason while I have no longer a problem to make this
decision is Python's current state. After generators have been
introduced, the core code already has a lot of properties
which I need to enable the old technology with ease.

Furthermore, this support code will not again try to cover
everything, but just the minimum to avoid most recursion.
It is neither planned to support stackless map or apply,
nor are continuations desired. The target are applications
which implemented coroutines on top of the old kernel.

This hybrid implementation has started today and will continue
over a couple of weeks.
The last "plain hardware switching" version is available under
the CVS tag "last_hardware_only", which is based on the
final 2.2.2 version.

I regard this move as the beginning of the
re-union of my brain halves    :-)

continuation-less - ly y'rs chris
Christian Tismer             :^)   <mailto:tismer at>
Mission Impossible 5oftware  :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9a     :    *Starship*
14109 Berlin                 :     PGP key ->
work +49 30 89 09 53 34  home +49 30 802 86 56  pager +49 173 24 18 776
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today?

More information about the Python-list mailing list